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 drive *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Caching-System zum Auslagern von SQL-Tabellen *
12 * auf der Festplatte des Servers *
13 * -------------------------------------------------------------------- *
16 * $Tag:: 0.2.1-FINAL $ *
18 * -------------------------------------------------------------------- *
19 * Copyright (c) 2003 - 2009 by Roland Haeder *
20 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
21 * For more information visit: http://mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
45 setThisExtensionVersion('0.2.5');
47 // Version history array (add more with , '0.0.1' and so on)
48 setExtensionVersionHistory(array('0.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'));
50 // Keep this extension always active!
51 setExtensionAlwaysActive('Y');
54 switch (getExtensionMode()) {
55 case 'register': // Do stuff when installation is running
58 case 'remove': // Do stuff when removing extension
59 // SQL commands to run
60 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('cache_stats','config_config')");
62 // Unregister all filters
63 unregisterFilter(__FILE__, __LINE__, 'extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', TRUE, isExtensionDryRun());
64 unregisterFilter(__FILE__, __LINE__, 'post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', TRUE, isExtensionDryRun());
65 unregisterFilter(__FILE__, __LINE__, 'post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', TRUE, isExtensionDryRun());
66 unregisterFilter(__FILE__, __LINE__, 'post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun());
67 unregisterFilter(__FILE__, __LINE__, 'post_form_submited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun());
68 unregisterFilter(__FILE__, __LINE__, 'post_form_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun());
69 unregisterFilter(__FILE__, __LINE__, 'post_form_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun());
70 unregisterFilter(__FILE__, __LINE__, 'extension_remove', 'CACHE_DESTROY_ALL', TRUE, isExtensionDryRun());
71 unregisterFilter(__FILE__, __LINE__, 'shutdown', 'CACHE_DESTROY_FILTER', TRUE, isExtensionDryRun());
74 case 'activate': // Do stuff when admin activates this extension
75 // SQL commands to run
79 case 'deactivate': // Do stuff when admin deactivates this extension
80 // SQL commands to run
84 case 'update': // Update an extension
86 switch (getCurrentExtensionVersion()) {
87 case '0.0.1': // SQL queries for v0.0.1
88 // Update notes (these will be set as task text!)
89 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.");
92 case '0.0.2': // SQL queries for v0.0.2
93 // Update notes (these will be set as task text!)
94 setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist.");
97 case '0.0.3': // SQL queries for v0.0.3
98 // Update notes (these will be set as task text!)
99 setExtensionUpdateNotes("Cache-Update repariert.");
102 case '0.0.4': // SQL queries for v0.0.4
103 // Update notes (these will be set as task text!)
104 setExtensionUpdateNotes("Spalte "keep_active" ist hinzugefügt.");
107 case '0.0.5': // SQL queries for v0.0.5
108 // Update notes (these will be set as task text!)
109 setExtensionUpdateNotes("Registrierung der Cache-Erweiterung repariert");
112 case '0.0.6': // SQL queries for v0.0.6
113 // Update notes (these will be set as task text!)
114 setExtensionUpdateNotes("Validierung der Cache-Datei admins.cache integriert.");
117 case '0.0.7': // SQL queries for v0.0.7
118 addConfigAddSql('db_hits', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
119 addConfigAddSql('cache_hits', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
120 addAdminMenuSql('stats','cache_stats','DB-Cache','Auf Cache und gesamte Datenbank registrierte Anfragen anzeigen.', 4);
122 // Update notes (these will be set as task text!)
123 setExtensionUpdateNotes("Hits auf den Cache werden gezählt.");
126 case '0.0.8': // SQL queries for v0.0.8
127 // Update notes (these will be set as task text!)
128 setExtensionUpdateNotes("Das Umschreiben der Cache-Daten hat eine Fehlermeldung <strong>Falsches Passwort!</strong> im Admin-Bereich verursacht.");
131 case '0.0.9': // SQL queries for v0.0.9
132 // Update notes (these will be set as task text!)
133 setExtensionUpdateNotes("Interne Datenfeld-Management korregiert und Cache-Statistiken korregiert.");
136 case '0.1.0': // SQL queries for v0.2.1
137 // Update notes (these will be set as task text!)
138 setExtensionUpdateNotes("Problem mit fehlender admins-Erweiterung beseitigt.");
141 case '0.1.1': // SQL queries for v0.1.1
142 // Update notes (these will be set as task text!)
143 setExtensionUpdateNotes("Fehler <strong>Division durch 0</strong> repariert in den DB-Cache Statistiken.");
146 case '0.1.2': // SQL queries for v0.1.2
147 // Update notes (these will be set as task text!)
148 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.");
151 case '0.1.3': // SQL queries for v0.1.3
152 // Update notes (these will be set as task text!)
153 setExtensionUpdateNotes("Ungültiges Update.");
156 case '0.1.4': // SQL queries for v0.1.4
157 // Update notes (these will be set as task text!)
158 setExtensionUpdateNotes("Fehler <strong>Division durch 0</strong> repariert in <strong>inc/load_cache.php</strong>.");
161 case '0.1.5': // SQL queries for v0.1.5
162 // Update notes (these will be set as task text!)
163 setExtensionUpdateNotes("Weitere Fehler im System beseitigt.");
166 case '0.1.6': // SQL queries for v0.1.6
167 // Update notes (these will be set as task text!)
168 setExtensionUpdateNotes("Probleme während des Installationsvorganges beseitigt.");
171 case '0.1.7': // SQL queries for v0.1.7
172 // Update notes (these will be set as task text!)
173 setExtensionUpdateNotes("CSS-Klassenname gefixt in Templates.");
176 case '0.1.8': // SQL queries for v0.1.8
177 // Update notes (these will be set as task text!)
178 setExtensionUpdateNotes("Daten von installierten Themes werden nun gecacht.");
181 case '0.1.9': // SQL queries for v0.1.9
182 // Update notes (these will be set as task text!)
183 setExtensionUpdateNotes("Update nicht mehr gültig.");
186 case '0.2.0': // SQL queries for v0.2.0
187 // This update depends on ext-sql_patches
188 addExtensionDependency('sql_patches');
190 // Update notes (these will be set as task text!)
191 setExtensionUpdateNotes("Die Erweiterung hängt nun von der <strong>sql_patches</strong> ab.");
194 case '0.2.1': // SQL queries for v0.2.1
195 // Register the new filter
196 registerFilter(__FILE__, __LINE__, 'extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun());
197 registerFilter(__FILE__, __LINE__, 'post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun());
198 registerFilter(__FILE__, __LINE__, 'post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun());
199 registerFilter(__FILE__, __LINE__, 'post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
200 registerFilter(__FILE__, __LINE__, 'post_form_submited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
201 registerFilter(__FILE__, __LINE__, 'post_form_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
202 registerFilter(__FILE__, __LINE__, 'post_form_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
203 registerFilter(__FILE__, __LINE__, 'extension_remove', 'CACHE_DESTROY_ALL', FALSE, TRUE, isExtensionDryRun());
205 // Update notes (these will be set as task text!)
206 setExtensionUpdateNotes("Filter für Erweiterungsmanagement hinzugefügt.");
209 case '0.2.2': // SQL queries for v0.2.2
210 // Update notes (these will be set as task text!)
211 setExtensionUpdateNotes("Update nicht mehr gültig.");
214 case '0.2.3': // SQL queries for v0.2.3
215 addConfigAddSql('cache_filter', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
217 // Update notes (these will be set as task text!)
218 setExtensionUpdateNotes("Cachen von Filtern hinzugefügt.");
220 // Register a new filter
221 registerFilter(__FILE__, __LINE__, 'shutdown', 'CACHE_DESTROY_FILTER', FALSE, TRUE, isExtensionDryRun());
224 case '0.2.4': // SQL queries for v0.2.4
225 // SQL commands to run
226 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_cache' LIMIT 1");
228 // Remove config entries
229 addConfigDropSql('cache_themes');
230 addConfigDropSql('cache_admins');
231 addConfigDropSql('cache_acls');
232 addConfigDropSql('cache_exts');
233 addConfigDropSql('cache_config');
234 addConfigDropSql('cache_modreg');
235 addConfigDropSql('cache_refdepth');
236 addConfigDropSql('cache_refsys');
238 // Update notes (these will be set as task text!)
239 setExtensionUpdateNotes("Der Cache hat keine Konfiguration mehr.");
242 case '0.2.5': // SQL queries for v0.2.5
243 // Update notes (these will be set as task text!)
244 setExtensionUpdateNotes("Daten von gefundenen Sprachdateien werden zu den Erweiterungen gecacht.");
249 case 'modify': // When the extension got modified
252 case 'test': // For testing purposes
255 case 'init': // Do stuff when extension is initialized
258 default: // Unknown extension mode
259 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));