From 5b498995f1792ba5972d782b63cd5cb044727c21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 19 Dec 2008 19:07:21 +0000 Subject: [PATCH] Fixes for running SQL queries --- inc/databases.php | 2 +- inc/extensions.php | 2 +- inc/filters.php | 15 +++++---------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index adaafd37fb..74f0cb3ba4 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -115,7 +115,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "677"); +define('CURR_SVN_REVISION', "678"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 1940526308..84c6d4be5d 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -492,7 +492,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { } // END - if // Run SQLs - RUN_FILTER('run_sqls', $dry_run); + RUN_FILTER('run_sqls', array('dry_run' => $dry_run, 'sqls' => $SQLs)); if (!$dry_run) { // Create task diff --git a/inc/filters.php b/inc/filters.php index 0fc19fa552..1355975dd7 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -319,7 +319,7 @@ function FILTER_FLUSH_FILTERS () { } // END - if // Run the run_sqls filter in non-dry mode - RUN_FILTER('run_sqls', false); + RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs)); } // Filter for calling the handler for login failtures @@ -419,13 +419,11 @@ function FILTER_LOAD_INCLUDES ($data) { } // Filter for running SQL commands -function FILTER_RUN_SQLS ($dry_run) { - global $SQLs; - +function FILTER_RUN_SQLS ($data) { // Is the array there? - if ((is_array($SQLs)) && (!$dry_run)) { + if ((isset($data['sqls'])) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) { // Run SQL commands - foreach ($SQLs as $sql) { + foreach ($data['sqls'] as $sql) { $sql = trim($sql); if (!empty($sql)) { // Do we have an "ALTER TABLE" command? @@ -438,10 +436,7 @@ function FILTER_RUN_SQLS ($dry_run) { } } // END - if } // END - foreach - } elseif (GET_EXT_VERSION("sql_patches") == "") { - // Remove SQLs if extension is not installed - $SQLs = array(); - } + } // END - if } // Filter for updating/validating login data -- 2.39.5