]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions-functions.php
Fixes for fix_menu.php and SQL_ALTER_TABLE()
[mailer.git] / inc / extensions-functions.php
index 710d154398739c4a7650de14256415e063ae11fd..4a21cc45aab05ce7c628814916e53d021cf6c0e6 100644 (file)
@@ -325,6 +325,9 @@ function registerExtension ($ext_name, $task_id, $dry_run = false, $logout = tru
                                // Remove all SQL commands
                                unsetSqls();
 
+                               // Mark it as installed
+                               $GLOBALS['ext_is_installed'][getCurrentExtensionName()] = true;
+
                                // In normal mode return a true on success
                                $ret = true;
                        } elseif (getExtensionDryRun() === true) {
@@ -434,7 +437,10 @@ function isExtensionInstalled ($ext_name) {
        $isInstalled = false;
 
        // Check if there is a cache entry
-       if (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) {
+       if (isset($GLOBALS['ext_is_installed'][$ext_name])) {
+               // Use cache built from below queries
+               $isInstalled = $GLOBALS['ext_is_installed'][$ext_name];
+       } elseif (isset($GLOBALS['cache_array']['extension']['ext_id'][$ext_name])) {
                // Found!
                $isInstalled = true;
 
@@ -452,12 +458,15 @@ function isExtensionInstalled ($ext_name) {
 
                // Is it installed, then cache the entry
                if ($isInstalled === true) {
-                       // Dummy call
+                       // Dummy call (get is okay here)
                        getExtensionId($ext_name, true);
                } // END - if
 
                // Free result
                SQL_FREERESULT($result);
+
+               // Remember the status
+               $GLOBALS['ext_is_installed'][$ext_name] = $isInstalled;
        }
 
        // Return status
@@ -779,13 +788,13 @@ function getExtensionId ($ext_name, $forceDb = false) {
                if (SQL_NUMROWS($result) == 1) {
                        // Get the extension's id from database
                        list($ret) = SQL_FETCHROW($result);
-
-                       // Cache it
-                       $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $ret;
                } // END - if
 
                // Free result
                SQL_FREERESULT($result);
+
+               // Cache it
+               $GLOBALS['cache_array']['extension']['ext_id'][$ext_name] = $ret;
        }
 
        if ($ret == 0) {