Commit cd697ff7 authored by Luke081515's avatar Luke081515
Browse files

Add verbose-debug

* Added a way to configure the assert at debug.php
* Allow the user to start debug with the verbose-debug option
* Added the verbose-debug option, which echos all successful httpRequests
* verbose-default is only available for non-production scripts (via initcurlArgs) and disabled by default
parent ef0793be
......@@ -20,6 +20,7 @@ class Core extends Password {
private $version = "Cygnus-Framework V2.1 alpha";
private $ua;
private $maxlag;
private $debugMode = false;
/** initcurl
* initializes curl
......@@ -62,7 +63,10 @@ class Core extends Password {
* @param $pUseHTTPS - [optional: true] if false, http will be used
* @param $assert - [optional: bot] if set to "user" instead, you can use a bot without flag
*/
public function initcurlArgs($job, $pUseHTTPS = true, $assert = "bot") {
public function initcurlArgs($job, $pUseHTTPS = true, $assert = "bot", $debugMode = false) {
if ($debugMode) {
$this->debugMode = true;
}
if ($assert !== "bot" && $assert !== "user")
exit(1);
$this->assert = $assert;
......@@ -142,10 +146,14 @@ class Core extends Password {
sleep(10);
}
}
if ($success === true)
if ($success === true) {
if ($this->debugMode) {
echo "\nResult for " . $arguments . ":\n'" . $rqResult . "'";
}
return $rqResult;
else
} else {
throw new Exception("Curl request definitively failed: " . curl_error($this->curlHandle));
}
}
/** requireToken
* query the api for the token
......
......@@ -11,7 +11,14 @@ class Debug extends Core {
$this->setSite($this->askRequired('Enter the domain to use:'));
$this->setUsername($this->askRequired('Enter the username to use:'));
$this->setPassword($this->askRequired('Enter the password to use:'));
$this->initcurlArgs('Debug', true);
$assert = $this->askRequired('Enter the value for assert:');
$debug = $this->askRequired('Use verbose debug mode? [y/N]');
if (strtolower($debug) !== 'n') {
$debug = true;
} else {
$debug = false;
}
$this->initcurlArgs('Debug', true, $assert, $debug);
$this->login();
do {
$this->debug($this->askRequired("Name of the function you want to debug:"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment