// Is the extension already loaded?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Loading extension ' . $ext_name . ', mode=' . getExtensionMode() . ', ver=' . getCurrentExtensionVersion());
- if ((isset($GLOBALS['ext_loaded']['ext'][$ext_name])) && (getExtensionMode() == 'init')) {
+ if ((isExtensionLoaded($ext_name)) && (getExtensionMode() == 'init')) {
// Debug message
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name));
// Do we have cache?
if (isExtensionFunctionFileReadable($ext_name)) {
// Not yet loaded?
- if ((($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y') || (!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name]))) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
+ if ((($GLOBALS['cache_array']['extension']['ext_func'][$ext_name] == 'Y') || (!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name]))) && (!isExtensionLibraryLoaded($ext_name))) {
// Construct IFN for functions file
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
// Mark it as loaded
- $GLOBALS['ext_loaded']['funcs'][$ext_name] = true;
+ markExtensionLibraryAsLoaded($ext_name);
// Download functions file
loadIncludeOnce($funcsInclude);
// Mark it as loaded in normal mode
if (getExtensionMode() == '') {
// Mark it now...
- $GLOBALS['ext_loaded']['ext'][$ext_name] = true;
+ markExtensionAsLoaded($ext_name);
} // END - if
// All fine!
// Count cache hits
incrementStatsEntry('cache_hits');
- } elseif (isset($GLOBALS['ext_loaded'][$ext_name])) {
+ } elseif (isExtensionLoaded($ext_name)) {
// @TODO Extension is loaded, what next?
debug_report_bug(__FUNCTION__, __LINE__, 'LOADED:' . $ext_name);
} elseif (($ext_name == 'cache') || (!isExtensionInstalled('cache'))) {
$funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
// Is this include there?
- if ((isFileReadable($funcsInclude)) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name])) && (getExtensionMode() == 'test')) {
+ if ((isFileReadable($funcsInclude)) && (!isExtensionLibraryLoaded($ext_name)) && (getExtensionMode() == 'test')) {
// Cache it!
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_func=Y - FOUND!');
$GLOBALS['cache_array']['extension']['ext_func'][$ext_name] = 'Y';
return $GLOBALS[__FUNCTION__][$ext_name];
}
+// Mark extension file as loaded
+function markExtensionAsLoaded ($ext_name) {
+ // Is it already loaded?
+ if (isExtensionLoaded($ext_name)) {
+ // Then abort here
+ debug_report_bug(__FUNCTION__, __LINE__, 'Extension ' . $ext_name . ' is already marked as loaded!');
+ } // END - if
+
+ // Mark it
+ $GLOBALS['ext_loaded']['ext_name'][$ext_name] = true;
+}
+
+// Determine wether the given extension is already loaded
+function isExtensionLoaded ($ext_name) {
+ // Is it there?
+ return ((isset($GLOBALS['ext_loaded']['ext_name'][$ext_name])) && ($GLOBALS['ext_loaded']['ext_name'][$ext_name] === true));
+}
+
+// Mark extension's library file as loaded
+function markExtensionLibraryAsLoaded ($ext_name) {
+ // Is it already loaded?
+ if (isExtensionLibraryLoaded($ext_name)) {
+ // Then abort here
+ debug_report_bug(__FUNCTION__, __LINE__, 'Extension library ' . $ext_name . ' is already marked as loaded!');
+ } // END - if
+
+ // Mark it
+ $GLOBALS['ext_loaded']['library'][$ext_name] = true;
+}
+
+// Determine wether the given extension's library is already loaded
+function isExtensionLibraryLoaded ($ext_name) {
+ // Is it there?
+ return ((isset($GLOBALS['ext_loaded']['library'][$ext_name])) && ($GLOBALS['ext_loaded']['library'][$ext_name] === true));
+}
// [EOF]
?>