X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions-functions.php;h=4dec81d05fcdf2edb805f58df47f5254fa8c7807;hb=93ccd79d1a3fcb1ee5a101cb6bb670901f154555;hp=7f99674ee652d291cfa7f029633168a8992ee43d;hpb=20741b93fd58620af677a7f1039ffd16ea6ec689;p=mailer.git diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index 7f99674ee6..4dec81d05f 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -42,11 +42,12 @@ if (!defined('__SECURITY')) { // 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 @@ -151,19 +152,16 @@ function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $dry_run = fal // 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 @@ -181,7 +179,7 @@ function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $dry_run = fal // 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 @@ -764,7 +762,7 @@ function updateExtension ($ext_name, $ext_ver, $dry_run = false, $ignoreDependen } // Output verbose SQL table for extension -function addExtensionVerboseSqlTable ($title = '{--ADMIN_SQLS_EXECUTED_ON_REMOVAL--}', $dashed = '', $switch = false, $width = '100%') { +function addExtensionVerboseSqlTable ($title = '{--ADMIN_SQLS_EXECUTED_ON_REMOVAL--}') { // Empty title? if (empty($title)) { // Then abort here @@ -806,8 +804,6 @@ function addExtensionVerboseSqlTable ($title = '{--ADMIN_SQLS_EXECUTED_ON_REMOVA // Prepare content for template $content = array( - 'width' => $width, - 'dashed' => $dashed, 'title' => $title, 'rows' => $OUT ); @@ -952,7 +948,7 @@ function doDeactivateExtension ($ext_name) { // 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 @@ -965,6 +961,9 @@ function doDeactivateExtension ($ext_name) { // 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--}', @@ -1315,7 +1314,7 @@ function isExtensionUpdateRunning ($ext_name, $ignoreDependencies = false) { $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))) {