$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return;
// Load default sql_patches extension if present
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return;
// Load default sql_patches extension if present
include_once(PATH."inc/libs/cache_functions.php");
$cacheMode = "";
include_once(PATH."inc/extensions/ext-cache.php");
include_once(PATH."inc/libs/cache_functions.php");
$cacheMode = "";
include_once(PATH."inc/extensions/ext-cache.php");
case true : $cacheMode = "load"; break;
case false: $cacheMode = "init"; break;
}
// Do not recreate cache file when it's switched off!
case true : $cacheMode = "load"; break;
case false: $cacheMode = "init"; break;
}
// Do not recreate cache file when it's switched off!
- // Load language
- if ($cacheMode == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php");
+ // If we need to init the cache init it now
+ if ($cacheMode == "init") {
+ // Init cache file
+ $cacheInstance->cache_init("EXTENSIONS");
+ $cacheInstance->store_extension_version("sql_patches");
+
+ if ($_CONFIG['cache_exts'] == "N") $cacheMode = "skip";
+ } // END - if
// Re-initialize handler
$cacheInstance->cache_file("extensions", true);
// Load extension data from cache file
$EXT_DUMMY = $cacheInstance->cache_load();
// Re-initialize handler
$cacheInstance->cache_file("extensions", true);
// Load extension data from cache file
$EXT_DUMMY = $cacheInstance->cache_load();
+
+ // Is the cache file fine?
+ if (!isset($EXT_DUMMY['ext_name'])) {
+ // Cache file is damaged so kill it
+ $cacheInstance->cache_destroy();
+
+ // Skip any further execution
+ return;
+ } // END - if
+
+ // Begin with the cache preparation of extensions
// Load Language file
if ($EXT_DUMMY['ext_lang'][$k] == "Y") {
$INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE());
// Load Language file
if ($EXT_DUMMY['ext_lang'][$k] == "Y") {
$INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE());
// Load extension file itself
if (($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) {
// Load extension file itself
if (($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) {
} // END - if
// Version number
$EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k];
unset($EXT_DUMMY['ext_version'][$k]);
} // END - if
// Version number
$EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k];
unset($EXT_DUMMY['ext_version'][$k]);
- // If current user is not admin load only activated extensions
- // The admin shall use every available extension for testing purposes
+ // If current user is not admin load only activated extensions. But load
+ // them all if we are going to init the cache files. The admin shall use
+ // every available extension for testing purposes.
if ((!IS_ADMIN()) && ($cacheMode != "init")) $ADD = " WHERE ext_active='Y'";
if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
if ((!IS_ADMIN()) && ($cacheMode != "init")) $ADD = " WHERE ext_active='Y'";
if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
FROM "._MYSQL_PREFIX."_extensions".$ADD."
ORDER BY ext_name", __FILE__, __LINE__);
} else {
FROM "._MYSQL_PREFIX."_extensions".$ADD."
ORDER BY ext_name", __FILE__, __LINE__);
} else {
$res_ext_crt = SQL_QUERY("SELECT id, ext_name, ext_lang_file, ext_name, ext_active, ext_version
FROM "._MYSQL_PREFIX."_extensions".$ADD."
ORDER BY ext_name", __FILE__, __LINE__);
$res_ext_crt = SQL_QUERY("SELECT id, ext_name, ext_lang_file, ext_name, ext_active, ext_version
FROM "._MYSQL_PREFIX."_extensions".$ADD."
ORDER BY ext_name", __FILE__, __LINE__);
// Extensions are registered so we load them
while (list($EXT_ID, $name, $lang, $css, $active, $version) = SQL_FETCHROW($res_ext_crt)) {
// Get menu entry
$menu = "N";
// Extensions are registered so we load them
while (list($EXT_ID, $name, $lang, $css, $active, $version) = SQL_FETCHROW($res_ext_crt)) {
// Get menu entry
$menu = "N";
$file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $name);
// Does the extension file exists?
$file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $name);
// Does the extension file exists?
// If there's no language file specified we don't need to load one... ;-)
if (!empty($lang)) {
// Create language file
$file2 = sprintf("%sinc/language/%s_%s.php", PATH, $lang, GET_LANGUAGE());
}
// If there's no language file specified we don't need to load one... ;-)
if (!empty($lang)) {
// Create language file
$file2 = sprintf("%sinc/language/%s_%s.php", PATH, $lang, GET_LANGUAGE());
}
if ($css == "Y") {
$CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $name);
if ($css == "Y") {
$CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $name);
// CSS file for extension was found (use only relative path for now!)
$EXT_CSS_FILES[] = $name.".css";
} else {
// CSS file for extension was found (use only relative path for now!)
$EXT_CSS_FILES[] = $name.".css";
} else {
// Remove extensions from two tables: extension registry and tasks table
foreach ($DEL as $name) {
// First remove entry from extensions table
// Remove extensions from two tables: extension registry and tasks table
foreach ($DEL as $name) {
// First remove entry from extensions table
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
- array($name), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
+ array($name), __FILE__, __LINE__);
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:] %' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
- array($name), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:] %' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
+ array($name), __FILE__, __LINE__);