]> git.mxchange.org Git - mailer.git/commitdiff
Introduced some wrapper functions, the extension for cache files is now .cache.php...
authorRoland Haeder <roland@mxchange.org>
Tue, 8 Apr 2014 19:11:57 +0000 (21:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 8 Apr 2014 19:11:57 +0000 (21:11 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
.gitignore
inc/classes/cachesystem.class.php
inc/config-global.php
inc/filters.php
inc/gen_sql_patches.php
inc/template-functions.php
inc/wrapper-functions.php

index 6fa01dbc2b29e3852017543b85a6cf703a62168e..7a1324326ae172427b67d16abf9ecbc4f28b1c2b 100644 (file)
@@ -7,6 +7,7 @@ DOCS/doxygen/*.tmp
 DOCS/doxygen/html
 inc/.secret
 inc/cache/*.cache
+inc/cache/*.cache.php
 inc/cache/*.log
 inc/cache/*.rss
 inc/cache/.revision
index 6a2ca4e134f3b5da2fade398992f99f361e7bdf7..a5ea7261d17157cb62921364226888ab37f7c4fe 100644 (file)
@@ -62,13 +62,16 @@ class CacheSystem {
        var $rebuilt = array();
 
        // File extension
-       var $extension = '.cache';
+       var $extension = '';
        var $status = array();
        var $readable = array();
        var $fullPath = '';
 
        // Constructor
        function CacheSystem () {
+               // Set extension
+               $this->extension = getCacheExtension();
+
                // Construct full path
                $this->fullPath = getPath() . getCachePath();
 
index 37b8adebacb918b0023de21a4a9ceab8f0169e5a..a493b1a926267bf599fbb08da1bdce2570856fb0 100644 (file)
@@ -102,11 +102,14 @@ setConfigEntry('AUTHOR' , 'Roland H&auml;der');
 setConfigEntry('TITLE', 'Mailer-Project');
 
 // CFG: COPY
-setConfigEntry('COPY', 'Copyright &copy; 2003 - 2009, by Roland H&auml;der,<br />2009 - 2013 by Mailer Developer Team');
+setConfigEntry('COPY', 'Copyright &copy; 2003 - 2009, by Roland H&auml;der,<br />2009 - 2014 by Mailer Developer Team');
 
 // CFG: CACHE-PATH
 setConfigEntry('CACHE_PATH', 'inc/cache/');
 
+// CFG: CACHE-EXTENSION
+setConfigEntry('CACHE_EXTENSION', '.cache.php');
+
 // CFG: INTERNAL-STATS (This setting is overwritten by ext-other equal and prior version 0.2.7)
 setConfigEntry('internal_stats', 'N');
 
index 239d9048c122537fc62ad0e6d9cfe67b10feb4b6..15f5c00d4622b5ce1ee73de52d3dc7d393db777f 100644 (file)
@@ -1296,7 +1296,7 @@ function FILTER_GENERATE_FILE_SECRET_HASH ($filterData) {
        setConfigEntry('secret_key', '');
 
        // File hash was generated so we can also file the secret file... hopefully.
-       $hashFile = sprintf('%s%s.%s.cache', getPath(), getCachePath(), getFileHash());
+       $hashFile = getGenericHashFileName();
 
        // Read key from secret file
        if ((getFileHash() == '') || (getMasterSalt() == '') || (getPassScramble() == '') || (!isFileReadable($hashFile))) {
@@ -1304,7 +1304,7 @@ function FILTER_GENERATE_FILE_SECRET_HASH ($filterData) {
                loadIncludeOnce('inc/gen_sql_patches.php');
 
                // Generate file name again
-               $hashFile = sprintf('%s%s.%s.cache', getPath(), getCachePath(), getFileHash());
+               $hashFile = getGenericHashFileName();
        } // END - if
 
        // Test again
index b2b984b4e59cb36d146d06ce7fecc76eee3d6c38..1e3f278d58127d0c9418dd1fe310293b86a2bd0d 100644 (file)
@@ -65,13 +65,14 @@ if (getMasterSalt() == '') {
        unset($masterSalt);
 } // END - if
 
-if ((getFileHash() == '') || (!isFileReadable(getPath() . getCachePath() . '.' . getFileHash() . '.cache'))) {
+if ((getFileHash() == '') || (!isFileReadable(getGenericHashFileName()))) {
        // Create filename from hashed random string
        $fileHash = sha1(generatePassword(mt_rand(128, 256)));
-       $FQFN = sprintf('%s%s.%s.cache',
+       $FQFN = sprintf('%s%s.%s%s',
                getPath(),
                getCachePath(),
-               $fileHash
+               $fileHash,
+               getCacheExtension()
        );
 
        // Generate secret key from a randomized string
index 70ffd792b14765771d5d400daa6a14eb4e8e839c..56eb35dc84976691bda8398d795bee11c005783d 100644 (file)
@@ -1931,10 +1931,11 @@ function generateCacheFqfn ($prefix, $template) {
        if (!isset($GLOBALS['template_cache_fqfn'][$prefix][$template])) {
                // Generate the FQFN
                $GLOBALS['template_cache_fqfn'][$prefix][$template] = sprintf(
-                       '%s_compiled/%s/%s.tpl.cache',
+                       '%s_compiled/%s/%s.tpl%s',
                        getCachePath(),
                        $prefix,
-                       $template
+                       $template,
+                       getCacheExtension()
                );
        } // END - if
 
index e20a4abd2139350827cf4f5e69ec2794cb233cc5..b315b3cb68f983d584eaede755498df46434deb6 100644 (file)
@@ -1793,6 +1793,18 @@ function getCachePath () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// "Getter" for cache_extension
+function getCacheExtension () {
+       // Is there cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('CACHE_EXTENSION');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // "Getter" for WRITE_FOOTER
 function getWriteFooter () {
        // Is there cache?
@@ -3578,5 +3590,11 @@ function convertApiResponseToArray ($responseString, $keyDelimiter, $valueDelimi
        return $returned;
 }
 
+// Getter for full (generic) hash file name
+function getGenericHashFileName () {
+       // Return result
+       return sprintf('%s%s.%s%s', getPath(), getCachePath(), getFileHash(), getCacheExtension());
+}
+
 // [EOF]
 ?>