]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions-functions.php
Fixes for #226, renamed function:
[mailer.git] / inc / extensions-functions.php
index 3ac6e884603d8550f7edb6564cd55d3ca58f8d49..714483dac359db6fb19c53ca17a067dd807d5c48 100644 (file)
@@ -961,7 +961,7 @@ function doActivateExtension ($ext_name) {
 }
 
 // Deactivate given extension
-function doDeactivateExtension ($ext_name) {
+function doDeactivateExtension ($ext_name, $inRebuild = false) {
        // Is the extension installed?
        if (!isExtensionInstalled($ext_name)) {
                // Non-installed extensions cannot be activated
@@ -978,8 +978,11 @@ function doDeactivateExtension ($ext_name) {
        // Create new task (we ignore the task id here)
        createExtensionDeactivationTask($ext_name);
 
-       // Rebuild cache
-       rebuildCache('extension', 'extension');
+       // Do not rebuild cache if it is already been rebuild
+       if ($inRebuild === false) {
+               // Rebuild cache
+               rebuildCache('extension', 'extension');
+       } // END - if
 
        // Notify the admin
        sendAdminNotification(
@@ -1274,6 +1277,11 @@ function addExtensionDependency ($updateDepends) {
        // Add it to the list of extension update depencies map
        array_push($GLOBALS['ext_update_depends'][getCurrentExtensionName()], $updateDepends);
 
+       // Init array
+       if ((!isset($GLOBALS['ext_running_updates'][getCurrentExtensionName()])) || (!is_array($GLOBALS['ext_running_updates'][getCurrentExtensionName()]))) {
+               $GLOBALS['ext_running_updates'][getCurrentExtensionName()] = array();
+       } // END - if
+
        // Remember it in the list of running updates
        array_push($GLOBALS['ext_running_updates'][getCurrentExtensionName()], $updateDepends);
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . '/' . $updateDepends . ',extensionMode=' . getExtensionMode() . ' - EXIT!');
@@ -1536,6 +1544,12 @@ function initExtensionSqls ($force = false) {
 
 // Adds SQLs to the SQLs array but "assigns" it with current extension name
 function addExtensionSql ($sql) {
+       // Is is the array there?
+       if ((!isset($GLOBALS['ext_sqls'][getCurrentExtensionName()][getCurrentExtensionVersion()])) || (!is_array($GLOBALS['ext_sqls'][getCurrentExtensionName()][getCurrentExtensionVersion()]))) {
+               // Init array
+               $GLOBALS['ext_sqls'][getCurrentExtensionName()][getCurrentExtensionVersion()] = array();
+       } // END - if
+
        // Add it
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . getCurrentExtensionName() . ',ext_version=' . getCurrentExtensionVersion() . ',sql=' . $sql);
        array_push($GLOBALS['ext_sqls'][getCurrentExtensionName()][getCurrentExtensionVersion()], $sql);
@@ -1805,7 +1819,7 @@ function isExtensionFunctionFileReadable ($ext_name) {
 // Adds a CREATE TABLE statement if the requested table is not there
 function addCreateTableSql ($tableName, $sql, $comment) {
        // Is the table not there?
-       if (!isSqlTableCreated($tableName)) {
+       if (!ifSqlTableExists($tableName)) {
                // Is not found, so add it
                addExtensionSql('CREATE TABLE
        `{?_MYSQL_PREFIX?}_' . $tableName . '` (' . $sql . ')
@@ -1822,13 +1836,13 @@ COMMENT ' . chr(39) . $comment . chr(39));
 // Adds a DROP TABLE statement if the requested tabled is there
 function addDropTableSql ($tableName) {
        // Is the table there?
-       if (isSqlTableCreated($tableName)) {
+       if (ifSqlTableExists($tableName)) {
                // Then add it, non-existing tables can be ignored because it will
                // happen with every newly installed extension.
                addExtensionSql('DROP TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '`');
 
                // Mark it as gone
-               $GLOBALS['isSqlTableCreated'][$tableName] = false;
+               $GLOBALS['ifSqlTableExists'][$tableName] = false;
        } // END - if
 }