Fixes for fix_menu.php and SQL_ALTER_TABLE()
authorRoland Häder <roland@mxchange.org>
Tue, 3 Nov 2009 21:59:10 +0000 (21:59 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 3 Nov 2009 21:59:10 +0000 (21:59 +0000)
inc/db/lib-mysql3.php
inc/extensions-functions.php
inc/extensions/ext-network.php
inc/filters.php
inc/fix_menu.php

index a0f4499b147e583f014001c6f179f54888486c07..c597cafbbe9e27f5366e956203c33becd997586d 100644 (file)
@@ -78,12 +78,12 @@ function SQL_QUERY ($sqlString, $F, $L) {
        $querytimeBefore = array_sum(explode(' ', microtime()));
 
        // Run SQL command
        $querytimeBefore = array_sum(explode(' ', microtime()));
 
        // Run SQL command
-       //* DEBUG: */ print($sqlString . '<br />');
+       ///* DEBUG: */ print($sqlString . '<br />');
        $result = mysql_query($sqlString, SQL_GET_LINK())
                or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error() . '<br />
 Query string:<br />
 ' . $sqlString);
        $result = mysql_query($sqlString, SQL_GET_LINK())
                or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error() . '<br />
 Query string:<br />
 ' . $sqlString);
-       //* DEBUG: */ print(__LINE__ . ': numRows=' . SQL_NUMROWS($result) . ',affected=' . SQL_AFFECTEDROWS() . "<br />");
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sqlString . ',numRows=' . SQL_NUMROWS($result) . ',affected=' . SQL_AFFECTEDROWS());
 
        // Ending time
        $querytimeAfter = array_sum(explode(' ', microtime()));
 
        // Ending time
        $querytimeAfter = array_sum(explode(' ', microtime()));
@@ -272,7 +272,6 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure
        // Link is there?
        if ((!SQL_IS_LINK_UP()) || (!is_array($data))) return false;
 
        // Link is there?
        if ((!SQL_IS_LINK_UP()) || (!is_array($data))) return false;
 
-       /* Other way */
        // Escape all data
        $dataSecured['__sql_string'] = $qstring;
        foreach ($data as $key => $value) {
        // Escape all data
        $dataSecured['__sql_string'] = $qstring;
        foreach ($data as $key => $value) {
@@ -281,50 +280,12 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure
 
        // Generate query
        $query = call_user_func_array('sprintf', $dataSecured);
 
        // Generate query
        $query = call_user_func_array('sprintf', $dataSecured);
-       /*
-       /* Old eval() way... *
-       // Init variable
-       $query = 'failed';
-
-       if ($strip === true) {
-               $strip = 'true';
-       } else {
-               $strip = 'false';
-       }
-
-       if ($secure === true) {
-               $secure = 'true';
-       } else {
-               $secure = 'false';
-       }
-
-       $eval = "\$query = sprintf(\"" . $qstring . "\"";
-       foreach ($data as $var) {
-               if ((!empty($var)) || ($var === 0)) {
-                       $eval .= ", SQL_ESCAPE('" . $var . "', " . $secure . ', ' . $strip . ')';
-               } else {
-                       $eval .= ", ''";
-               }
-       } // END - foreach
-       $eval .= ');';
-       **/
 
        // Debugging
        //
 
        // Debugging
        //
-       //* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!");
-       //* DEBUG: */ fwrite($fp, $F.'('.$L."): ".str_replace("\r", '', str_replace("\n", " ", $eval))."\n");
-       //* DEBUG: */ fclose($fp);
-
-       // Run the code
-       /**
-       eval($eval);
-
-       // Was the eval() command fine?
-       if ($query == 'failed') {
-               // Something went wrong?
-               debug_report_bug('eval=' . $eval);
-       } // END - if
-       **/
+       ///* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!");
+       ///* DEBUG: */ fwrite($fp, $F.'('.$L."): ".str_replace("\r", '', str_replace("\n", " ", $eval))."\n");
+       ///* DEBUG: */ fclose($fp);
 
        if ($run === true) {
                // Run SQL query (default)
 
        if ($run === true) {
                // Run SQL query (default)
@@ -356,7 +317,7 @@ function SQL_ESCAPE ($str, $secureString=true, $strip=true) {
                        $ret = smartAddSlashes($str);
                } elseif (function_exists('mysql_real_escape_string')) {
                        // The new and improved version
                        $ret = smartAddSlashes($str);
                } elseif (function_exists('mysql_real_escape_string')) {
                        // The new and improved version
-                       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):str={$str}<br />");
+                       ///* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'str='.$str);
                        $ret = mysql_real_escape_string($str, SQL_GET_LINK());
                } elseif (function_exists('mysql_escape_string')) {
                        // The obsolete function
                        $ret = mysql_real_escape_string($str, SQL_GET_LINK());
                } elseif (function_exists('mysql_escape_string')) {
                        // The obsolete function
@@ -414,6 +375,8 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
        $noIndex = (
        (
                strpos($sql, 'INDEX') === false
        $noIndex = (
        (
                strpos($sql, 'INDEX') === false
+       ) && (
+               strpos($sql, 'KEY') === false
        ) && (
                strpos($sql, 'FULLTEXT') === false
        ) && (
        ) && (
                strpos($sql, 'FULLTEXT') === false
        ) && (
@@ -422,44 +385,58 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
        );
 
        // Extract table name
        );
 
        // Extract table name
-       $tableArray = explode(" ", $sql);
+       $tableArray = explode(' ', $sql);
        $tableName = str_replace('`', '', $tableArray[2]);
 
        // Shall we add/drop?
        if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false)) && ($noIndex === true)) {
        $tableName = str_replace('`', '', $tableArray[2]);
 
        // Shall we add/drop?
        if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false)) && ($noIndex === true)) {
-               // And column name as well
-               $columnName = str_replace('`', '', $tableArray[4]);
-
-               // Get column information
-               $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
-                       array($tableName, $columnName), __FILE__, __LINE__);
-
-               // Do we have no entry on ADD or an entry on DROP?
-               // 123           4       4     3    3      4           4          32    23           4       4     3    3      4            4          321
-               if (((SQL_NUMROWS($result) == 0) && (strpos($sql, 'ADD') !== false)) || ((SQL_NUMROWS($result) == 1) && (strpos($sql, 'DROP') !== false))) {
-                       // Do the query
-                       //* DEBUG: */ print(__LINE__.':'.$sql."<br />");
-                       $result = SQL_QUERY($sql, $F, $L, false);
-               } // END - if
+               // Try two columns, one should fix
+               foreach (array(4,5) as $idx) {
+                       // And column name as well
+                       $columnName = str_replace('`', '', $tableArray[$idx]);
+
+                       // Get column information
+                       $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
+                               array($tableName, $columnName), __FILE__, __LINE__);
+
+                       // Do we have no entry on ADD or an entry on DROP?
+                       // 123           4       4     3    3      4           4          32    23           4       4     3    3      4            4          321
+                       if (((SQL_NUMROWS($result) == 0) && (strpos($sql, 'ADD') !== false)) || ((SQL_NUMROWS($result) == 1) && (strpos($sql, 'DROP') !== false))) {
+                               // Do the query
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
+                               $result = SQL_QUERY($sql, $F, $L, false);
+
+                               // Skip further attempt(s)
+                               break;
+                       } elseif ((((SQL_NUMROWS($result) == 1) && (strpos($sql, 'ADD') !== false)) || ((SQL_NUMROWS($result) == 0) && (strpos($sql, 'DROP') !== false))) && ($columnName != 'KEY')) {
+                               // Abort here because it is alreay there
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: ' . $sql);
+                               break;
+                       } elseif ($columnName != 'KEY') {
+                               // Something didn't fit
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql);
+                       }
+               } // END - foreach
        } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
                // Skip this query silently
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,file=%s,line=%s", $sql, $F, $L));
        } elseif ($noIndex === false) {
                // And column name as well
        } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
                // Skip this query silently
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,file=%s,line=%s", $sql, $F, $L));
        } elseif ($noIndex === false) {
                // And column name as well
-               $columnName = str_replace('`', '', $tableArray[4]);
+               //* DEBUG: */ print __LINE__.':tableArray=<pre>' . print_r($tableArray, true) . '</pre>';
+               $keyName = str_replace('`', '', $tableArray[5]);
 
                // Is this "UNIQUE" or so? FULLTEXT has been handled the elseif() block above
 
                // Is this "UNIQUE" or so? FULLTEXT has been handled the elseif() block above
-               if (in_array(strtoupper($columnName), array('INDEX', 'UNIQUE', 'KEY', 'FULLTEXT'))) {
+               if (in_array(strtoupper($keyName), array('INDEX', 'UNIQUE', 'KEY', 'FULLTEXT'))) {
                        // Init loop
                        // Init loop
-                       $begin = 1; $columnName = ',';
-                       while (strpos($columnName, ',') !== false) {
+                       $begin = 1; $keyName = ',';
+                       while (strpos($keyName, ',') !== false) {
                                // Use last
                                // Use last
-                               $columnName = str_replace('`', '', $tableArray[count($tableArray) - $begin]);
-                               //* DEBUG: */ print(__LINE__.':'.$columnName."----------------".$begin."<br />");
+                               $keyName = str_replace('`', '', $tableArray[count($tableArray) - $begin]);
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $keyName . '----------------' . $begin);
 
                                // Remove brackes
 
                                // Remove brackes
-                               $columnName = str_replace('(', '', str_replace(')', '', $columnName));
-                               //* DEBUG: */ print(__LINE__.':'.$columnName."----------------".$begin."<br />");
+                               $keyName = str_replace('(', '', str_replace(')', '', $keyName));
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $keyName . '----------------' . $begin);
 
                                // Continue
                                $begin++;
 
                                // Continue
                                $begin++;
@@ -467,20 +444,33 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
                } // END - if
 
                // Show indexes
                } // END - if
 
                // Show indexes
-               $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`",
-                       array($tableName), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FILE__, __LINE__);
 
 
-               // Walk through all
+               // Non-skipping is default for ADD
                $skip = false;
                $skip = false;
+
+               // But should we DROP?
+               if ($tableArray[3] == 'DROP') {
+                       // Then skip if nothing found!
+                       $skip = true;
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Going to drop key ' . $keyName);
+               } // END - if
+
+               // Walk through all
                while ($content = SQL_FETCHARRAY($result)) {
                        // Is it found?
                while ($content = SQL_FETCHARRAY($result)) {
                        // Is it found?
-                       //* DEBUG: */ print("<pre>".print_r($content, true)."</pre>");
-                       if (($content['Column_name'] == $columnName) || ($content['Key_name'] == $columnName)) {
+                       //* DEBUG: */ print(__LINE__.':columnName='.$keyName.',content=<pre>' . print_r($content, true) . '</pre>');
+                       if (($content['Key_name'] == $keyName) && ($tableArray[3] == 'ADD')) {
                                // Skip this query!
                                // Skip this query!
-                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skiped: %s", $sql));
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ADD: Skiped: %s", $sql));
                                $skip = true;
                                break;
                                $skip = true;
                                break;
-                       } // END - if
+                       } elseif (($content['Key_name'] == $keyName) && ($tableArray[3] == 'DROP')) {
+                               // Don't skip this!
+                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("DROP: Not skiped: %s", $sql));
+                               $skip = false;
+                               break;
+                       }
                } // END - while
 
                // Free result
                } // END - while
 
                // Free result
@@ -489,12 +479,15 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
                // Shall we run it?
                if ($skip === false) {
                        // Send it to the SQL_QUERY() function
                // Shall we run it?
                if ($skip === false) {
                        // Send it to the SQL_QUERY() function
-                       //* DEBUG: */ print(__LINE__.':'.$sql."<br />");
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
                        $result = SQL_QUERY($sql, $F, $L, false);
                        $result = SQL_QUERY($sql, $F, $L, false);
-               } // END - if
+               } else {
+                       // Not executed
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not executed: ' . $sql);
+               }
        } else {
                // Other ALTER TABLE query
        } else {
                // Other ALTER TABLE query
-               //* DEBUG: */ print(__LINE__.':'.$sql."<br />");
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
                $result = SQL_QUERY($sql, $F, $L, false);
        }
 
                $result = SQL_QUERY($sql, $F, $L, false);
        }
 
index 710d154398739c4a7650de14256415e063ae11fd..4a21cc45aab05ce7c628814916e53d021cf6c0e6 100644 (file)
@@ -325,6 +325,9 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru
                                // Remove all SQL commands
                                unsetSqls();
 
                                // Remove all SQL commands
                                unsetSqls();
 
+                               // Mark it as installed
+                               $GLOBALS['ext_is_installed'][getCurrentExtensionName()] = true;
+
                                // In normal mode return a true on success
                                $ret = true;
                        } elseif (getExtensionDryRun() === true) {
                                // In normal mode return a true on success
                                $ret = true;
                        } elseif (getExtensionDryRun() === true) {
@@ -434,7 +437,10 @@ function isExtensionInstalled ($ext_name) {
        $isInstalled = false;
 
        // Check if there is a cache entry
        $isInstalled = false;
 
        // Check if there is a cache entry
-       if (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) {
+       if (isset($GLOBALS['ext_is_installed'][$ext_name])) {
+               // Use cache built from below queries
+               $isInstalled = $GLOBALS['ext_is_installed'][$ext_name];
+       } elseif (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) {
                // Found!
                $isInstalled = true;
 
                // Found!
                $isInstalled = true;
 
@@ -452,12 +458,15 @@ function isExtensionInstalled ($ext_name) {
 
                // Is it installed, then cache the entry
                if ($isInstalled === true) {
 
                // Is it installed, then cache the entry
                if ($isInstalled === true) {
-                       // Dummy call
+                       // Dummy call (get is okay here)
                        getExtensionId($ext_name, true);
                } // END - if
 
                // Free result
                SQL_FREERESULT($result);
                        getExtensionId($ext_name, true);
                } // END - if
 
                // Free result
                SQL_FREERESULT($result);
+
+               // Remember the status
+               $GLOBALS['ext_is_installed'][$ext_name] = $isInstalled;
        }
 
        // Return status
        }
 
        // Return status
@@ -779,13 +788,13 @@ function getExtensionId ($ext_name, $forceDb = false) {
                if (SQL_NUMROWS($result) == 1) {
                        // Get the extension's id from database
                        list($ret) = SQL_FETCHROW($result);
                if (SQL_NUMROWS($result) == 1) {
                        // Get the extension's id from database
                        list($ret) = SQL_FETCHROW($result);
-
-                       // Cache it
-                       $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $ret;
                } // END - if
 
                // Free result
                SQL_FREERESULT($result);
                } // END - if
 
                // Free result
                SQL_FREERESULT($result);
+
+               // Cache it
+               $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $ret;
        }
 
        if ($ret == 0) {
        }
 
        if ($ret == 0) {
index b8a65d727d06da1e33897b2637beb61ef4314da0..f82ba1ac467dbfce75e6066c8c62a85c6ab5bc5a 100644 (file)
@@ -62,7 +62,7 @@ switch (getExtensionMode()) {
 `network_data_seperator` CHAR(4) NOT NULL DEFAULT '|',
 `network_row_seperator` CHAR(4) NOT NULL DEFAULT '|',
 `network_request_type` ENUM('GET','POST') NOT NULL DEFAULT 'GET',
 `network_data_seperator` CHAR(4) NOT NULL DEFAULT '|',
 `network_row_seperator` CHAR(4) NOT NULL DEFAULT '|',
 `network_request_type` ENUM('GET','POST') NOT NULL DEFAULT 'GET',
-`network_charset` VARCHAR(20) NOT NULL DEFAULT 'ISO-8859-1',
+`network_charset` VARCHAR(20) NOT NULL DEFAULT 'UTF-8',
 UNIQUE (`network_short_name`),
 PRIMARY KEY (`network_id`)
 ) TYPE={?_TABLE_TYPE?} COMMENT='Network data'");
 UNIQUE (`network_short_name`),
 PRIMARY KEY (`network_id`)
 ) TYPE={?_TABLE_TYPE?} COMMENT='Network data'");
@@ -160,7 +160,7 @@ PRIMARY KEY (`network_id`)
 `max_reload_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `min_waiting_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `min_remain_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `max_reload_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `min_waiting_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `min_remain_clicks` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
-`min_payment` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`min_payment` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
 `allow_erotic` VARCHAR(10) NOT NULL DEFAULT '',
 UNIQUE `provider_type` (`network_id`,`network_type_id`),
 PRIMARY KEY (`network_data_id`)
 `allow_erotic` VARCHAR(10) NOT NULL DEFAULT '',
 UNIQUE `provider_type` (`network_id`,`network_type_id`),
 PRIMARY KEY (`network_data_id`)
@@ -187,7 +187,7 @@ PRIMARY KEY (`network_cache_id`)
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `network_reload_lock` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,
 `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `network_type_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `network_reload_lock` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0,
-`network_inserted` TIMESTAMP NOT NULL CURRENT_TIMESTAMP(),
+`network_inserted` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
 UNIQUE `provider_type` (`network_id`,`network_type_id`),
 PRIMARY KEY (`network_reload_id`)
 ) TYPE={?_TABLE_TYPE?} COMMENT='Reload locks'");
 UNIQUE `provider_type` (`network_id`,`network_type_id`),
 PRIMARY KEY (`network_reload_id`)
 ) TYPE={?_TABLE_TYPE?} COMMENT='Reload locks'");
