X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions.php;h=ae8f15210e4af841e0453f55e1259f67ec995e0f;hb=9e1f6d2cff0bbef912d605d4ae1728f0382b83a4;hp=7d599905f74250189931dcae43dc5e56d90048e8;hpb=e72031bcfdcd8e91f62bec6cc88f36b7a11d9221;p=mailer.git diff --git a/inc/extensions.php b/inc/extensions.php index 7d599905f7..ae8f15210e 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -52,14 +52,12 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run return false; } // END - if - // Construct FQFN for extension file - $FQFN = sprintf("%sinc/extensions/ext-%s.php", - constant('PATH'), - $ext_name - ); + // Construct include filename and FQFN for extension file + $INC = sprintf("inc/extensions/ext-%s.php", $ext_name); + $FQFN = constant('PATH') . $INC; // Is the extension file NOT there? - if (!FILE_READABLE($FQFN)) { + if (!INCLUDE_READABLE($INC)) { // Debug message DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s not found.", $ext_name)); @@ -216,14 +214,14 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr // "Dry-run-mode" activated? if (!$dry_run) { // Run installation pre-installation filters - RUN_FILTER('pre_extension_installed', array('dry_run' => $dry_run)); + runFilterChain('pre_extension_installed', array('dry_run' => $dry_run)); // Register extension SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_extensions` (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')", array($ext_name, EXT_GET_ALWAYS_ACTIVE(), EXT_GET_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, 'inc_pool' => $INC_POOL)); + runFilterChain('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; @@ -254,7 +252,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":{$ext_name}/{$EXT_LOAD_MODE}"); if (($ext_name == "sql_patches") && (($EXT_LOAD_MODE == "register") || ($EXT_LOAD_MODE == "remove")) && (!$dry_run) && ($test)) { //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!"); - if ($logout) { + if ($logout === true) { // Then redirect to logout LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches"); } else { @@ -292,7 +290,7 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ":SQLs::count=".COUNT_SQLS().""); if ((IS_SQLS_VALID() && (COUNT_SQLS() > 0))) { // Run SQL commands... - RUN_FILTER('run_sqls', array('dry_run' => false)); + runFilterChain('run_sqls'); // Removal mode? if ($load_mode == "remove") { @@ -305,7 +303,7 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) { // Remove cache file(s) if extension is active if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($load_mode == "activate") || ($load_mode == "deactivate"))) { // Run filters - RUN_FILTER('post_extension_run_sql', $ext_name); + runFilterChain('post_extension_run_sql', $ext_name); } // END - if // Is this the sql_patches? @@ -383,10 +381,11 @@ function GET_EXT_VERSION ($ext_name) { // Count cache hits incrementConfigEntry('cache_hits'); - } elseif ((!isset($GLOBALS['cache_instance'])) || (!is_object($GLOBALS['cache_instance']))) { + } 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), __FILE__, __LINE__); + //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result).""); // Is the extension there? if (SQL_NUMROWS($result) == 1) { @@ -437,7 +436,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { $start = array_search($ext_ver, $history); // And load SQL queries in order of version history - for ($idx = ($start + 1); $idx < sizeof($history); $idx++) { + for ($idx = ($start + 1); $idx < count($history); $idx++) { // Set extension version $GLOBALS['cache_array']['update_ver'][$ext_name] = $history[$idx]; @@ -469,13 +468,13 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { // In real-mode execute any existing includes if (!$dry_run) { $GLOBALS['cache_array']['inc_pool'][$ext_name] = $INC_POOL; - RUN_FILTER('load_includes', $INC_POOL); + runFilterChain('load_includes', $INC_POOL); $INC_POOL = $GLOBALS['cache_array']['inc_pool'][$ext_name]; unset($GLOBALS['cache_array']['inc_pool'][$ext_name]); } // END - if // Run SQLs - RUN_FILTER('run_sqls', array('dry_run' => $dry_run)); + runFilterChain('run_sqls', array('dry_run' => $dry_run)); if (!$dry_run) { // Create task @@ -490,7 +489,7 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) { unset($GLOBALS['cache_array']['update_ver'][$ext_name]); // Run filters on success extension update - RUN_FILTER('extension_update', $ext_name); + runFilterChain('extension_update', $ext_name); } // END - if } // END - if }