]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions.php
Deprecated files removed
[mailer.git] / inc / extensions.php
index 68f89a1954b3e8689e59ace083a41de4d71f5117..2906fbf58aaee47e0e2cce0a31107e34a04d5c98 100644 (file)
@@ -43,11 +43,11 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "") {
 
        // 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);
@@ -256,13 +256,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) {
                                } // 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)) {
@@ -394,11 +388,8 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) {
 
        // 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();
@@ -581,17 +572,13 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) {
 
                        // 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;
@@ -600,14 +587,14 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) {
 }
 
 // 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>
@@ -661,7 +648,7 @@ function GET_EXT_NAME ($id) {
        } 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);
        }