index d1a66567e57ec8d67f81ed989bf92da20ec85b19..e79c47bb21fb7504ff8ef4dc48512707348fe9df 100644 (file)
@@ -258,11 +258,11 @@ function FILTER_RUN_SQLS ($data) {
                                        // Do we have an "ALTER TABLE" command?
                                        if (substr(strtolower($sql), 0, 11) == 'alter table') {
                                                // Analyse the alteration command
                                        // Do we have an "ALTER TABLE" command?
                                        if (substr(strtolower($sql), 0, 11) == 'alter table') {
                                                // Analyse the alteration command
-                                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Alterting table: {$sql}");
+                                               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Alterting table: {$sql}");
                                                SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__);
                                        } else {
                                                // Run regular SQL command
                                                SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__);
                                        } else {
                                                // Run regular SQL command
-                                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Running regular query: {$sql}");
+                                               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Running regular query: {$sql}");
                                                SQL_QUERY($sql, __FUNCTION__, __LINE__, false);
                                        }
                                } // END - if
                                                SQL_QUERY($sql, __FUNCTION__, __LINE__, false);
                                        }
                                } // END - if
index b50b07fe9dc3e800e3b6062c2f34e185c1e167a6..954524fae768575902d1aa7bc556e6e69915ec5a 100644 (file)
@@ -86,17 +86,19 @@ foreach (array('guest','member','admin') as $menu) {
        // Free result
        SQL_FREERESULT($result);
 
        // Free result
        SQL_FREERESULT($result);
 
+       // Init sqls
+       initSqls();
+
        // Now insert our unqiue key for action-what combination
        // Now insert our unqiue key for action-what combination
-       SQL_QUERY_ESC("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP KEY `action_what`",
-               array($menu), __FILE__, __LINE__);
-       SQL_QUERY_ESC("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE `action_what` (`action` , `what`)",
-               array($menu), __FILE__, __LINE__);
+       addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP KEY `action_what`", $menu));
+       addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE `action_what` (`action` , `what`)", $menu));
 
        // Now insert our unqiue key for what
 
        // Now insert our unqiue key for what
-       SQL_QUERY_ESC("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP KEY `what`",
-               array($menu), __FILE__, __LINE__);
-       SQL_QUERY_ESC("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE `what` (`what`)",
-               array($menu), __FILE__, __LINE__);
+       addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` DROP KEY `what`", $menu));
+       addSql(sprintf("ALTER TABLE `{?_MYSQL_PREFIX?}_%s_menu` ADD UNIQUE `what` (`what`)", $menu));
+
+       // And run all
+       runFilterChain('run_sqls');
 } // END - foreach
 
 // [EOF]
 } // END - foreach
 
 // [EOF]