From e07843c2384a6e31d29fcb72edf6ba7ab35765bc Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Sun, 27 Dec 2009 10:52:22 +0000 Subject: [PATCH] Some basic queries were failing during cron mode due to failure of the 'menu' query. Also added getLastQuery() function for easier debugging. --- e107_handlers/menu_class.php | 11 +++++++++-- e107_handlers/mysql_class.php | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 4cb17140d..afbe06a29 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -9,8 +9,8 @@ * e107 Menu Class * * $Source: /cvs_backup/e107_0.8/e107_handlers/menu_class.php,v $ - * $Revision: 1.16 $ - * $Date: 2009-11-18 01:04:43 $ + * $Revision: 1.17 $ + * $Date: 2009-12-27 10:52:22 $ * $Author: e107coders $ */ @@ -60,6 +60,13 @@ class e_menu */ public function init() { + global $_E107; + + if(vartrue($_E107['cli'])) + { + return; + } + $menu_layout_field = THEME_LAYOUT!=e107::getPref('sitetheme_deflayout') ? THEME_LAYOUT : ""; $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field)); $menu_data = e107::getArrayStorage()->ReadArray($menu_data); diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 0fd2cf2a5..f48927d92 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -9,9 +9,9 @@ * mySQL Handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $ - * $Revision: 1.72 $ - * $Date: 2009-12-26 23:20:21 $ - * $Author: e107steved $ + * $Revision: 1.73 $ + * $Date: 2009-12-27 10:52:22 $ + * $Author: e107coders $ */ @@ -20,7 +20,7 @@ * * @package e107 * @subpackage e107_handlers - * @version $Id: mysql_class.php,v 1.72 2009-12-26 23:20:21 e107steved Exp $; + * @version $Id: mysql_class.php,v 1.73 2009-12-27 10:52:22 e107coders Exp $; * * @todo separate cache for db type tables */ @@ -77,6 +77,7 @@ class e_db_mysql protected $mySQLlastErrNum = 0; // Number of last error - now protected, use getLastErrorNumber() protected $mySQLlastErrText = ''; // Text of last error - now protected, use getLastErrorText() + protected $mySQLlastQuery = ''; public $mySQLcurTable; public $mySQLlanguage; @@ -246,6 +247,8 @@ class e_db_mysql { global $db_time,$db_mySQLQueryCount,$queryinfo; $db_mySQLQueryCount++; + + $this->mySQLlastQuery = $query; if ($debug == 'now') { @@ -883,10 +886,10 @@ class e_db_mysql */ public function db_Select_gen($query, $debug = FALSE, $log_type = '', $log_remark = '') { + global $db_mySQLQueryCount; + $this->tabset = FALSE; - - - + $query .= " "; // temp fix for failing regex below, when there is no space after the table name; if(strpos($query,'`#') !== FALSE) @@ -1466,6 +1469,11 @@ class e_db_mysql { return $this->mySQLlastErrText; // Text of last error (empty string if no error) } + + function getLastQuery() + { + return $this->mySQLlastQuery; + } /** * Check if MySQL version is utf8 compatible and may be used as it accordingly to the user choice