Permalink
Browse files

Add --debug option

  • Loading branch information...
1 parent 978309f commit 544d117658967f58edd3c165e46a009f2bf9b93c @ccesario committed Aug 14, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 pfsensebkp/pfsensebkp.php
View
16 pfsensebkp/pfsensebkp.php
@@ -105,6 +105,7 @@ function showHelp()
--help :: Show this message
--config <config file> :: XML config file
+ --debug :: Debug process
";
echo $helpProgram;
@@ -125,6 +126,8 @@ function printMessage($message)
// gets the data from a URL
function do_backup($configHost = array())
{
+ global $debugprocess;
+
if (($configHost) && (is_array($configHost))) {
$host_address=$configHost['address'];
@@ -156,10 +159,11 @@ function do_backup($configHost = array())
// debug
// display communication with server
- curl_setopt($ch, CURLOPT_VERBOSE, true);
-
- //$fp = fopen("debug.tmp", "w");
- //curl_setopt($ch, CURLOPT_STDERR, $fp);
+ if ($debugprocess) {
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
+ //$fp = fopen("debug.tmp", "w");
+ //curl_setopt($ch, CURLOPT_STDERR, $fp);
+ }
if ($host_protocol == 'https') {
//check if certificate is valid
@@ -260,6 +264,10 @@ function do_backup($configHost = array())
showHelp();
break;
+ case '--debug':
+ $debugprocess = true;
+ break;
+
case '--config':
if (!$argv[($param + 1)]) {
printMessage("Incorrect params");

0 comments on commit 544d117

Please sign in to comment.