X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Floader%2Fload_cache-modules.php;h=7945b028afbb04525eb66fbfa12dd1fc9810dcde;hb=d2c972ef5f68c2f69865aa4f392841d166a419ae;hp=0c7f12e4afa1ce952c2197a01c1526762041890b;hpb=16680c2d93b9df15ff01b6eb0b5c2fea04cfc9cd;p=mailer.git diff --git a/inc/loader/load_cache-modules.php b/inc/loader/load_cache-modules.php index 0c7f12e4af..7945b028af 100644 --- a/inc/loader/load_cache-modules.php +++ b/inc/loader/load_cache-modules.php @@ -1,7 +1,7 @@ loadCacheFile('modules')) && ($GLOBALS['cache_i // Rewrite module cache $modArray = $GLOBALS['cache_array']['modules']; + + // Do only process valid arrays + if (!isset($modArray['module'])) { + // We should fix this! + debug_report_bug(__FILE__, __LINE__, 'modArray=
'.print_r($modArray, true).''); + } // END - if + + // Rewrite some parts foreach ($modArray['module'] as $key => $mod) { - $GLOBALS['cache_array']['modules']['id'][$mod] = $modArray['id'][$key]; - unset($GLOBALS['cache_array']['modules']['id'][$key]); - $GLOBALS['cache_array']['modules']['title'][$mod] = $modArray['title'][$key]; - unset($GLOBALS['cache_array']['modules']['title'][$key]); - $GLOBALS['cache_array']['modules']['locked'][$mod] = $modArray['locked'][$key]; - unset($GLOBALS['cache_array']['modules']['locked'][$key]); - $GLOBALS['cache_array']['modules']['hidden'][$mod] = $modArray['hidden'][$key]; - unset($GLOBALS['cache_array']['modules']['hidden'][$key]); - $GLOBALS['cache_array']['modules']['admin_only'][$mod] = $modArray['admin_only'][$key]; - unset($GLOBALS['cache_array']['modules']['admin_only'][$key]); - $GLOBALS['cache_array']['modules']['mem_only'][$mod] = $modArray['mem_only'][$key]; - unset($GLOBALS['cache_array']['modules']['mem_only'][$key]); - if (isset($GLOBALS['cache_array']['modules']['has_menu'][$key])) { - $GLOBALS['cache_array']['modules']['has_menu'][$mod] = $modArray['has_menu'][$key]; - unset($GLOBALS['cache_array']['modules']['has_menu'][$key]); + // Default without sql_patches + $entries = array('id','title','locked','hidden','admin_only','mem_only'); + + // Is ext-sql_patches newer or equal 0.3.6? + if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) { + // Add 'has_menu' + $entries[] = 'has_menu'; } // END - if + + // Add all + foreach ($entries as $entry) { + // Is the entry set? + if (isset($GLOBALS['cache_array']['modules'][$entry][$key])) { + // Transfer it + $GLOBALS['cache_array']['modules'][$entry][$mod] = $modArray[$entry][$key]; + + // And delete cache + unset($GLOBALS['cache_array']['modules'][$entry][$key]); + } else { + // Log this for debug purposes + logDebugMessage(basename(__FILE__), __LINE__, 'Entry not found. module=' . $mod . ',key=' . $key . ',entry=' . $entry); + } + } // END - foreach } // END - foreach unset($modArray); -} elseif (getOutputMode() != '1') { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); // Load all modules and their data if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) { // Load has_menu - $result = SQL_QUERY('SELECT id, module, title, locked, hidden, admin_only, title, mem_only, has_menu -FROM `{?_MYSQL_PREFIX?}_mod_reg` ORDER BY `id`', __FILE__, __LINE__); + $result = SQL_QUERY('SELECT + `id`, `module`, `title`, `locked`, `hidden`, `admin_only`, `title`, `mem_only`, `has_menu` +FROM + `{?_MYSQL_PREFIX?}_mod_reg` +ORDER BY + `module` ASC', __FILE__, __LINE__); } else { // Don't load has_menu - $result = SQL_QUERY('SELECT id, module, title, locked, hidden, admin_only, title, mem_only -FROM `{?_MYSQL_PREFIX?}_mod_reg` ORDER BY `id`', __FILE__, __LINE__); + $result = SQL_QUERY('SELECT + `id`, `module`, `title`, `locked`, `hidden`, `admin_only`, `title`, `mem_only` +FROM + `{?_MYSQL_PREFIX?}_mod_reg` +ORDER BY + `module` ASC', __FILE__, __LINE__); } // Cache all data