- // Remove cache file(s) if extension is active
- if (EXT_IS_ACTIVE("cache")) {
- // Remove cache filer
- if ($CACHE->cache_file("extensions", true)) $CACHE->cache_destroy();
- if ($CACHE->cache_file("mod_reg", true)) $CACHE->cache_destroy();
- if ($CACHE->cache_file("config", true)) $CACHE->cache_destroy();
- }
- }
+ // An SQL has been executed
+ $sqlRan = true;
+ } // END - if
+ } // END - foreach
+
+ // Removal mode?
+ if ($EXT_LOAD_MODE == "remove") {
+ // Delete this extension (remember to remove it from your server *before* you click on welcome!
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1",
+ array($id), __FILE__, __LINE__);
+ } // END - if
+
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mode={$EXT_LOAD_MODE}<br />\n";
+
+ // Is this the sql_patches?
+ //* DEBUG: */ echo __LINE__.": {$id}/{$ext_name}/{$EXT_LOAD_MODE}<br />\n";
+ if (($ext_name == "sql_patches") && (($EXT_LOAD_MODE == "register") || ($EXT_LOAD_MODE == "remove"))) {
+ // Then redirect to logout
+ //* DEBUG: */ echo __LINE__.": LOAD!<br />\n";
+ 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!<br />\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