From fb5d424133a4d4b8cfc1edc461be5bd5b5006ea4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 6 Jan 2011 05:51:15 +0000 Subject: [PATCH] Renaming error --- .gitattributes | 1 + inc/loader/load-extension.php | 187 +++++++++++++++++++++++++++++++++ inc/loader/load-extensions.php | 186 +------------------------------- 3 files changed, 189 insertions(+), 185 deletions(-) create mode 100644 inc/loader/load-extension.php diff --git a/.gitattributes b/.gitattributes index c55771879b..d8bed52f4c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -347,6 +347,7 @@ inc/loader/.htaccess -text svneol=unset#text/plain inc/loader/load- -text svneol=unset#text/plain inc/loader/load-admins.php -text svneol=unset#text/plain inc/loader/load-config.php -text svneol=unset#text/plain +inc/loader/load-extension.php -text svneol=unset#text/plain inc/loader/load-extensions.php -text svneol=unset#text/plain inc/loader/load-filter.php -text svneol=unset#text/plain inc/loader/load-imprint.php -text svneol=unset#text/plain diff --git a/inc/loader/load-extension.php b/inc/loader/load-extension.php new file mode 100644 index 0000000000..247391b150 --- /dev/null +++ b/inc/loader/load-extension.php @@ -0,0 +1,187 @@ +loadCacheFile('extension')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { + // Load extension from cache + $EXT_DUMMY = $GLOBALS['cache_instance']->getArrayFromCache(); + + // Init extension inc-pool + $EXT_POOL = array(); + + // Do we have entries? + if (count($EXT_DUMMY) > 0) { + // Init arrays + $EXT_NAMES = array(); + + // Loop through all + foreach ($EXT_DUMMY['ext_name'] as $k => $name) { + // Load CSS file + if ($EXT_DUMMY['ext_css'][$k] == 'Y') addExtensionCssFile($name . '.css'); + + // Load extension file itself + if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y')) { + $EXT_POOL[] = $name; + } // END - if + + // Version number + $EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k]; + unset($EXT_DUMMY['ext_version'][$k]); + + // Extension is active + $EXT_DUMMY['ext_active'][$name] = $EXT_DUMMY['ext_active'][$k]; + unset($EXT_DUMMY['ext_active'][$k]); + + // Ext menu + $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k]; + unset($EXT_DUMMY['ext_menu'][$k]); + + // Language file + $EXT_DUMMY['ext_lang'][$name] = $EXT_DUMMY['ext_lang'][$k]; + unset($EXT_DUMMY['ext_lang'][$k]); + + // Functions file + $EXT_DUMMY['ext_func'][$name] = $EXT_DUMMY['ext_func'][$k]; + unset($EXT_DUMMY['ext_func'][$k]); + + // Extension id + $EXT_DUMMY['ext_id'][$name] = $EXT_DUMMY['ext_id'][$k]; + $id = $EXT_DUMMY['ext_id'][$name]; + unset($EXT_DUMMY['ext_id'][$k]); + + // Add ext name + $EXT_NAMES[$id] = $name; + + // Add deprecated flag (defaults to 'not deprecated') + $EXT_DUMMY['ext_deprecated'][$name] = 'N'; + + // Mark it as active extension + $GLOBALS['cache_array']['always_active'][$name] = $EXT_DUMMY['ext_keep'][$k]; + unset($EXT_DUMMY['ext_keep'][$k]); + + // Remove unneccessary data from memory + unset($EXT_DUMMY['ext_css'][$k]); + } // END - foreach + + // Write dummy array back + $EXT_DUMMY['ext_name'] = $EXT_NAMES; + unset($EXT_NAMES); + + // Loading cache is done so let's free some memory! + unset($EXT_DUMMY['ext_keep']); + unset($EXT_DUMMY['ext_css']); + } // END - if + + // Transfer dummy array + $GLOBALS['cache_array']['extension'] = $EXT_DUMMY; + unset($EXT_DUMMY); + + // No database load needed + $res_ext_crt = false; + + // Load all extension files in test-mode (we initialize them later) + foreach ($EXT_POOL as $ext) { + loadExtension($ext, 'test'); + } // END - foreach + + // Remove array and mark cache as loaded + unset($EXT_POOL); +} elseif (isHtmlOutputMode()) { + // Create cache file here + $GLOBALS['cache_instance']->init(); + + // Add more if sql_patches is recent enougth + $add = ''; + if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) $add = ", `ext_has_css` AS ext_css"; + + // Load all modules and their data + $result = SQL_QUERY('SELECT `id` AS ext_id, `ext_name`, `ext_active`, `ext_version`'.$add.' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__); + while ($content = SQL_FETCHARRAY($result)) { + // Load extension + loadExtension($content['ext_name'], 'test'); + + // Get menu entry + $content['ext_menu'] = 'N'; + if (ifModuleHasMenu($content['ext_name'], true)) { + // Extension is a module and has menu... pew! + $content['ext_menu'] = 'Y'; + } // END - if + + // Get language entry + $content['ext_lang'] = 'N'; + if (isLanguageIncludeReadable($content['ext_name'])) { + // Readable + $content['ext_lang'] = 'Y'; + } // END - if + + // Get function entry + $content['ext_func'] = 'N'; + if (isExtensionFunctionFileReadable($content['ext_name'])) { + // Readable + $content['ext_func'] = 'Y'; + } // END - if + + // Transfer EXT_ALWAYS_ACTIVE flag + $content['ext_keep'] = getExtensionAlwaysActive(); + + // Fix missing ext_css + if (!isset($content['ext_css'])) $content['ext_css'] = 'N'; + + // Add row to cache file + $GLOBALS['cache_instance']->addRow($content); + } // END - while + + // Free memory + SQL_FREERESULT($result); + + // Close the cache + $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); + $GLOBALS['cache_instance']->finalize(); +} + +// [EOF] +?> diff --git a/inc/loader/load-extensions.php b/inc/loader/load-extensions.php index ed6443dc51..f551ef47b7 100644 --- a/inc/loader/load-extensions.php +++ b/inc/loader/load-extensions.php @@ -1,187 +1,3 @@ loadCacheFile('extension')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { - // Load extension from cache - $EXT_DUMMY = $GLOBALS['cache_instance']->getArrayFromCache(); - - // Init extension inc-pool - $EXT_POOL = array(); - - // Do we have entries? - if (count($EXT_DUMMY) > 0) { - // Init arrays - $EXT_NAMES = array(); - - // Loop through all - foreach ($EXT_DUMMY['ext_name'] as $k => $name) { - // Load CSS file - if ($EXT_DUMMY['ext_css'][$k] == 'Y') addExtensionCssFile($name . '.css'); - - // Load extension file itself - if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y')) { - $EXT_POOL[] = $name; - } // END - if - - // Version number - $EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k]; - unset($EXT_DUMMY['ext_version'][$k]); - - // Extension is active - $EXT_DUMMY['ext_active'][$name] = $EXT_DUMMY['ext_active'][$k]; - unset($EXT_DUMMY['ext_active'][$k]); - - // Ext menu - $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k]; - unset($EXT_DUMMY['ext_menu'][$k]); - - // Language file - $EXT_DUMMY['ext_lang'][$name] = $EXT_DUMMY['ext_lang'][$k]; - unset($EXT_DUMMY['ext_lang'][$k]); - - // Functions file - $EXT_DUMMY['ext_func'][$name] = $EXT_DUMMY['ext_func'][$k]; - unset($EXT_DUMMY['ext_func'][$k]); - - // Extension id - $EXT_DUMMY['ext_id'][$name] = $EXT_DUMMY['ext_id'][$k]; - $id = $EXT_DUMMY['ext_id'][$name]; - unset($EXT_DUMMY['ext_id'][$k]); - - // Add ext name - $EXT_NAMES[$id] = $name; - - // Add deprecated flag (defaults to 'not deprecated') - $EXT_DUMMY['ext_deprecated'][$name] = 'N'; - - // Mark it as active extension - $GLOBALS['cache_array']['always_active'][$name] = $EXT_DUMMY['ext_keep'][$k]; - unset($EXT_DUMMY['ext_keep'][$k]); - - // Remove unneccessary data from memory - unset($EXT_DUMMY['ext_css'][$k]); - } // END - foreach - - // Write dummy array back - $EXT_DUMMY['ext_name'] = $EXT_NAMES; - unset($EXT_NAMES); - - // Loading cache is done so let's free some memory! - unset($EXT_DUMMY['ext_keep']); - unset($EXT_DUMMY['ext_css']); - } // END - if - - // Transfer dummy array - $GLOBALS['cache_array']['extension'] = $EXT_DUMMY; - unset($EXT_DUMMY); - - // No database load needed - $res_ext_crt = false; - - // Load all extension files in test-mode (we initialize them later) - foreach ($EXT_POOL as $ext) { - loadExtension($ext, 'test'); - } // END - foreach - - // Remove array and mark cache as loaded - unset($EXT_POOL); -} elseif (isHtmlOutputMode()) { - // Create cache file here - $GLOBALS['cache_instance']->init(); - - // Add more if sql_patches is recent enougth - $add = ''; - if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) $add = ", `ext_has_css` AS ext_css"; - - // Load all modules and their data - $result = SQL_QUERY('SELECT `id` AS ext_id, `ext_name`, `ext_active`, `ext_version`'.$add.' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__); - while ($content = SQL_FETCHARRAY($result)) { - // Load extension - loadExtension($content['ext_name'], 'test'); - - // Get menu entry - $content['ext_menu'] = 'N'; - if (ifModuleHasMenu($content['ext_name'], true)) { - // Extension is a module and has menu... pew! - $content['ext_menu'] = 'Y'; - } // END - if - - // Get language entry - $content['ext_lang'] = 'N'; - if (isLanguageIncludeReadable($content['ext_name'])) { - // Readable - $content['ext_lang'] = 'Y'; - } // END - if - - // Get function entry - $content['ext_func'] = 'N'; - if (isExtensionFunctionFileReadable($content['ext_name'])) { - // Readable - $content['ext_func'] = 'Y'; - } // END - if - - // Transfer EXT_ALWAYS_ACTIVE flag - $content['ext_keep'] = getExtensionAlwaysActive(); - - // Fix missing ext_css - if (!isset($content['ext_css'])) $content['ext_css'] = 'N'; - - // Add row to cache file - $GLOBALS['cache_instance']->addRow($content); - } // END - while - - // Free memory - SQL_FREERESULT($result); - - // Close the cache - $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches'); - $GLOBALS['cache_instance']->finalize(); -} - -// [EOF] +// @DEPRECATED ?> -- 2.39.5