]> git.mxchange.org Git - mailer.git/commitdiff
Database links should be up before we send queries, now a trigger_error() is added...
authorRoland Häder <roland@mxchange.org>
Sun, 26 Jul 2009 12:43:25 +0000 (12:43 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 26 Jul 2009 12:43:25 +0000 (12:43 +0000)
inc/db/lib-mysql3.php
inc/extensions.php

index 8f57bf199e99bf1edbd2716f7d0f4065172253da..e005e753b95a7fe87ade5427feda0898a19e913f 100644 (file)
@@ -45,7 +45,17 @@ if (!defined('__SECURITY')) {
 // SQL queries
 function SQL_QUERY ($sql_string, $F, $L) {
        // Link is up?
-       if (!SQL_IS_LINK_UP()) return false;
+       if (!SQL_IS_LINK_UP()) {
+               // We should not quietly ignore this!
+               trigger_error(sprintf("Cannot query database: sql_string=%s,file=%s,line=%s",
+                       $sql_string,
+                       basename($F),
+                       $L
+               ));
+
+               // Return 'false' because it has failed
+               return false;
+       } // END - if
 
        // Remove \t, \n and \r from queries they may confuse some MySQL version I have heard
        $sql_string = str_replace("\t", " ", str_replace("\n", " ", str_replace("\r", " ", $sql_string)));
@@ -62,7 +72,7 @@ function SQL_QUERY ($sql_string, $F, $L) {
        // Run SQL command
        //* DEBUG: */ echo $sql_string."<br />\n";
        $result = mysql_query($sql_string, SQL_GET_LINK())
-       or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error()."<br />
+               or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error()."<br />
 Query string:<br />
 ".$sql_string);
 
index 5f93aecc45eff0ccb99eb72e33083c05237673c0..e11a41a315f097b4d21d7b954e2f1d2beea2292e 100644 (file)
@@ -88,7 +88,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = '', $EXT_VER = '', $dry_run
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded.");
                $GLOBALS['ext_loaded']['lang'][$ext_name] = true;
                loadIncludeOnce($langInclude);
-       } elseif ($ext_name != 'sql_patches') {
+       } elseif (($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) {
                // No language file is not so good...
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("WARNING: Extension %s has no language file or we cannot read from it. lang=%s",
                        $ext_name, getLanguage()
@@ -104,7 +104,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = '', $EXT_VER = '', $dry_run
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Functions loaded.");
                $GLOBALS['ext_loaded']['funcs'][$ext_name] = true;
                loadIncludeOnce($funcsInclude);
-       } elseif ($ext_name != 'sql_patches') {
+       } elseif (($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) {
                // No functions file is not so good...
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("WARNING: Extension %s has no own functions file or we cannot read from it.",
                        $ext_name
@@ -486,14 +486,17 @@ function GET_EXT_VERSION ($ext_name) {
        } elseif (!isCacheInstanceValid()) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE `ext_name`='%s' LIMIT 1",
-               array($ext_name), __FUNCTION__, __LINE__);
+                       array($ext_name), __FUNCTION__, __LINE__);
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
 
                // Is the extension there?
                if (SQL_NUMROWS($result) == 1) {
                        // Load entry
                        list($ext_ver) = SQL_FETCHROW($result);
-               } // END - if
+               } else {
+                       // Not found!
+                       DEBUG_LOG(__FUNCTION__, __LINE__, sprintf(": Cannot find extension %s in database!", $ext_name));
+               }
 
                // Free result
                SQL_FREERESULT($result);