* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
incrementExtensionUpdateIterator();
// Check for required file
- if (loadExtension($ext_update, 'register', '', getExtensionDryRun())) {
+ if ((!isExtensionInstalled($ext_update)) && (loadExtension($ext_update, 'register', '', getExtensionDryRun()))) {
// Set current extension name again
setCurrentExtensionName($ext_name);
} // END - if
} elseif ($ext_ver != getCurrentExtensionVersion()) {
// Ok, update this extension now
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().",ext_update=".$ext_update.",ext_ver=".$ext_ver."/".getCurrentExtensionVersion()."");
- $GLOBALS['ext_backup'][$ext_update][$ext_ver] = getCurrentExtensionName();
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName='.getCurrentExtensionName().',currVer='.getCurrentExtensionVersion().'');
+ $GLOBALS['ext_backup_name'][$ext_update][$ext_ver] = getCurrentExtensionName();
+ $GLOBALS['ext_backup_ver'][$ext_update][$ext_ver] = getCurrentExtensionVersion();
updateExtension($ext_update, $ext_ver, getExtensionDryRun());
- setCurrentExtensionName($GLOBALS['ext_backup'][$ext_update][$ext_ver]);
- unset($GLOBALS['ext_backup'][$ext_update][$ext_ver]);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()."");
+ setCurrentExtensionName($GLOBALS['ext_backup_name'][$ext_update][$ext_ver]);
+ setCurrentExtensionVersion($GLOBALS['ext_backup_ver'][$ext_update][$ext_ver]);
+ unset($GLOBALS['ext_backup_name'][$ext_update][$ext_ver]);
+ unset($GLOBALS['ext_backup_ver'][$ext_update][$ext_ver]);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName='.getCurrentExtensionName().',currVer='.getCurrentExtensionVersion().'');
// All okay!
$test = true;
// Is the cache written?
if (isset($GLOBALS['cache_array']['extension']['ext_version'][$ext_name])) {
// Load data from cache
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": CACHE!");
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $ext_name . ': CACHE!');
$data['ext_version'] = $GLOBALS['cache_array']['extension']['ext_version'][$ext_name];
// Count cache hits
// Load from database
$result = SQL_QUERY_ESC("SELECT `ext_version` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $ext_name . ': DB - '.SQL_NUMROWS($result).'');
// Is the extension there?
if (SQL_NUMROWS($result) == 1) {
// Load entry
$data = SQL_FETCHARRAY($result);
} elseif (isDebugModeEnabled()) {
- // Not found!
- logDebugMessage(__FUNCTION__, __LINE__, sprintf(": Cannot find extension %s in database!", $ext_name));
+ // Not found, please report all
+ debug_report_bug(sprintf(": Cannot find extension %s in database!", $ext_name));
}
// Free result
$OUT = '';
// Do we have queries?
- if ((getExtensionVersion('sql_patches') >= '0.0.7') && (getConfig('verbose_sql') == 'Y')) {
+ if ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y')) {
// Init switch color
$SW = 2;
// Load main template
$OUT = loadTemplate('admin_ext_sql_table', true, $content);
- } elseif ((getExtensionVersion('sql_patches') >= '0.0.7') && (getConfig('verbose_sql') == 'Y')) {
+ } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y')) {
// No addional SQL commands to run
$OUT = loadTemplate('admin_settings_saved', true, getMessage('ADMIN_NO_ADDITIONAL_SQLS'));
} // END - if
// Notify the admin
sendAdminNotification(
- getMessage('ADMIN_SUBJECT_EXTENSION_DEACTIVATED'),
+ getMessage('ADMIN_SUBJECT_EXTENSION_DEACTIVATED'),
'admin_ext_deactivated',
array('ext_name' => $ext_name)
);
// All is false by default
$ret = false;
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "mod={$mod},cache=".getExtensionVersion('cache'));
+ // Extension installed and newer than or has version 0.1.2?
if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
// Cache version is okay, so let's check the cache!
if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) {
// Check cache and count hit
$ret = ($GLOBALS['cache_array']['extension']['ext_menu'][$mod] == 'Y');
incrementStatsEntry('cache_hits');
- } elseif ($mod == 'admin') {
- // Admin module has always a menu!
- $ret = true;
+ } else {
+ // Admin/guest/member/sponsor modules have always a menu!
+ $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor'));
}
} elseif ((isExtensionInstalled('sql_patches')) && (getExtensionVersion('sql_patches') >= '0.3.6') && ((!isExtensionActive('cache')) || ($forceDb === true))) {
// Check database for entry
// Free memory
SQL_FREERESULT($result);
} elseif (!isExtensionInstalled('sql_patches')) {
- // No sql_patches installed, so maybe in admin area or no admin registered?
- $ret = (((isAdmin()) || (!isAdminRegistered())) && ($mod == 'admin')); // Then there is a menu!
+ // No sql_patches installed, so maybe in admin/guest/member/sponsor area or no admin registered?
+ $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor')); // Then there is a menu!
+ } else {
+ // Unsupported state!
+ logDebugMessage(__FUNCTION__, __LINE__, 'This should never be reached.');
}
// Return status
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().intval($ret));
return $ret;
}
return $GLOBALS['ext_current_version'];
}
-// Remove the extension from global cache array
+// Remove the extension from cache array
function removeExtensionFromArray () {
// "Cache" this name
$ext_name = getCurrentExtensionName();
} // END - if
// Return result
- //* DEBUG: */ print __FUNCTION__.': '.$ext_name.'='.intval($GLOBALS['ext_inc_readable'][$ext_name]).'<br />';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',realable='.intval($GLOBALS['ext_inc_readable'][$ext_name]));
return $GLOBALS['ext_inc_readable'][$ext_name];
}