X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-cache.php;h=8f384d5861dbd2a64c82932cb25002b3cceb7d73;hb=61b0b762e6128eca6d43cc9165571709af8af8ce;hp=9391294cc5c3c0ba5543bc4aa572268ae766d393;hpb=5071030af40e69ca4284642f44758964e18f5be8;p=mailer.git diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 9391294cc5..8f384d5861 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -44,14 +44,14 @@ 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) -{ - case 'register': // Do stuff when installation is running (modules.php?module=admin&action=login is called) +// 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"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD cache_path VARCHAR(255) NOT NULL DEFAULT 'cache/'"); @@ -64,16 +64,17 @@ switch ($EXT_LOAD_MODE) ADD_EXT_SQL("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `what` IN('config_cache','cache_stats')"); // Unregister all filters - UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run); - UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run); - UNREGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', true, $dry_run); - UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run); - UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', true, $dry_run); - UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run); - UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run); - UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run); - UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run); - UNREGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', true, $dry_run); + unregisterFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run); + unregisterFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run); + unregisterFilter('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', true, $dry_run); + unregisterFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run); + unregisterFilter('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', true, $dry_run); + unregisterFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run); + unregisterFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run); + 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."); @@ -216,14 +217,14 @@ switch ($EXT_LOAD_MODE) case '0.2.1': // SQL queries for v0.2.1 // Register the new filter - REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run); - REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run); - REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run); - REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); - REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); - REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); - REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); - REGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', false, true, $dry_run); + registerFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run); + registerFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run); + registerFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run); + registerFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); + registerFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); + registerFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); + registerFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run); + registerFilter('extension_remove', 'CACHE_DESTROY_ALL', false, true, $dry_run); // Update notes (these will be set as task text!) EXT_SET_UPDATE_NOTES("Filter für Erweiterungsmanagement hinzugefügt."); @@ -231,32 +232,42 @@ switch ($EXT_LOAD_MODE) case '0.2.2': // SQL queries for v0.2.2 // Register the new filter - REGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', false, true, $dry_run); - REGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', false, true, $dry_run); + registerFilter('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', false, true, $dry_run); + registerFilter('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', false, true, $dry_run); // 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__, "(".__LINE__."): ".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__, "(".__LINE__."): ".getMessage('CACHE_CANNOT_INITIALIZE')); + } // END - if + } // END - if + break; } // Keep this extension always active!