Several minor rewrites, getter GET_JACKPOT_POINTS() added
[mailer.git] / inc / extensions / ext-cache.php
index 75780f06d20cf0e4ddca1a8a87e2deb99b4c501e..a3e37ec027109d48c28e2dfba0922a405c185555 100644 (file)
@@ -44,13 +44,13 @@ if (!defined('__SECURITY')) {
 }
 
 // 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'));
 
-switch ($EXT_LOAD_MODE)
-{
+// Which load mode?
+switch ($EXT_LOAD_MODE) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // SQL commands to run
                ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD cache_update BIGINT(20) UNSIGNED NOT NULL DEFAULT 3600");
@@ -74,6 +74,7 @@ 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
@@ -87,8 +88,8 @@ switch ($EXT_LOAD_MODE)
                break;
 
        case 'update': // Update an extension
-               switch ($EXT_VER)
-               {
+               // Which version?
+               switch ($EXT_VER) {
                        case '0.0.1': // SQL queries for v0.0.1
                                // Update notes (these will be set as task text!)
                                EXT_SET_UPDATE_NOTES("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.");
@@ -108,7 +109,7 @@ switch ($EXT_LOAD_MODE)
                                // Is the cache extension itself there?
                                if (EXT_IS_ACTIVE('cache')) {
                                        // Check for cache when extension is already installed
-                                       if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
+                                       if ($GLOBALS['cache_instance']->loadCacheFile('extensions', true)) $GLOBALS['cache_instance']->destroyCacheFile();
                                } // END - if
 
                                // Update notes (these will be set as task text!)
@@ -237,26 +238,36 @@ switch ($EXT_LOAD_MODE)
                                // 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;
 
-                       case 'modify': // When the extension got modified
-                               break;
+       case 'modify': // When the extension got modified
+               break;
 
-                       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
-                               break;
+       case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+               break;
 
-                       default: // Do stuff when extension is loaded
-                               // Create instance on class
-                               if ($GLOBALS['cache_mode'] != 'init') {
-                                       // Initialize cache system only when it's needed
-                                       $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), "inc/".getConfig('cache_path'), getConfig('cache_tested'));
-                                       if ($GLOBALS['cache_instance']->getStatus() != 'done') {
-                                               // Failed to initialize cache sustem
-                                               addFatalMessage(__FILE__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_CANNOT_INITIALIZE'));
-                                       } // END - if
-                               } // END - if
-                               break;
+       default: // Do stuff when extension is loaded
+               // Create instance on class
+               if ($GLOBALS['cache_mode'] != 'init') {
+                       // Initialize cache system only when it's needed
+                       $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), 'inc/' . getConfig('cache_path'), getConfig('cache_tested'));
+                       if ($GLOBALS['cache_instance']->getStatus() != 'done') {
+                               // Failed to initialize cache sustem
+                               addFatalMessage(__FILE__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_CANNOT_INITIALIZE'));
+                       } // END - if
+               } // END - if
+               break;
 }
 
 // Keep this extension always active!