}
// 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
// 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(
// 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!');
// 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);
// 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 . ')
// 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
}