X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions.php;h=8be7feba1048bd7e43f14930d50f0c56961e8636;hb=0f700bd2b9e033aad0990f42739cd75d41e372ff;hp=64e4c486993fe001850a65d2f25707c8557f0437;hpb=dfaa8c1675da4071ea451406a6f6fedd4c568416;p=mailer.git diff --git a/inc/extensions.php b/inc/extensions.php index 64e4c48699..8be7feba10 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -301,18 +301,6 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) { //* DEBUG: */ print __FUNCTION__."(".__LINE__."):mode={$EXT_LOAD_MODE}
\n"; - // Remove cache file(s) if extension is active - if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1) && ($EXT_LOAD_MODE == "remove")) || ($sqlRan === true))) { - //* DEBUG: */ echo __LINE__.": DESTROY!
\n"; - // Remove cache files - if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); - - // @TODO This causes the whole (!) menu cache being purged - CACHE_PURGE_ADMIN_MENU(); - } // END - if - // Is this the sql_patches? //* DEBUG: */ echo __LINE__.": {$id}/{$ext_name}/{$EXT_LOAD_MODE}
\n"; if (($ext_name == "sql_patches") && (($EXT_LOAD_MODE == "register") || ($EXT_LOAD_MODE == "remove"))) { @@ -321,6 +309,18 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) { LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches"); } // END - if } // END - if + + // Remove cache file(s) if extension is active + if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($EXT_LOAD_MODE == "activate") || ($EXT_LOAD_MODE == "deactivate"))) { + //* DEBUG: */ echo __LINE__.": DESTROY!
\n"; + // Remove cache files + if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); + + // @TODO This causes the whole (!) menu cache being purged + CACHE_PURGE_ADMIN_MENU(); + } // END - if } // Check if given extension is active function EXT_IS_ACTIVE ($ext_name) { @@ -349,11 +349,16 @@ function EXT_IS_ACTIVE ($ext_name) { // Extension was not found! return false; } + + // Load entry list($active) = SQL_FETCHROW($result); - //* DEBUG: */ echo $ext_name."[DB]: {$active}
\n"; + + // Free result SQL_FREERESULT($result); + // Write cache array + //* DEBUG: */ echo $ext_name."[DB]: {$active}
\n"; $cacheArray['extensions']['ext_active'][$ext_name] = $active; } else { // Extension not active! @@ -578,7 +583,7 @@ function GET_EXT_NAME ($id) { $ret = $cacheArray['extensions']['ext_name'][$id]; // Count cache hits - $_CONFIG['cache_hits']++; + if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1", @@ -597,7 +602,7 @@ function GET_EXT_ID($name) { $ret = $cacheArray['extensions']['ext_id'][$name]; // Count cache hits - $_CONFIG['cache_hits']++; + if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",