// Is the extension already loaded?
//* DEBUG: */ echo "Loading extension {$ext_name}.<br />\n";
- if (isset($EXT_LOADED[$ext_name])) {
+ if ((isset($EXT_LOADED[$ext_name])) && (empty($EXT_LOAD_MODE))) {
// Debug message
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name));
return false;
- }
+ } // END - if
// Construct FQFN for extension file
$extInclude = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
} // END - foreach
// Remove cache file(s) if extension is active
- if ((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) {
- //* DEBUG: */ echo __LINE__.": DESTROY!<br />\n";
- // Remove cache files
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- } // END - if
+ RUN_FILTER('post_extension_installed', $ext_name);
// Check for added include files
if (count($INC_POOL > 0)) {
// 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->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+ // Run filters
+ RUN_FILTER('post_extension_run_sql', $ext_name);
// @TODO This causes the whole (!) menu cache being purged
CACHE_PURGE_ADMIN_MENU();
// Update extension's version
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
- array($EXT_VERSION, $ext), __FILE__, __LINE__);
-
- // Update cache
- if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- } // END - if
+ array($EXT_VERSION, $ext), __FILE__, __LINE__);
// Remove array
unset($SQLs);
+
+ // Run filters on success extension update
+ RUN_FILTER('extension_update', $ext);
} else {
// In "dry-run" mode return array with SQL commands
return $SQLs;
}
// Output verbose SQL table for extension
-function EXTENSION_VERBOSE_TABLE($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $WIDTH = "480") {
+function EXTENSION_VERBOSE_TABLE ($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "480") {
global $_CONFIG;
$S = false; $SW = 2; $i = 1;
$OUT = "";
if ((is_array($SQLs)) && (GET_EXT_VERSION("sql_patches") >= "0.0.7") && ($_CONFIG['verbose_sql'] == "Y")) {
$OUT = "<DIV align=\"center\">
-<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$WIDTH."\" align=\"center\"".$dashed.">
+<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$width."\" align=\"center\"".$dashed.">
<TR>
<TD colspan=\"2\" align=\"center\" class=\"admin_title bottom2\" height=\"24\">
<STRONG>".$title.":</STRONG>
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ array(bigintval($id)), __FILE__, __LINE__);
list($ret) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}