X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions%2Fext-cache.php;h=f024ebdb05ab89aeb993afb1e44cf671a1968fa4;hp=1028d3e617c94c033084a82d46ccb8771aaed55e;hb=e5527fd38a6585c8466dc28d013f12d21eb7c07a;hpb=8ff448fa64ce1b5f122339e224e596b101a2d4ab diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 1028d3e617..f024ebdb05 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -6,7 +6,7 @@ * -------------------------------------------------------------------- * * File : ext-cache.php * * -------------------------------------------------------------------- * - * Short description : Caching system for SQL tables on hard disc * + * Short description : Caching system for SQL tables on hard drive * * -------------------------------------------------------------------- * * Kurzbeschreibung : Caching-System zum Auslagern von SQL-Tabellen * * auf der Festplatte des Servers * @@ -15,12 +15,10 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -46,15 +44,15 @@ if (!defined('__SECURITY')) { // Version number setThisExtensionVersion('0.2.5'); -// Version history array (add more with , '0.1.0' and so on) -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')); +// Version history array (add more with , '0.0.1' and so on) +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')); // Keep this extension always active! setExtensionAlwaysActive('Y'); // Which load mode? switch (getExtensionMode()) { - case 'register': // Do stuff when installation is running (modules.php?module=admin is called) + case 'setup': // Do stuff when installation is running break; case 'remove': // Do stuff when removing extension @@ -62,15 +60,15 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN('cache_stats','config_config')"); // Unregister all filters - unregisterFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, isExtensionDryRun()); - unregisterFilter('extension_remove', 'CACHE_DESTROY_ALL', true, isExtensionDryRun()); - unregisterFilter('shutdown', 'CACHE_DESTROY_FILTER', true, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_form_submited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_form_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'post_form_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'extension_remove', 'CACHE_DESTROY_ALL', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'shutdown', 'CACHE_DESTROY_FILTER', TRUE, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension @@ -102,14 +100,8 @@ switch (getExtensionMode()) { break; case '0.0.4': // SQL queries for v0.0.4 - // Is the cache extension itself there? - if (isExtensionActive('cache')) { - // Check for cache when extension is already installed - if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile(); - } // END - if - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("Spalte "keep_active" ist hinzugefügt. Cache wurde reinitialisiert."); + setExtensionUpdateNotes("Spalte "keep_active" ist hinzugefügt."); break; case '0.0.5': // SQL queries for v0.0.5 @@ -123,8 +115,8 @@ switch (getExtensionMode()) { break; case '0.0.7': // SQL queries for v0.0.7 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD db_hits BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD cache_hits BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigAddSql('db_hits', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); + addConfigAddSql('cache_hits', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); addAdminMenuSql('stats','cache_stats','DB-Cache','Auf Cache und gesamte Datenbank registrierte Anfragen anzeigen.', 4); // Update notes (these will be set as task text!) @@ -192,23 +184,20 @@ switch (getExtensionMode()) { break; case '0.2.0': // SQL queries for v0.2.0 - // This update depends on sql_patches - addExtensionUpdateDependency('sql_patches'); - // Update notes (these will be set as task text!) setExtensionUpdateNotes("Die Erweiterung hängt nun von der sql_patches ab."); break; case '0.2.1': // SQL queries for v0.2.1 // Register the new filter - registerFilter('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, isExtensionDryRun()); - registerFilter('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, isExtensionDryRun()); - registerFilter('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, isExtensionDryRun()); - registerFilter('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, isExtensionDryRun()); - registerFilter('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, isExtensionDryRun()); - registerFilter('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, isExtensionDryRun()); - registerFilter('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, isExtensionDryRun()); - registerFilter('extension_remove', 'CACHE_DESTROY_ALL', false, true, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'post_form_submited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'post_form_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'post_form_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'extension_remove', 'CACHE_DESTROY_ALL', FALSE, TRUE, isExtensionDryRun()); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Filter für Erweiterungsmanagement hinzugefügt."); @@ -220,13 +209,13 @@ switch (getExtensionMode()) { break; case '0.2.3': // SQL queries for v0.2.3 - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD cache_filter ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + addConfigAddSql('cache_filter', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Cachen von Filtern hinzugefügt."); // Register a new filter - registerFilter('shutdown', 'CACHE_DESTROY_FILTER', false, true, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'shutdown', 'CACHE_DESTROY_FILTER', FALSE, TRUE, isExtensionDryRun()); break; case '0.2.4': // SQL queries for v0.2.4 @@ -234,14 +223,14 @@ switch (getExtensionMode()) { addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_cache' LIMIT 1"); // Remove config entries - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_themes`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_admins`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_acls`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_exts`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_config`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_modreg`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_refdepth`"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `cache_refsys`"); + addConfigDropSql('cache_themes'); + addConfigDropSql('cache_admins'); + addConfigDropSql('cache_acls'); + addConfigDropSql('cache_exts'); + addConfigDropSql('cache_config'); + addConfigDropSql('cache_modreg'); + addConfigDropSql('cache_refdepth'); + addConfigDropSql('cache_refsys'); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Der Cache hat keine Konfiguration mehr."); @@ -251,22 +240,22 @@ switch (getExtensionMode()) { // Update notes (these will be set as task text!) setExtensionUpdateNotes("Daten von gefundenen Sprachdateien werden zu den Erweiterungen gecacht."); break; - } + } // END - switch 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. + case 'test': // For testing purposes break; case 'init': // Do stuff when extension is initialized break; default: // Unknown extension mode - logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName())); + reportBug(__FILE__, __LINE__, sprintf('Unknown extension mode %s in extension %s detected.', getExtensionMode(), getCurrentExtensionName())); break; -} +} // END - switch // [EOF] ?>