X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions.php;h=84c6d4be5d9e66079c0c177b8f8a63070d72a781;hp=df5e51e9e67c0fbb6985b3e3ae59f0f86ebd32bc;hb=5b498995f1792ba5972d782b63cd5cb044727c21;hpb=39172de4ecec2f6ddc597a5ae439e7aef79c75ed diff --git a/inc/extensions.php b/inc/extensions.php index df5e51e9e6..84c6d4be5d 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -125,9 +125,9 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run // Registeres an extension and possible update depencies function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) { - global $UPDATE_NOTES, $_CONFIG, $INC_POOL, $cacheInstance; - global $EXT_VER_HISTORY, $SQLs, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION; - global $EXT_UPDATE_DEPENDS; + global $UPDATE_NOTES, $INC_POOL, $cacheInstance; + global $EXT_VER_HISTORY, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION; + global $EXT_UPDATE_DEPENDS, $SQLs; // This shall never do a non-admin user! if (!IS_ADMIN()) return false; @@ -140,8 +140,6 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr $NOTES = ""; $INC_POOL = array(); - // By default the language prefix is the extension's name - // @TODO: Do we really need this one anymore? Can't we just take $ext_name and done? // By default we have no failtures $EXT_REPORTS_FAILURE = false; @@ -234,7 +232,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr array($ext_name, $EXT_ALWAYS_ACTIVE, $EXT_VERSION), __FILE__, __LINE__); // Remove cache file(s) if extension is active - RUN_FILTER('post_extension_installed', array('ext_name' => $ext_name, 'task_id' => $task_id)); + RUN_FILTER('post_extension_installed', array('ext_name' => $ext_name, 'task_id' => $task_id, 'inc_pool' => $INC_POOL)); // In normal mode return a true on success $ret = true; @@ -282,7 +280,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr // Run SQL queries for given extension id // @TODO Change from ext_id to ext_name (not just even the variable! ;-) ) function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { - global $cacheInstance, $_CONFIG; + global $cacheInstance, $SQLs; // This shall never do a non-admin user! if (!IS_ADMIN()) return false; @@ -299,31 +297,12 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { // Load extension in detected mode //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":ext_name[{$ext_id}]={$ext_name}"); - LOAD_EXTENSION($ext_name, $load_mode, false, $SQLs); + LOAD_EXTENSION($ext_name, $load_mode, "", false, $SQLs); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQLs::count=".count($SQLs).""); if ((is_array($SQLs) && (sizeof($SQLs) > 0))) { // Run SQL commands... - foreach ($SQLs as $sql) { - // Trim spaces away which we don't need - $sql = trim($sql); - - // Is there still an SQL query? - if (!empty($sql)) { - // Do we have an "ALTER TABLE" command? - //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQL={$SQL}"); - if (substr(strtolower($sql), 0, 11) == "alter table") { - // Analyse the alteration command - SQL_ALTER_TABLE($sql, __FILE__, __LINE__); - } else { - // Run regular SQL command - $result = SQL_QUERY($sql, __FILE__, __LINE__, false); - } - - // An SQL has been executed - $sqlRan = true; - } // END - if - } // END - foreach + RUN_FILTER('run_sqls'); // Removal mode? if ($load_mode == "remove") { @@ -439,8 +418,8 @@ function GET_EXT_VERSION ($ext_name) { // Updates a given extension with current extension version to latest version function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { // This shall never do a non-admin user! - global $cacheInstance, $_CONFIG, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY; - global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $SQLs, $cacheArray; + global $cacheInstance, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY; + global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $cacheArray; // Init arrays $SQLs = array(); $INC_POOL = array(); @@ -507,13 +486,13 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { // In real-mode execute any existing includes if (!$dry_run) { $cacheArray['inc_pool'][$ext_name] = $INC_POOL; - RUN_FILTER('load_includes'); + RUN_FILTER('load_includes', $INC_POOL); $INC_POOL = $cacheArray['inc_pool'][$ext_name]; unset($cacheArray['inc_pool'][$ext_name]); } // 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 @@ -538,7 +517,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { // Output verbose SQL table for extension function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "100%") { - global $_CONFIG, $SQLs; + global $SQLs; // Are there some queries in $queries? if (count($queries) > 0) {