From f97cededf37ff469f6e3d7e1c66d978a01dd18b2 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 20 Nov 2012 19:27:36 +0000 Subject: [PATCH] 2012-11-20 Miguel de Dios * extensions/update_manager/load_updatemanager.php, extensions/update_manager/debug.php: fixed the execution of keygen when there is some wrong in the execution the message for user is more clean now show "Error in execution the keygen." instead the message "Error Server authorisation rejected". And added other forms to get debugData for the update. MERGED FROM THE BRANCH PANDORA_4.0 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7176 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++ .../extensions/update_manager/debug.php | 42 ++++++++++++------- .../update_manager/load_updatemanager.php | 8 +++- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d76bc3661f..a0176a9103 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-11-20 Miguel de Dios + + * extensions/update_manager/load_updatemanager.php, + extensions/update_manager/debug.php: fixed the execution of keygen + when there is some wrong in the execution the message for user is + more clean now show "Error in execution the keygen." instead the + message "Error Server authorisation rejected". And added other forms + to get debugData for the update. + + MERGED FROM THE BRANCH PANDORA_4.0 + 2012-11-20 Ramon Novoa * include/functions_groups.php, diff --git a/pandora_console/extensions/update_manager/debug.php b/pandora_console/extensions/update_manager/debug.php index 8bd89d3d22..12162b23fe 100644 --- a/pandora_console/extensions/update_manager/debug.php +++ b/pandora_console/extensions/update_manager/debug.php @@ -18,14 +18,17 @@ //////////////////////////////////// ///////PLEASE DONT TOUCH global $debug_update_manager; +global $debug_mode_output; //////////////////////////////////// //////////////////////////////////// //////////////////////////////////// -///////PLEASE ONLY CHANGE THIS VALUE +///////PLEASE ONLY CHANGE THESE VALUES $debug_update_manager = 0; +//There are "notice_php" and "logDebug". +$debug_mode_output = "notice_php"; //////////////////////////////////// //////////////////////////////////// @@ -43,22 +46,31 @@ $debug_update_manager = 0; ///////PLEASE DONT TOUCH function print_debug_message_trace($message) { global $debug_update_manager; + global $debug_mode_output; if ($debug_update_manager) { - trigger_error("PRINT DEBUG TRACE", - E_USER_NOTICE); - - trigger_error($message, E_USER_NOTICE); - - $backtrace = json_encode(debug_backtrace()); - $backtrace_chunks = str_split($backtrace, 1024); - - trigger_error("INIT DEBUG BACKTRACE (JSON ENCODE) CHUNKS " . - count($backtrace_chunks), E_USER_NOTICE); - foreach ($backtrace_chunks as $chunk) - trigger_error($chunk, E_USER_NOTICE); - trigger_error("END DEBUG BACKTRACE (JSON ENCODE)", - E_USER_NOTICE); + switch ($debug_mode_output) { + case "notice_php": + trigger_error("PRINT DEBUG TRACE", + E_USER_NOTICE); + + trigger_error($message, E_USER_NOTICE); + + $backtrace = json_encode(debug_backtrace()); + $backtrace_chunks = str_split($backtrace, 1024); + + trigger_error("INIT DEBUG BACKTRACE (JSON ENCODE) CHUNKS " . + count($backtrace_chunks), E_USER_NOTICE); + foreach ($backtrace_chunks as $chunk) + trigger_error($chunk, E_USER_NOTICE); + trigger_error("END DEBUG BACKTRACE (JSON ENCODE)", + E_USER_NOTICE); + break; + case "logDebug": + html_debug_print($message, true); + html_debug_print(debug_backtrace(), true); + break; + } } } //////////////////////////////////// diff --git a/pandora_console/extensions/update_manager/load_updatemanager.php b/pandora_console/extensions/update_manager/load_updatemanager.php index 412a799b66..b4274a49b7 100644 --- a/pandora_console/extensions/update_manager/load_updatemanager.php +++ b/pandora_console/extensions/update_manager/load_updatemanager.php @@ -82,7 +82,13 @@ function get_user_key ($settings) { print_debug_message_trace("command_line >>> " . $command_line); //html_debug_print($command_line, true); - $user_key = exec ($command_line); + $user_key = exec ($command_line, $output, $return_exec); + + if ($return_exec != 0) { + //Maybe there is a error in the execution. + return array('result' => false, + 'message' => __('Error in execution the keygen.')); + } print_debug_message_trace("user_key >>> " . $user_key); //html_debug_print($user_key, true);