From: Roland Häder Date: Tue, 16 Sep 2008 14:42:04 +0000 (+0000) Subject: Caching of themes (fully supported) and admin menu (experimental!) now configurable X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=ec5bcdd7331073503aff5742884785b2fdd498e3 Caching of themes (fully supported) and admin menu (experimental!) now configurable --- diff --git a/inc/databases.php b/inc/databases.php index 102465d19a..2cb23a81af 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "338"); +define('CURR_SVN_REVISION', "339"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index cc8114cce8..b5c5977bfe 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -39,13 +39,13 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.1.8"; +$EXT_VERSION = "0.1.9"; // Auto-set extension version if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; // Version history array (add more with , "0.1" and so on) -$EXT_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"); +$EXT_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"); switch ($EXT_LOAD_MODE) { @@ -178,11 +178,18 @@ case "update": // Update an extension break; case "0.1.8": // SQL queries for v0.1.8 - $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD cache_theme ENUM('Y','N') NOT NULL DEFAULT 'Y'"; + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD cache_themes ENUM('Y','N') NOT NULL DEFAULT 'Y'"; // Update notes (these will be set as task text!) $UPDATE_NOTES = "Daten von installierten Themes werden nun gecacht."; break; + + case "0.1.9": // SQL queries for v0.1.9 + $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD cache_admin_menu ENUM('Y','N') NOT NULL DEFAULT 'N'"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Administratormenü experimentell gecacht."; + break; } break; @@ -191,7 +198,7 @@ default: // Do stuff when extension is loaded if ($cacheMode != "init") { // Initialize cache system only when it's needed $cacheInstance = new mxchange_cache($_CONFIG['cache_update'], PATH."inc/".$_CONFIG['cache_path'], $_CONFIG['cache_tested']); - if ($cacheInstance->ret != "done") { + if ($cacheInstance->getStatus() != "done") { // Failed to initialize cache sustem ADD_FATAL(__FILE__."(".__LINE__."): ".CACHE_CANNOT_INITIALIZE); } diff --git a/inc/language/cache_de.php b/inc/language/cache_de.php index 3dcf19a7d9..20bdf2c0d6 100644 --- a/inc/language/cache_de.php +++ b/inc/language/cache_de.php @@ -32,8 +32,7 @@ ************************************************************************/ // Some security stuff... -if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) -{ +if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); } @@ -61,6 +60,8 @@ define('ADMIN_CACHE_CONFIG', "Soll der Zugriff auf die Tabelle "._MYSQL_ define('ADMIN_CACHE_MODREG', "Soll der Zugriff auf die Tabelle "._MYSQL_PREFIX."_mod_reg beschleunigt werden?"); define('ADMIN_CACHE_REFDEPTH', "Soll der Zugriff auf die Tabelle "._MYSQL_PREFIX."_refdepths beschleunigt werden?"); define('ADMIN_CACHE_REFSYS', "Soll der Zugriff auf die Tabelle "._MYSQL_PREFIX."_refsystem beschleunigt werden?"); +define('ADMIN_CACHE_THEMES', "Soll der Zugriff auf die Tabelle "._MYSQL_PREFIX."_themes beschleunigt werden?"); +define('ADMIN_CACHE_ADMIN_MENU', "Soll der Aufbau des Administratormenüs beschleunigt werden (EXPERIMENTELL!)?"); define('ADMIN_CACHE_PATH', "Relativer Pfad für alle Cache-Dateien zum Pfad inc"); // diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index 81b65c436b..44df62bede 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -52,11 +52,14 @@ class mxchange_cache // Constructor function mxchange_cache($interval, $path, $tested) { + // Failed is the default + $this->ret = "failed"; + // Remember interval in class - $this->update_interval=$interval; + $this->update_interval = $interval; // Remeber path - $this->cache_path=$path; + $this->cache_path = $path; // Check if path exists if ((is_dir($path)) && (!$tested)) { @@ -72,22 +75,16 @@ class mxchange_cache UPDATE_CONFIG("cache_tested", 1); // All done! - return "done"; + $this->ret = "done"; } else { // Stop! Set a .htaccess file first - $this->ret="htaccess"; - return "htaccess"; + $this->ret = "htaccess"; } } } elseif ($tested) { // System already tested - $this->ret="done"; - return "done"; + $this->ret = "done"; } - - // Something goes wrong here! - $this->ret="failed"; - return "failed"; } function cache_file($file, $ignore_ctime=false) { @@ -390,6 +387,10 @@ class mxchange_cache // Return line return $line; } + + function getStatus () { + return $this->ret; + } } // ?> diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 8060c156aa..ebf2b0e3ca 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -390,7 +390,7 @@ LIMIT 1", array($act, $wht, $wht), __FILE__, __LINE__); } // function ADD_ADMIN_MENU($act, $wht, $return=false) { - global $menuDesription, $menuTitle, $cacheInstance; + global $menuDesription, $menuTitle, $cacheInstance, $_CONFIG; // Init variables $SUB = false; @@ -401,7 +401,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { $menuTitle = array(); // Is there a cache instance? - if (is_object($cacheInstance)) { + if ((is_object($cacheInstance)) && (isset($_CONFIG['cache_admin_menu'])) && ($_CONFIG['cache_admin_menu'] == "Y")) { // Create cache name $cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login')); @@ -555,7 +555,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { eval($eval); // Is there a cache instance again? - if (is_object($cacheInstance)) { + if ((is_object($cacheInstance)) && (isset($_CONFIG['cache_admin_menu'])) && ($_CONFIG['cache_admin_menu'] == "Y")) { // Init cache $cacheInstance->cache_init($cacheName); diff --git a/inc/modules/admin/what-config_cache.php b/inc/modules/admin/what-config_cache.php index 4f90be0865..6f0a5f4a06 100644 --- a/inc/modules/admin/what-config_cache.php +++ b/inc/modules/admin/what-config_cache.php @@ -88,41 +88,42 @@ if (isset($_POST['ok'])) else { // Prepare data - switch ($_CONFIG['cache_admins']) - { + switch ($_CONFIG['cache_admins']) { case 'Y': define('__ADMINS_Y', " checked"); define('__ADMINS_N', ""); break; case 'N': define('__ADMINS_Y', ""); define('__ADMINS_N', " checked"); break; } - switch ($_CONFIG['cache_acls']) - { + switch ($_CONFIG['cache_acls']) { case 'Y': define('__ACLS_Y', " checked"); define('__ACLS_N', ""); break; case 'N': define('__ACLS_Y', ""); define('__ACLS_N', " checked"); break; } - switch ($_CONFIG['cache_exts']) - { + switch ($_CONFIG['cache_exts']) { case 'Y': define('__EXTS_Y', " checked"); define('__EXTS_N', ""); break; case 'N': define('__EXTS_Y', ""); define('__EXTS_N', " checked"); break; } - switch ($_CONFIG['cache_config']) - { + switch ($_CONFIG['cache_config']) { case 'Y': define('__CONFIG_Y', " checked"); define('__CONFIG_N', ""); break; case 'N': define('__CONFIG_Y', ""); define('__CONFIG_N', " checked"); break; } - switch ($_CONFIG['cache_modreg']) - { + switch ($_CONFIG['cache_modreg']) { case 'Y': define('__MODREG_Y', " checked"); define('__MODREG_N', ""); break; case 'N': define('__MODREG_Y', ""); define('__MODREG_N', " checked"); break; } - switch ($_CONFIG['cache_refdepth']) - { + switch ($_CONFIG['cache_refdepth']) { case 'Y': define('__REFDEPTH_Y', " checked"); define('__REFDEPTH_N', ""); break; case 'N': define('__REFDEPTH_Y', ""); define('__REFDEPTH_N', " checked"); break; } - switch ($_CONFIG['cache_refsys']) - { + switch ($_CONFIG['cache_refsys']) { case 'Y': define('__REFSYS_Y', " checked"); define('__REFSYS_N', ""); break; case 'N': define('__REFSYS_Y', ""); define('__REFSYS_N', " checked"); break; } + switch ($_CONFIG['cache_themes']) { + case 'Y': define('__THEMES_Y', " checked"); define('__THEMES_N', ""); break; + case 'N': define('__THEMES_Y', ""); define('__THEMES_N', " checked"); break; + } + switch ($_CONFIG['cache_admin_menu']) { + case 'Y': define('__ADMIN_MENU_Y', " checked"); define('__ADMIN_MENU_N', ""); break; + case 'N': define('__ADMIN_MENU_Y', ""); define('__ADMIN_MENU_N', " checked"); break; + } define('__PATH', $_CONFIG['cache_path']); // Load template diff --git a/templates/de/html/admin/admin_config_cache.tpl b/templates/de/html/admin/admin_config_cache.tpl index 356d39ea07..15c7654640 100644 --- a/templates/de/html/admin/admin_config_cache.tpl +++ b/templates/de/html/admin/admin_config_cache.tpl @@ -86,6 +86,28 @@   + + + {--ADMIN_CACHE_THEMES--} +  {--YES--} +  {--NO--}  + + + +   + + + + {--ADMIN_CACHE_ADMIN_MENU--} +  {--YES--} +  {--NO--}  + + + +   + {--ADMIN_CACHE_PATH--}: