2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/11/2004 *
4 * =================== Last change: 10/11/2004 *
6 * -------------------------------------------------------------------- *
7 * File : ext-cache.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Caching system for SQL tables on hard disc *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Caching-System zum Auslagern von SQL-Tabellen *
12 * auf der Festplatte des Servers *
13 * -------------------------------------------------------------------- *
16 * $Tag:: 0.2.1-FINAL $ *
18 * Needs to be in all Files and every File needs "svn propset *
19 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
20 * -------------------------------------------------------------------- *
21 * Copyright (c) 2003 - 2009 by Roland Haeder *
22 * Copyright (c) 2009, 2010 by Mailer Developer Team *
23 * For more information visit: http://www.mxchange.org *
25 * This program is free software; you can redistribute it and/or modify *
26 * it under the terms of the GNU General Public License as published by *
27 * the Free Software Foundation; either version 2 of the License, or *
28 * (at your option) any later version. *
30 * This program is distributed in the hope that it will be useful, *
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
33 * GNU General Public License for more details. *
35 * You should have received a copy of the GNU General Public License *
36 * along with this program; if not, write to the Free Software *
37 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
39 ************************************************************************/
41 // Some security stuff...
42 if (!defined('__SECURITY')) {
47 setThisExtensionVersion('0.2.5');
49 // Version history array (add more with , '0.1.0' and so on)
50 setExtensionVersionHistory(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', '0.2.4', '0.2.5'));
52 // Keep this extension always active!
53 setExtensionAlwaysActive('Y');
56 switch (getExtensionMode()) {
57 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
60 case 'remove': // Do stuff when removing extension
61 // SQL commands to run
62 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('cache_stats','config_config')");
64 // Unregister all filters
65 unregisterFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, getExtensionDryRun());
66 unregisterFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, getExtensionDryRun());
67 unregisterFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, getExtensionDryRun());
68 unregisterFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, getExtensionDryRun());
69 unregisterFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, getExtensionDryRun());
70 unregisterFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, getExtensionDryRun());
71 unregisterFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, getExtensionDryRun());
72 unregisterFilter('extension_remove', 'CACHE_DESTROY_ALL', true, getExtensionDryRun());
73 unregisterFilter('shutdown', 'CACHE_DESTROY_FILTER', true, getExtensionDryRun());
76 case 'activate': // Do stuff when admin activates this extension
77 // SQL commands to run
81 case 'deactivate': // Do stuff when admin deactivates this extension
82 // SQL commands to run
86 case 'update': // Update an extension
88 switch (getCurrentExtensionVersion()) {
89 case '0.0.1': // SQL queries for v0.0.1
90 // Update notes (these will be set as task text!)
91 setExtensionUpdateNotes("Es wurde die Zeitmarke der Cache-Datei extensions.cache mit berücksichtigt. Dies hatte die Folge, dass wenn bei einem Gast die Datei aktualisiert wurde, nur aktivierte und nicht die deaktivierten mit geladen wurden. Folglich fiehlen einfach ein paar Erweiterungen aus.");
94 case '0.0.2': // SQL queries for v0.0.2
95 // Update notes (these will be set as task text!)
96 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
99 case '0.0.3': // SQL queries for v0.0.3
100 // Update notes (these will be set as task text!)
101 setExtensionUpdateNotes("Cache-Update repariert.");
104 case '0.0.4': // SQL queries for v0.0.4
105 // Is the cache extension itself there?
106 if (isExtensionActive('cache')) {
107 // Check for cache when extension is already installed
108 if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile();
111 // Update notes (these will be set as task text!)
112 setExtensionUpdateNotes("Spalte "keep_active" ist hinzugefügt. Cache wurde reinitialisiert.");
115 case '0.0.5': // SQL queries for v0.0.5
116 // Update notes (these will be set as task text!)
117 setExtensionUpdateNotes("Registrierung der Cache-Erweiterung repariert");
120 case '0.0.6': // SQL queries for v0.0.6
121 // Update notes (these will be set as task text!)
122 setExtensionUpdateNotes("Validierung der Cache-Datei admins.cache integriert.");
125 case '0.0.7': // SQL queries for v0.0.7
126 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD db_hits BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
127 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD cache_hits BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
128 addAdminMenuSql('stats','cache_stats','DB-Cache','Auf Cache und gesamte Datenbank registrierte Anfragen anzeigen.', 4);
130 // Update notes (these will be set as task text!)
131 setExtensionUpdateNotes("Hits auf den Cache werden gezählt.");
134 case '0.0.8': // SQL queries for v0.0.8
135 // Update notes (these will be set as task text!)
136 setExtensionUpdateNotes("Das Umschreiben der Cache-Daten hat eine Fehlermeldung <strong>Falsches Passwort!</strong> im Admin-Bereich verursacht.");
139 case '0.0.9': // SQL queries for v0.0.9
140 // Update notes (these will be set as task text!)
141 setExtensionUpdateNotes("Interne Datenfeld-Management korregiert und Cache-Statistiken korregiert.");
144 case '0.1.0': // SQL queries for v0.2.1
145 // Update notes (these will be set as task text!)
146 setExtensionUpdateNotes("Problem mit fehlender admins-Erweiterung beseitigt.");
149 case '0.1.1': // SQL queries for v0.1.1
150 // Update notes (these will be set as task text!)
151 setExtensionUpdateNotes("Fehler <strong>Division durch 0</strong> repariert in den DB-Cache Statistiken.");
154 case '0.1.2': // SQL queries for v0.1.2
155 // Update notes (these will be set as task text!)
156 setExtensionUpdateNotes("Die Tabelen <strong>{?_MYSQL_PREFIX?}_config</strong>, <strong>{?_MYSQL_PREFIX?}_refsystem</strong>, <strong>{?_MYSQL_PREFIX?}_refdepths</strong> und <strong>{?_MYSQL_PREFIX?}_mod_reg</strong> werden nun auch ausgelagert.");
159 case '0.1.3': // SQL queries for v0.1.3
160 // Update notes (these will be set as task text!)
161 setExtensionUpdateNotes("Ungültiges Update.");
164 case '0.1.4': // SQL queries for v0.1.4
165 // Update notes (these will be set as task text!)
166 setExtensionUpdateNotes("Fehler <strong>Division durch 0</strong> repariert in <strong>inc/load_cache.php</strong>.");
169 case '0.1.5': // SQL queries for v0.1.5
170 // Update notes (these will be set as task text!)
171 setExtensionUpdateNotes("Weitere Fehler im System beseitigt.");
174 case '0.1.6': // SQL queries for v0.1.6
175 // Update notes (these will be set as task text!)
176 setExtensionUpdateNotes("Probleme während des Installationsvorganges beseitigt.");
179 case '0.1.7': // SQL queries for v0.1.7
180 // Update notes (these will be set as task text!)
181 setExtensionUpdateNotes("CSS-Klassenname gefixt in Templates.");
184 case '0.1.8': // SQL queries for v0.1.8
185 // Update notes (these will be set as task text!)
186 setExtensionUpdateNotes("Daten von installierten Themes werden nun gecacht.");
189 case '0.1.9': // SQL queries for v0.1.9
190 // Update notes (these will be set as task text!)
191 setExtensionUpdateNotes("Update nicht mehr gültig.");
194 case '0.2.0': // SQL queries for v0.2.0
195 // This update depends on sql_patches
196 addExtensionUpdateDependency('sql_patches');
198 // Update notes (these will be set as task text!)
199 setExtensionUpdateNotes("Die Erweiterung hängt nun von der <strong>sql_patches</strong> ab.");
202 case '0.2.1': // SQL queries for v0.2.1
203 // Register the new filter
204 registerFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, getExtensionDryRun());
205 registerFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, getExtensionDryRun());
206 registerFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, getExtensionDryRun());
207 registerFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, getExtensionDryRun());
208 registerFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, getExtensionDryRun());
209 registerFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, getExtensionDryRun());
210 registerFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, getExtensionDryRun());
211 registerFilter('extension_remove', 'CACHE_DESTROY_ALL', false, true, getExtensionDryRun());
213 // Update notes (these will be set as task text!)
214 setExtensionUpdateNotes("Filter für Erweiterungsmanagement hinzugefügt.");
217 case '0.2.2': // SQL queries for v0.2.2
218 // Update notes (these will be set as task text!)
219 setExtensionUpdateNotes("Update nicht mehr gültig.");
222 case '0.2.3': // SQL queries for v0.2.3
223 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD cache_filter ENUM('Y','N') NOT NULL DEFAULT 'Y'");
225 // Update notes (these will be set as task text!)
226 setExtensionUpdateNotes("Cachen von Filtern hinzugefügt.");
228 // Register a new filter
229 registerFilter('shutdown', 'CACHE_DESTROY_FILTER', false, true, getExtensionDryRun());
232 case '0.2.4': // SQL queries for v0.2.4
233 // SQL commands to run
234 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_cache' LIMIT 1");
236 // Remove config entries
237 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_themes`");
238 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_admins`");
239 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_acls`");
240 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_exts`");
241 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_config`");
242 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_modreg`");
243 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_refdepth`");
244 addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_refsys`");
246 // Update notes (these will be set as task text!)
247 setExtensionUpdateNotes("Der Cache hat keine Konfiguration mehr.");
250 case '0.2.5': // SQL queries for v0.2.5
251 // Update notes (these will be set as task text!)
252 setExtensionUpdateNotes("Daten von gefundenen Sprachdateien werden zu den Erweiterungen gecacht.");
257 case 'modify': // When the extension got modified
260 case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
263 case 'init': // Do stuff when extension is initialized
266 default: // Unknown extension mode
267 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));