// Load the extension and maybe found language and function files.
function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $dry_run = false) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_mode=' . $ext_mode . ',ext_ver=' . $ext_ver . ',dry_run=' . intval($dry_run));
// Loading an extension in same mode, but not test/update, twice is not
// good, so is the extension $ext_name already loaded in mode $ext_mode?
if ((isset($GLOBALS['loaded_extension'][$ext_name][$ext_mode])) && (!in_array($ext_mode, array('update', 'test')))) {
// If this happens twice, we need the bug report from you, except for updates/tests
- debug_report_bug(__FUNCTION__, __LINE__, '() is called twice: ext_name=' . $ext_name . ', ext_mode='. $ext_mode . ',ext_sqls=' . print_r(getExtensionSqls(), true) . ', ext_register_running=' . print_r($GLOBALS['ext_register_running'], true) . ', ext_running_updates=' . print_r($GLOBALS['ext_running_updates'], true));
+ debug_report_bug(__FUNCTION__, __LINE__, __FUNCTION__ . '() is called twice: ext_name=' . $ext_name . ', ext_mode='. $ext_mode . ',ext_sqls=' . print_r(getExtensionSqls(), true) . ', ext_register_running=' . print_r($GLOBALS['ext_register_running'], true) . ', ext_running_updates=' . print_r($GLOBALS['ext_running_updates'], true));
} // END - if
// Make sure this situation can only happen once
// Extensions are not always active by default
setExtensionAlwaysActive('N');
- // Extension update notes
- // @TODO Do we still need this? setExtensionUpdateNotes('');
-
// Include the extension file
loadCurrentExtensionInclude();
// Is this extension deprecated?
- if (isExtensionDeprecated()) {
+ if ((isExtensionDeprecated()) && (!in_array(getExtensionMode(), array('test', 'update', 'deactivate'))) && (isExtensionActive($ext_name))) {
// Deactivate the extension
doDeactivateExtension($ext_name);
// Abort here
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Extension load aborted, ext_name=' . $ext_name);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Extension load aborted, ext_name=' . $ext_name . ' - Extension is deprecated.');
return false;
} // END - if
// Registers an extension and possible update dependencies
function registerExtension ($ext_name, $taskId, $dry_run = false, $ignoreUpdates = false) {
// Set current extension name
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',task_id=' . $taskId . ',dry_run=' . intval($dry_run) . ' - ENTERED!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',task_id=' . $taskId . ',dry_run=' . intval($dry_run) . ',ignoreUpdates=' . intval($ignoreUpdates) . ' - ENTERED!');
setCurrentExtensionName($ext_name);
// Enable dry-run
// Is the extension installed?
if (!isExtensionInstalled($ext_name)) {
// Non-installed extensions cannot be activated
- debug_report_bug(__FUNCTION__, __LINE__, 'Tried to deactivate non-installed extension ' . $ext_name);
+ debug_report_bug(__FUNCTION__, __LINE__, 'Tried to deactivate non-installed extension ' . $ext_name . ',getExtensionMode()=' . getExtensionMode());
} // END - if
// Activate the extension
// Create new task (we ignore the task id here)
createExtensionDeactivationTask($ext_name);
+ // Rebuild cache
+ rebuildCache('extension', 'extension');
+
// Notify the admin
sendAdminNotification(
'{--ADMIN_EXTENSION_DEACTIVATED_SUBJECT--}',
$isRunning = false;
// Walk through whole array
- foreach ($GLOBALS['ext_running_updates'] as $ext1=>$depends) {
+ foreach ($GLOBALS['ext_running_updates'] as $ext1 => $depends) {
// Is it found?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext1=' . $ext1 . ',ext_name=' . $ext_name . ',depends=' . print_r($depends, true));
if (($ext1 == $ext_name) || ((in_array($ext_name, $depends)) && ($ignoreDependencies === false))) {