A lot bugfixes for ext-cache and deprecated files removed:
[mailer.git] / inc / functions.php
index 78bd0a85409b62f7ff3237993f4a7eeebe421db2..545a2f2eb41823b76000be5e197cb823262656a8 100644 (file)
@@ -2221,9 +2221,12 @@ function app_die ($F, $L, $message) {
                // Load header
                loadIncludeOnce('inc/header.php');
 
-               // Prepare message for output
+               // Rewrite message for output
                $message = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $message);
 
+               // Better log this message away
+               DEBUG_LOG($F, $L, $message);
+
                // Load the message template
                LOAD_TEMPLATE('admin_settings_saved', false, $message);
 
@@ -2458,25 +2461,37 @@ function getActualVersion ($type = 'Revision') {
 
        if (EXT_IS_ACTIVE('cache')) {
                // Check if REQUEST_GET('check_revision_data') is setted (switch for manually rewrite the .revision-File)
-               if (REQUEST_ISSET_GET('check_revision_data') && REQUEST_GET('check_revision_data') == 'yes') $new = true;
-               if (!isset($GLOBALS['cache_array']['revision'][$type])
-               || count($GLOBALS['cache_array']['revision']) < 3
-               || !$GLOBALS['cache_instance']->loadCacheFile('revision')) $new = true;
+               if (REQUEST_ISSET_GET('check_revision_data') && REQUEST_GET('check_revision_data') == 'yes') {
+                       // Force rebuild by URL parameter
+                       $new = true;
+               } elseif ((
+                       !isset($GLOBALS['cache_array']['revision'][$type])
+               ) || (
+                       count($GLOBALS['cache_array']['revision']) < 3
+               ) || (
+                       !$GLOBALS['cache_instance']->loadCacheFile('revision')
+               )) {
+                       // Out-dated cache
+                       $new = true;
+               } // END - if
 
                // Is the cache file outdated/invalid?
                if ($new === true){
-                       $GLOBALS['cache_instance']->destroyCacheFile(); // @TODO isn't it better to do $GLOBALS['cache_instance']->destroyCacheFile('revision')?
+                       // Destroy cache file
+                       $GLOBALS['cache_instance']->destroyCacheFile();
 
                        // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
                        unset($GLOBALS['cache_array']['revision']);
 
                        // Reload load_cach-revison.php
                        loadInclude('inc/loader/load_cache-revision.php');
+
+                       // Abort here
+                       return;
                } // END - if
 
                // Return found value
                return $GLOBALS['cache_array']['revision'][$type][0];
-
        } else {
                // Old Version without ext-cache active (deprecated ?)
 
@@ -2485,7 +2500,7 @@ function getActualVersion ($type = 'Revision') {
 
                // Check if REQUEST_GET('check_revision_data') is setted (switch for manually rewrite the .revision-File)
                if ((REQUEST_ISSET_GET('check_revision_data')) && (REQUEST_GET('check_revision_data') == 'yes')) {
-                       // Has changed!
+                       // Forced rebuild of .revision file
                        $new = true;
                } else {
                        // Check for revision file
@@ -2628,7 +2643,7 @@ function debug_report_bug ($message = '') {
        } // END - if
 
        // Add output
-       $debug .= "Please report this bug at <a title=\"Direct link to the bug-tracker\" href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a> and include the logfile from <strong>inc/cache/debug.log</strong> in your report (you cannot attach files!):<pre>";
+       $debug .= "Please report this bug at <a title=\"Direct link to the bug-tracker\" href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a> and include the logfile from <strong>inc/cache/debug.log</strong> in your report (you can now attach files):<pre>";
        $debug .= debug_get_printable_backtrace();
        $debug .= "</pre>\nRequest-URI: " . $_SERVER['REQUEST_URI']."<br />\n";
        $debug .= "Thank you for finding bugs.";
@@ -3269,7 +3284,7 @@ function isUserIdSet () {
 // Handle message codes from URL
 function handleCodeMessage () {
        if (REQUEST_ISSET_GET('msg')) {
-               // Default extension is "unknown"
+               // Default extension is 'unknown'
                $ext = 'unknown';
 
                // Is extension given?