Updated domain without a dash :(
[mailer.git] / inc / extensions / ext-cache.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/11/2004 *
4  * ===================                          Last change: 10/11/2004 *
5  *                                                                      *
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  * -------------------------------------------------------------------- *
14  * $Revision::                                                        $ *
15  * $Date::                                                            $ *
16  * $Tag:: 0.2.1-FINAL                                                 $ *
17  * $Author::                                                          $ *
18  * -------------------------------------------------------------------- *
19  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
20  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
21  * For more information visit: http://mxchange.org                      *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 } // END - if
43
44 // Version number
45 setThisExtensionVersion('0.2.5');
46
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'));
49
50 // Keep this extension always active!
51 setExtensionAlwaysActive('Y');
52
53 // Which load mode?
54 switch (getExtensionMode()) {
55         case 'setup': // Do stuff when installation is running
56                 break;
57
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')");
61
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());
72                 break;
73
74         case 'activate': // Do stuff when admin activates this extension
75                 // SQL commands to run
76                 addExtensionSql('');
77                 break;
78
79         case 'deactivate': // Do stuff when admin deactivates this extension
80                 // SQL commands to run
81                 addExtensionSql('');
82                 break;
83
84         case 'update': // Update an extension
85                 // Which version?
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&uuml;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.");
90                                 break;
91
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.");
95                                 break;
96
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.");
100                                 break;
101
102                         case '0.0.4': // SQL queries for v0.0.4
103                                 // Update notes (these will be set as task text!)
104                                 setExtensionUpdateNotes("Spalte &quot;keep_active&quot; ist hinzugef&uuml;gt.");
105                                 break;
106
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");
110                                 break;
111
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.");
115                                 break;
116
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);
121
122                                 // Update notes (these will be set as task text!)
123                                 setExtensionUpdateNotes("Hits auf den Cache werden gez&auml;hlt.");
124                                 break;
125
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.");
129                                 break;
130
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.");
134                                 break;
135
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.");
139                                 break;
140
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.");
144                                 break;
145
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.");
149                                 break;
150
151                         case '0.1.3': // SQL queries for v0.1.3
152                                 // Update notes (these will be set as task text!)
153                                 setExtensionUpdateNotes("Ung&uuml;ltiges Update.");
154                                 break;
155
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>.");
159                                 break;
160
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.");
164                                 break;
165
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&auml;hrend des Installationsvorganges beseitigt.");
169                                 break;
170
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.");
174                                 break;
175
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.");
179                                 break;
180
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&uuml;ltig.");
184                                 break;
185
186                         case '0.2.0': // SQL queries for v0.2.0
187                                 // Update notes (these will be set as task text!)
188                                 setExtensionUpdateNotes("Die Erweiterung h&auml;ngt nun von der <strong>sql_patches</strong> ab.");
189                                 break;
190
191                         case '0.2.1': // SQL queries for v0.2.1
192                                 // Register the new filter
193                                 registerFilter(__FILE__, __LINE__, 'extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun());
194                                 registerFilter(__FILE__, __LINE__, 'post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun());
195                                 registerFilter(__FILE__, __LINE__, 'post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun());
196                                 registerFilter(__FILE__, __LINE__, 'post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
197                                 registerFilter(__FILE__, __LINE__, 'post_form_submited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
198                                 registerFilter(__FILE__, __LINE__, 'post_form_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
199                                 registerFilter(__FILE__, __LINE__, 'post_form_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun());
200                                 registerFilter(__FILE__, __LINE__, 'extension_remove', 'CACHE_DESTROY_ALL', FALSE, TRUE, isExtensionDryRun());
201
202                                 // Update notes (these will be set as task text!)
203                                 setExtensionUpdateNotes("Filter f&uuml;r Erweiterungsmanagement hinzugef&uuml;gt.");
204                                 break;
205
206                         case '0.2.2': // SQL queries for v0.2.2
207                                 // Update notes (these will be set as task text!)
208                                 setExtensionUpdateNotes("Update nicht mehr g&uuml;ltig.");
209                                 break;
210
211                         case '0.2.3': // SQL queries for v0.2.3
212                                 addConfigAddSql('cache_filter', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
213
214                                 // Update notes (these will be set as task text!)
215                                 setExtensionUpdateNotes("Cachen von Filtern hinzugef&uuml;gt.");
216
217                                 // Register a new filter
218                                 registerFilter(__FILE__, __LINE__, 'shutdown', 'CACHE_DESTROY_FILTER', FALSE, TRUE, isExtensionDryRun());
219                                 break;
220
221                         case '0.2.4': // SQL queries for v0.2.4
222                                 // SQL commands to run
223                                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_cache' LIMIT 1");
224
225                                 // Remove config entries
226                                 addConfigDropSql('cache_themes');
227                                 addConfigDropSql('cache_admins');
228                                 addConfigDropSql('cache_acls');
229                                 addConfigDropSql('cache_exts');
230                                 addConfigDropSql('cache_config');
231                                 addConfigDropSql('cache_modreg');
232                                 addConfigDropSql('cache_refdepth');
233                                 addConfigDropSql('cache_refsys');
234
235                                 // Update notes (these will be set as task text!)
236                                 setExtensionUpdateNotes("Der Cache hat keine Konfiguration mehr.");
237                                 break;
238
239                         case '0.2.5': // SQL queries for v0.2.5
240                                 // Update notes (these will be set as task text!)
241                                 setExtensionUpdateNotes("Daten von gefundenen Sprachdateien werden zu den Erweiterungen gecacht.");
242                                 break;
243                 } // END - switch
244                 break;
245
246         case 'modify': // When the extension got modified
247                 break;
248
249         case 'test': // For testing purposes
250                 break;
251
252         case 'init': // Do stuff when extension is initialized
253                 break;
254
255         default: // Unknown extension mode
256                 reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName()));
257                 break;
258 } // END - switch
259
260 // [EOF]
261 ?>