inc/loader/.htaccess -text
inc/loader/load_cache-admin.php -text
inc/loader/load_cache-config.php -text
+inc/loader/load_cache-filter.php -text
inc/loader/load_cache-modreg.php -text
inc/loader/load_cache-refdepths.php -text
inc/loader/load_cache-refsystem.php -text
}
// Version number
-EXT_SET_VERSION('0.2.2');
+EXT_SET_VERSION('0.2.3');
// Version history array (add more with , '0.1.0' and so on)
-EXT_SET_VER_HISTORY(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2'));
+EXT_SET_VER_HISTORY(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3'));
// Which load mode?
switch ($EXT_LOAD_MODE) {
unregisterFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run);
unregisterFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run);
unregisterFilter('extension_remove', 'CACHE_DESTROY_ALL', true, $dry_run);
+ unregisterFilter('shutdown', 'CACHE_DESTROY_FILTER', true, $dry_run);
break;
case 'activate': // Do stuff when admin activates this extension
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Weitere Filter hinzugefügt.");
break;
+
+ case '0.2.3': // SQL queries for v0.2.3
+ ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD cache_filter ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+
+ // Update notes (these will be set as task text!)
+ EXT_SET_UPDATE_NOTES("Cachen von Filtern hinzugefügt.");
+
+ // Register a new filter
+ registerFilter('shutdown', 'CACHE_DESTROY_FILTER', false, true, $dry_run);
+ break;
}
break;
// Is the filter already initialized?
if ((isset($GLOBALS['filters']['chains'])) && (is_array($GLOBALS['filters']['chains']))) {
// Then abort here
- addFatalMessage(__FUNCTION__, __LINE__, getMessage('FILTER_FAILED_ALREADY_INIT'));
- return false;
+ debug_report_bug(getMessage('FILTER_FAILED_ALREADY_INIT'));
} // END - if
// Init the filter system (just some ideas)
$GLOBALS['filters']['counter'] = array();
// Load all saved filers if sql_patches is updated
- if (GET_EXT_VERSION('sql_patches') >= '0.5.9') {
+ if (isset($GLOBALS['cache_array']['filter'])) {
+ // Found in cache so rewrite the array
+ $filterArray = array();
+ foreach ($GLOBALS['cache_array']['filter']['filter_name'] as $idx => $filterName) {
+ // Get filter function
+ $filterFunction = $GLOBALS['cache_array']['filter']['filter_function'][$idx];
+
+ // Add the element with mapped index
+ $filterArray['counter'][$filterName][$filterFunction] = $GLOBALS['cache_array']['filter']['filter_counter'][$idx];
+ $filterArray['loaded'][$filterName][$filterFunction] = true;
+ $filterArray['chains'][$filterName][$filterFunction] = $GLOBALS['cache_array']['filter']['filter_active'][$idx];
+ } // END - foreach
+
+ // Set the array
+ //die('<pre>'.print_r($filterArray, true).'</pre>');
+ $GLOBALS['filters'] = $filterArray;
+
+ // Remove the cache
+ unset($GLOBALS['cache_array']['filter']);
+ } elseif (GET_EXT_VERSION('sql_patches') >= '0.5.9') {
// Init add
$add = '';
if (GET_EXT_VERSION('sql_patches') >= '0.6.0') $add = ", `filter_counter`";
// Free result
SQL_FREERESULT($result);
- } // END - if
- // Init filters
- registerFilter('init', 'UPDATE_LOGIN_DATA');
- registerFilter('init', 'INIT_RANDOMIZER');
+ // Init filters
+ registerFilter('init', 'UPDATE_LOGIN_DATA');
+ registerFilter('init', 'INIT_RANDOMIZER');
- // Login failures handler
- registerFilter('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES');
+ // Login failures handler
+ registerFilter('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES');
- // Filters for pre-extension-registration
- registerFilter('pre_extension_installed', 'RUN_SQLS');
+ // Filters for pre-extension-registration
+ registerFilter('pre_extension_installed', 'RUN_SQLS');
- // Filters for post-extension-registration
- registerFilter('post_extension_installed', 'AUTO_ACTIVATE_EXTENSION');
- registerFilter('post_extension_installed', 'SOLVE_TASK');
- registerFilter('post_extension_installed', 'LOAD_INCLUDES');
- registerFilter('post_extension_installed', 'REMOVE_UPDATES');
+ // Filters for post-extension-registration
+ registerFilter('post_extension_installed', 'AUTO_ACTIVATE_EXTENSION');
+ registerFilter('post_extension_installed', 'SOLVE_TASK');
+ registerFilter('post_extension_installed', 'LOAD_INCLUDES');
+ registerFilter('post_extension_installed', 'REMOVE_UPDATES');
- // Solving tasks
- registerFilter('solve_task', 'SOLVE_TASK');
+ // Solving tasks
+ registerFilter('solve_task', 'SOLVE_TASK');
- // Loading includes in general
- registerFilter('load_includes', 'LOAD_INCLUDES');
+ // Loading includes in general
+ registerFilter('load_includes', 'LOAD_INCLUDES');
- // Run SQLs
- registerFilter('run_sqls', 'RUN_SQLS');
+ // Run SQLs
+ registerFilter('run_sqls', 'RUN_SQLS');
- // Admin ACL check
- registerFilter('check_admin_acl', 'CHECK_ADMIN_ACL');
+ // Admin ACL check
+ registerFilter('check_admin_acl', 'CHECK_ADMIN_ACL');
- // Register shutdown filters
- registerFilter('shutdown', 'FLUSH_FILTERS');
+ // Register shutdown filters
+ registerFilter('shutdown', 'FLUSH_FILTERS');
+ } // END - if
}
// "Registers" a new filter function
foreach ($filterArray as $filterFunction => $cnt) {
// Construct and add the query
ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_filters` SET `filter_counter`=%s WHERE `filter_name`='%s' AND `filter_function`='%s' LIMIT 1",
- bigintval($cnt),
- $filterName,
- $filterFunction
+ bigintval($cnt),
+ $filterName,
+ $filterFunction
));
} // END - foreach
} // END - foreach
define('ADMIN_CACHE_MODREG', "Soll der Zugriff auf die Tabelle <strong>{!_MYSQL_PREFIX!}_mod_reg</strong> beschleunigt werden?");
define('ADMIN_CACHE_REFDEPTH', "Soll der Zugriff auf die Tabelle <strong>{!_MYSQL_PREFIX!}_refdepths</strong> beschleunigt werden?");
define('ADMIN_CACHE_REFSYS', "Soll der Zugriff auf die Tabelle <strong>{!_MYSQL_PREFIX!}_refsystem</strong> beschleunigt werden?");
+define('ADMIN_CACHE_filter', "Soll der Zugriff auf die Tabelle <strong>{!_MYSQL_PREFIX!}_filter</strong> beschleunigt werden?");
define('ADMIN_CACHE_THEMES', "Soll der Zugriff auf die Tabelle <strong>{!_MYSQL_PREFIX!}_themes</strong> beschleunigt werden?");
define('ADMIN_CACHE_ADMIN_MENU', "Soll der Aufbau des Administratormenüs beschleunigt werden (EXPERIMENTELL!)?");
define('ADMIN_CACHE_PATH', "Relativer Pfad für alle Cache-Dateien zum Pfad <strong>inc</strong>");
// Destroy all cache files
function FILTER_CACHE_DESTROY_ALL () {
// Skip this step if the cache instance is not there
- DEBUG_LOG(__FUNCTION__, __LINE__, 'Called!');
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, 'Called!');
if (!isCacheInstanceValid()) return false;
// Remove cache files
if ($GLOBALS['cache_instance']->loadCacheFile('refsystem')) $GLOBALS['cache_instance']->destroyCacheFile(false);
if ($GLOBALS['cache_instance']->loadCacheFile('themes')) $GLOBALS['cache_instance']->destroyCacheFile(false);
if ($GLOBALS['cache_instance']->loadCacheFile('revision')) $GLOBALS['cache_instance']->destroyCacheFile(false);
- DEBUG_LOG(__FUNCTION__, __LINE__, 'Done!');
+ if ($GLOBALS['cache_instance']->loadCacheFile('filter')) $GLOBALS['cache_instance']->destroyCacheFile(false);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, 'Done!');
+}
+
+// Filter for purging 'filter' cache
+function FILTER_CACHE_DESTROY_FILTER () {
+ // Skip this step if the cache instance is not there
+ if ((!isCacheInstanceValid()) || (getConfig('update_filter_usage') == 'N')) return false;
+
+ // Remove cache files
+ if ($GLOBALS['cache_instance']->loadCacheFile('filter')) $GLOBALS['cache_instance']->destroyCacheFile(false);
}
// Filter for purging entire admin menu cache
INIT_INC_POOL();
SET_INC_POOL(getArrayFromDirectory('inc/loader/', 'load_cache-'));
-// Run the filter
-runFilterChain('load_includes');
+// Pre-load filter cacher
+loadIncludeOnce('inc/loader/load_cache-filter.php');
+
+// Init filter system here
+initFilterSystem();
+
+// We have to include all here by-hand
+foreach (GET_INC_POOL() as $inc) {
+ loadIncludeOnce($inc);
+} // END - foreach
//
?>
$EXT_DUMMY['ext_deprecated'][$name] = 'N';
// Mark it as active extension
- $GLOBALS['cache_array']['active_extensions']['$name'] = $EXT_DUMMY['ext_keep'][$k];
+ $GLOBALS['cache_array']['active_extensions'][$name] = $EXT_DUMMY['ext_keep'][$k];
unset($EXT_DUMMY['ext_keep'][$k]);
// Remove unneccessary data from memory
LOAD_EXTENSION($ext);
} // END - foreach
- // Init filter system
- initFilterSystem();
-
// Load more cache files (like admins)
loadIncludeOnce('inc/load_cache.php');
}
} // END - while
- // Init filter system
- initFilterSystem();
-
if ($GLOBALS['cache_mode'] == 'init') {
// Close cache file
$GLOBALS['cache_instance']->finalize();
// Load more cache files (like admins)
loadIncludeOnce('inc/load_cache.php');
- } // END - if
+ } else {
+ // Init filter system for non-init mode
+ initFilterSystem();
+ }
// Free memory
SQL_FREERESULT($res_ext_crt);
$GLOBALS['cache_instance']->storeExtensionVersion('sql_patches');
// Load all modules and their data
- $result = SQL_QUERY('SELECT * FROM `{!_MYSQL_PREFIX!}_config` ORDER BY config ASC', __FILE__, __LINE__);
+ $result = SQL_QUERY('SELECT * FROM `{!_MYSQL_PREFIX!}_config` ORDER BY `config` ASC', __FILE__, __LINE__);
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
$GLOBALS['cache_instance']->addRow($data);
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 08/26/2008 *
+ * =============== Last change: 08/26/2008 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : load_cache-filter.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Load more cache files *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Mehr Cache-Dateien nachladen *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 1092 $ *
+ * $Date:: 2009-07-28 20:50:32 +0200 (Tue, 28 Jul 2009) $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: quix0r $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
+ require($INC);
+}
+
+// Skip this cache if we count usage
+if (getConfig('update_filter_usage') == 'Y') return;
+
+// Next cached table is the filteruration (filter)...
+if (($GLOBALS['cache_instance']->loadCacheFile('filter', true)) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) {
+ // Load filter from cache
+ $GLOBALS['cache_array']['filter'] = $GLOBALS['cache_instance']->getArrayFromCache();
+} elseif ((getConfig('cache_filter') == 'Y') && (getOutputMode() != '1') && (getOutputMode() != '-1')) {
+ // Create cache file here
+ $GLOBALS['cache_instance']->init('FILTER');
+ $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches');
+
+ // Load all modules and their data
+ $result = SQL_QUERY('SELECT * FROM `{!_MYSQL_PREFIX!}_filters` ORDER BY `filter_name` ASC', __FILE__, __LINE__);
+ while ($data = SQL_FETCHARRAY($result)) {
+ // Add row to cache file
+ $GLOBALS['cache_instance']->addRow($data);
+ } // END - while
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Close the cache
+ $GLOBALS['cache_instance']->finalize();
+
+ // Include loader again
+ require(__FILE__);
+}
+
+//
+?>
function OUTPUT_STANDARD_OVERVIEW (&$result_tasks) {
// First check for solved and not assigned tasks and assign them to current admin
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET `assigned_admin`=%s WHERE assigned_admin < 1 AND status != 'NEW'",
- array(getCurrentAdminId()), __FILE__, __LINE__);
+ array(getCurrentAdminId()), __FILE__, __LINE__);
// We currently don't want to install an extension so let's find out if we need...
$EXT_LOAD_MODE = 'register';
$jobsDone = true;
// Open the extension directory
- $extensionList = getArrayFromDirectory("inc/extensions/", "ext-", false, false);
+ $extensionList = getArrayFromDirectory('inc/extensions/', 'ext-', false, false);
foreach ($extensionList as $file) {
+ // Only file name is required... :(
+ $file = basename($file);
+
// Is this file an extension?
- if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == '.php')) {
- //* DEBUG: */ echo $file."<br />\n";
+ if ((substr($file, 0, 4) == 'ext-') && (substr($file, -4) == '.php')) {
// Possible newly installed extension found so we extract extension's name
$ext_name = strtolower(substr($file, 4, -4)); // Keep always extension names on lower case!!!
// Check if extension is installed or not
$ext_ver = GET_EXT_VERSION($ext_name);
+ //* DEBUG: */ echo $ext_name."=".$ext_ver."<br />\n";
// Is the extension not yet installed?
if (empty($ext_ver)) {
$GLOBALS['cache_instance']->destroyCacheFile();
} // END - if
+ if ((REQUEST_POST('cache_filter') == 'N') && ($GLOBALS['cache_instance']->loadCacheFile('filter'))) {
+ $GLOBALS['cache_instance']->destroyCacheFile();
+ } // END - if
+
// Save configuration
ADMIN_SAVE_SETTINGS_POST();
} else {
break;
} // END - switch
+ switch (getConfig('cache_filter')) {
+ case 'Y':
+ define('__FILTER_Y', ' checked="checked"');
+ define('__FILTER_N', '');
+ break;
+
+ case 'N':
+ define('__FILTER_Y', '');
+ define('__FILTER_N', ' checked="checked"');
+ break;
+ } // END - switch
+
switch (getConfig('cache_themes')) {
case 'Y':
define('__THEMES_Y', ' checked="checked"');
<tr>
<td colspan="2" class="seperator" height="10"> </td>
</tr>
+ <tr>
+ <td align="right" width="350" height="20">
+ {--ADMIN_CACHE_FILTER--}</td>
+ <td width="150" style="padding-left: 10px"><input type="radio"
+ name="cache_filter" value="Y" class="admin_normal"{!__FILTER_Y!} /> {--YES--}
+ <input type="radio" name="cache_filter" value="N" class="admin_normal"{!__FILTER_N!} /> {--NO--}
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="seperator" height="10"> </td>
+ </tr>
<tr>
<td align="right" width="350" height="20">
{--ADMIN_CACHE_THEMES--}</td>