]> git.mxchange.org Git - mailer.git/commitdiff
Caching of themes (fully supported) and admin menu (experimental!) now configurable
authorRoland Häder <roland@mxchange.org>
Tue, 16 Sep 2008 14:42:04 +0000 (14:42 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 16 Sep 2008 14:42:04 +0000 (14:42 +0000)
inc/databases.php
inc/extensions/ext-cache.php
inc/language/cache_de.php
inc/libs/cache_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_cache.php
templates/de/html/admin/admin_config_cache.tpl

index 102465d19ac7498958139e35378c1aff9bdf5ef8..2cb23a81af6bad46d94828e2c1033b95d9c09bcb 100644 (file)
@@ -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);
index cc8114cce85df9257bf6f807a301285cbc7519a8..b5c5977bfe6f4e86c0ffcc2409890ad5724e44c9 100644 (file)
@@ -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&uuml; 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);
                }
index 3dcf19a7d91617cf9a0086126ff82b42c33681fd..20bdf2c0d6659010078b20a6d10d0c81a26bb798 100644 (file)
@@ -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 <STRONG>"._MYSQL_
 define('ADMIN_CACHE_MODREG', "Soll der Zugriff auf die Tabelle <STRONG>"._MYSQL_PREFIX."_mod_reg</STRONG> beschleunigt werden?");
 define('ADMIN_CACHE_REFDEPTH', "Soll der Zugriff auf die Tabelle <STRONG>"._MYSQL_PREFIX."_refdepths</STRONG> beschleunigt werden?");
 define('ADMIN_CACHE_REFSYS', "Soll der Zugriff auf die Tabelle <STRONG>"._MYSQL_PREFIX."_refsystem</STRONG> beschleunigt werden?");
+define('ADMIN_CACHE_THEMES', "Soll der Zugriff auf die Tabelle <STRONG>"._MYSQL_PREFIX."_themes</STRONG> beschleunigt werden?");
+define('ADMIN_CACHE_ADMIN_MENU', "Soll der Aufbau des Administratormen&uuml;s beschleunigt werden (EXPERIMENTELL!)?");
 define('ADMIN_CACHE_PATH', "Relativer Pfad f&uuml;r alle Cache-Dateien zum Pfad <STRONG>inc</STRONG>");
 
 //
index 81b65c436bf598a1d3f6d6c58fcaefb4fd49d84e..44df62bedea920e5cb094042077a2d09bdfc163a 100644 (file)
@@ -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;
+       }
 }
 //
 ?>
index 8060c156aa8bed72cbda7bd869ada17a563abf34..ebf2b0e3caba251d4c141eed40166ac957c60b57 100644 (file)
@@ -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);
 
index 4f90be08654ac6b54d26a4cbb9509c5df49d6f3d..6f0a5f4a0659a358093654f35514b2799367884b 100644 (file)
@@ -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
index 356d39ea0727d135231a8770284e5140cdbf9f6a..15c7654640c2e4eb55c7ddb3099a5f65334145b8 100644 (file)
        <TR>
                <TD colspan="2" class="seperator" height="10">&nbsp;</TD>
        </TR>
+       <TR>
+               <TD align="right" width="350" height="20">
+               {--ADMIN_CACHE_THEMES--}</TD>
+               <TD width="150" style="padding-left: 10px"><INPUT type="radio"
+                       name="cache_themes" value="Y" class="admin_normal"{!__THEMES_Y!}>&nbsp;{--YES--}
+               <INPUT type="radio" name="cache_themes" value="N" class="admin_normal"{!__THEMES_N!}>&nbsp;{--NO--}&nbsp;
+               </TD>
+       </TR>
+       <TR>
+               <TD colspan="2" class="seperator" height="10">&nbsp;</TD>
+       </TR>
+       <TR>
+               <TD align="right" width="350" height="20">
+               {--ADMIN_CACHE_ADMIN_MENU--}</TD>
+               <TD width="150" style="padding-left: 10px"><INPUT type="radio"
+                       name="cache_admin_menu" value="Y" class="admin_normal"{!__ADMIN_MENU_Y!}>&nbsp;{--YES--}
+               <INPUT type="radio" name="cache_admin_menu" value="N" class="admin_normal"{!__ADMIN_MENU_N!}>&nbsp;{--NO--}&nbsp;
+               </TD>
+       </TR>
+       <TR>
+               <TD colspan="2" class="seperator" height="10">&nbsp;</TD>
+       </TR>
        <TR>
                <TD align="right" width="350" height="20">
                {--ADMIN_CACHE_PATH--}:</TD>