// Load the extension and maybe found language and function files.
function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run = false, &$SQLs = array()) {
- global $EXT_LOADED, $_CONFIG, $EXT_VER_HISTORY;
+ global $_CONFIG, $EXT_VER_HISTORY;
global $INC_POOL, $EXT_UPDATE_DEPENDS, $EXT_DEPRECATED, $UPDATE_NOTES;
global $EXT_VERSION, $EXT_ALWAYS_ACTIVE;
// Is the extension already loaded?
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Loading extension {$ext_name}, mode={$EXT_LOAD_MODE}, ver={$EXT_VER}.");
- if ((isset($EXT_LOADED['ext'][$ext_name])) && (empty($EXT_LOAD_MODE))) {
+ if ((isset($GLOBALS['ext_loaded']['ext'][$ext_name])) && (empty($EXT_LOAD_MODE))) {
// Debug message
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name));
return false;
$langInclude = sprintf("inc/language/%s_%s.php", $ext_name, GET_LANGUAGE());
// Is this include there?
- if ((FILE_READABLE($langInclude)) && (!isset($EXT_LOADED['lang'][$ext_name]))) {
+ if ((FILE_READABLE($langInclude)) && (!isset($GLOBALS['ext_loaded']['lang'][$ext_name]))) {
// Then load it
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded.");
- $EXT_LOADED['lang'][$ext_name] = true;
+ $GLOBALS['ext_loaded']['lang'][$ext_name] = true;
LOAD_INC_ONCE($langInclude);
} // END - if
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
// Is this include there?
- if ((FILE_READABLE($funcsInclude)) && (!isset($EXT_LOADED['funcs'][$ext_name]))) {
+ if ((FILE_READABLE($funcsInclude)) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
// Then load it
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Functions loaded.");
- $EXT_LOADED['funcs'][$ext_name] = true;
+ $GLOBALS['ext_loaded']['funcs'][$ext_name] = true;
LOAD_INC_ONCE($funcsInclude);
} // END - if
// Mark it as loaded in normal mode
if (empty($EXT_LOAD_MODE)) {
// Mark it now...
- $EXT_LOADED['ext'][$ext_name] = true;
+ $GLOBALS['ext_loaded']['ext'][$ext_name] = true;
} // END - if
// All fine!
// Check if given extension is active
function EXT_IS_ACTIVE ($ext_name) {
// Extensions are all inactive during installation
- if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isInstalling()) || (empty($ext_name))) return false;
+ if ((!isInstalled()) || (isInstalling()) || (empty($ext_name))) return false;
// Not active is the default
$active = "N";
// Count cache hits
incrementConfigEntry('cache_hits');
+ } elseif (isset($GLOBALS['ext_loaded'][$ext_name])) {
+ // Extension is loaded!
+ die("LOADED:$ext_name");
} elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) {
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}");
// Load from database
$ext_ver = false;
// Extensions are all inactive during installation
- if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isInstalling())) return "";
+ if ((!isInstalled()) || (isInstalling())) return "";
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": ext_name={$ext_name}");
// Is the cache written?
// Free memory
SQL_FREERESULT($result);
} elseif (GET_EXT_VERSION("sql_patches") == "") {
- // No sql_patches installed, so maybe in admin area?
- $ret = ((IS_ADMIN()) && ($mod == "admin")); // Then there is a menu!
+ // No sql_patches installed, so maybe in admin area or no admin registered?
+ $ret = (((IS_ADMIN()) || (!isAdminRegistered())) && ($mod == "admin")); // Then there is a menu!
}
// Return status