<?php
/************************************************************************
- * MXChange v0.2.1 Start: 09/09/2008 *
- * =============== Last change: 09/09/2008 *
+ * Mailer v0.2.1-FINAL Start: 09/09/2008 *
+ * =================== Last change: 09/09/2008 *
* *
* -------------------------------------------------------------------- *
* File : load_cache-modules.php *
* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// 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=<pre>'.print_r($modArray, true).'</pre>');
+ } // 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 (getScriptOutputMode() != 1) {
// 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