]> git.mxchange.org Git - mailer.git/commitdiff
Use rebuildCache() instead of loadCacheFile()/removeCacheFile()
authorRoland Häder <roland@mxchange.org>
Wed, 23 Jan 2013 20:37:06 +0000 (20:37 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 23 Jan 2013 20:37:06 +0000 (20:37 +0000)
inc/classes/cachesystem.class.php
inc/filter/cache_filter.php
inc/functions.php
inc/gen_sql_patches.php
inc/modules/admin/what-extensions.php
inc/mysql-manager.php

index 2408c751bc1e44566ce570aa0878cad380f29a2b..d9cf3418a39fedf98e33392d1efbcdeabedc0d68 100644 (file)
@@ -173,9 +173,9 @@ class CacheSystem {
                                        $GLOBALS['cache_array']['config'][$data['config']][$k] = $v;
                                } elseif ($this->name == 'filter') {
                                        // Filter
-                                       $GLOBALS['cache_array']['filter']['chains'][$data['filter_name']][$data['filter_function']] = $data['filter_active'];
+                                       $GLOBALS['cache_array']['filter']['chains'][$data['filter_name']][$data['filter_function']]  = $data['filter_active'];
                                        $GLOBALS['cache_array']['filter']['counter'][$data['filter_name']][$data['filter_function']] = $data['filter_counter'];
-                                       $GLOBALS['cache_array']['filter']['loaded'][$data['filter_name']][$data['filter_function']] = TRUE;
+                                       $GLOBALS['cache_array']['filter']['loaded'][$data['filter_name']][$data['filter_function']]  = TRUE;
                                } elseif ($this->name == 'modules') {
                                        // Modules
                                        $GLOBALS['cache_array']['modules'][$k][$data['module']] = $v;
index d675aa43bef46ab82edb495e5f5de5685609f864..706585fd49e40d3e2f6e59cc7017c613f12ac828 100644 (file)
@@ -50,11 +50,8 @@ function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($filterData) {
 
        // Remove cache
        foreach (array('config', 'extension', 'filter', 'modules', 'earning', 'points_data') as $cache) {
-               // Is this cache there?
-               if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
-                       // Yes, then remove it
-                       $GLOBALS['cache_instance']->removeCacheFile();
-               } // END - if
+               // Rebuild cache
+               rebuildCache($cache);
        } // END - foreach
 
        // Return it
@@ -71,9 +68,7 @@ function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE ($filterData) {
        } // END - if
 
        // Remove cache
-       if ($GLOBALS['cache_instance']->loadCacheFile('admin')) {
-               $GLOBALS['cache_instance']->removeCacheFile();
-       } // END - if
+       rebuildCache('admin');
 
        // Return the data
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
@@ -90,12 +85,8 @@ function FILTER_CACHE_DESTROY_ALL ($filterData) {
 
        // Remove cache files
        foreach (array('admin', 'admin_acls', 'config', 'extension', 'earning', 'filter', 'imprint', 'modules', 'payments', 'points_data', 'refdepths', 'refsystem', 'themes') as $cache) {
-               // Is the cache file readable?
-               // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
-               if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
-                       // Remove the cache file
-                       $GLOBALS['cache_instance']->removeCacheFile();
-               } // END - if
+               // Rebuild it
+               rebuildCache($cache);
        } // END - foreach
 
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
index 857d2c41b2f14cb955a368691463ee88f9e9651f..02e0b7a5e8656e43a35364df04cdf217b5f4579e 100644 (file)
@@ -1532,6 +1532,7 @@ function rebuildCache ($cache, $inc = '', $force = FALSE) {
        // Shall I remove the cache file?
        if ((isExtensionInstalled('cache')) && (isCacheInstanceValid()) && (isHtmlOutputMode())) {
                // Rebuild cache only in HTML output-mode
+               // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
                if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
                        // Destroy it
                        $GLOBALS['cache_instance']->removeCacheFile($force);
index 783124e1b48d57dfc63436aa25dd80090460837a..14158396a60b7650dde95a505a14ebac8064cf4a 100644 (file)
@@ -95,12 +95,9 @@ if (getFileHash() == '') {
 // @TODO Rewrite this to a filter
 if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isCacheInstanceValid())) {
        // Destroy some cache files
-       foreach (array('config', 'extension', 'filter', 'modules')  as $cache) {
-               // Is the cache file there?
-               if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
-                       // Then remove it
-                       $GLOBALS['cache_instance']->removeCacheFile();
-               } // END - if
+       foreach (array('config', 'extension', 'filter', 'modules') as $cache) {
+               // Use rebuildCache()
+               rebuildCache($cache);
        } // END - foreach
 } // END - if
 
index 233e9de414648a26a6e0a17cf15a5cb0d7fa0862..c18bd86ca0917405aef9c5c47be37c9bee85736a 100644 (file)
@@ -367,11 +367,8 @@ ORDER BY
                                                if (isExtensionActive('cache')) {
                                                        // Remove cache file (will be auto-created again!)
                                                        foreach (array('config', 'extension', 'filter', 'modules') as $cache) {
-                                                               // Is the cache file there?
-                                                               if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
-                                                                       // Remove cache file
-                                                                       $GLOBALS['cache_instance']->removeCacheFile();
-                                                               } // END - if
+                                                               // Rebuild cache file
+                                                               rebuildCache($cache);
                                                        } // END - foreach
                                                } // END - if
 
index 28ba603cfe196063e7e2302e87b53ce23212ba87..394189cc9f9876e29183068fcd48c12cce0f90f4 100644 (file)
@@ -843,6 +843,8 @@ function getActionFromModuleWhat ($module, $what) {
                                $module,
                                $what
                        ), __FUNCTION__, __LINE__);
+
+               // Entry found?
                if (SQL_NUMROWS($result) == 1) {
                        // Load action value and pray that this one is the right you want... ;-)
                        $data = SQL_FETCHARRAY($result);
@@ -2281,11 +2283,8 @@ function doGenericEditEntriesConfirm ($tableName, $columns = array(), $filterFun
                                continue;
                        } // END - if
 
-                       // Is the cache file loadable?
-                       if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
-                               // Then remove it
-                               $GLOBALS['cache_instance']->removeCacheFile();
-                       } // END - if
+                       // Use rebuildCache() to delete it
+                       rebuildCache($cache);
                } // END - foreach
        } // END - if