Fix for endless loop in outputHtml()
[mailer.git] / inc / filter-functions.php
index b8f8313e2fe270a3bed075db379f34d54614cf7b..ce4d30276ed5cd0a489b22483ba7da8fde0d818a 100644 (file)
@@ -49,15 +49,15 @@ function initFilterSystem () {
                debug_report_bug(getMessage('FILTER_FAILED_ALREADY_INIT'));
        } // END - if
 
-       // Init dummy array
-       $filterArray = array(
-               'chains'  => array(),
-               'loaded'  => array(),
-               'counter' => array()
-       );
-
        // Load all saved filers if sql_patches is updated
        if (isset($GLOBALS['cache_array']['filter']['filter_name'])) {
+               // Init dummy array
+               $filterArray = array(
+                       'chains'  => array(),
+                       'loaded'  => array(),
+                       'counter' => array()
+               );
+
                // Found in cache so rewrite the array
                foreach ($GLOBALS['cache_array']['filter']['filter_name'] as $idx => $filterName) {
                        // Get filter function
@@ -74,7 +74,7 @@ function initFilterSystem () {
 
                // Remove the cache
                $GLOBALS['cache_array']['filter'] = $filterArray;
-       } elseif (isExtensionInstalledAndNewer('sql_patches', '0.5.9')) {
+       } elseif ((!isInstallationPhase()) && (isExtensionInstalledAndNewer('sql_patches', '0.5.9'))) {
                // Init add
                $add = '';
                if (getExtensionVersion('sql_patches') >= '0.6.0') $add = ", `filter_counter`";
@@ -201,7 +201,7 @@ function registerFilter ($filterName, $filterFunction, $silentAbort = true, $for
                } // END - if
 
                // Simply add it to the array
-               //* DEBUG: */ print 'filterName='.$filterName.',filterFunction='.$filterFunction.'<br />';
+               //* DEBUG: */ print __FUNCTION__.': filterName='.$filterName.',filterFunction='.$filterFunction.'<br />';
                $GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'A';
                $GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = 0;
        } // END - if
@@ -224,6 +224,7 @@ function unregisterFilter ($filterName, $filterFunction, $force = false, $dry_ru
        // Shall we remove? (default, not while just showing an extension removal)
        if ($dry_run === false) {
                // Mark for filter removal
+               //* DEBUG: */ print __FUNCTION__.': filterName='.$filterName.',filterFunction='.$filterFunction.'<br />';
                $GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction] = 'R';
        } // END - if
 }
@@ -233,10 +234,10 @@ function runFilterChain ($filterName, $data = null) {
        // Is that filter chain there?
        if (!isset($GLOBALS['cache_array']['filter']['chains'][$filterName])) {
                // We should find all these non-existing filter chains
-               if ($filterName != 'sql_admin_extra_data') {
-                       /* Only for tracking: */ debug_report_bug('Filter chain <strong>' . $filterName . '</strong> not found!');
-               }
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!');
+               //* Only for tracking: */ if ($filterName != 'sql_admin_extra_data') {
+               //* Only for tracking: */ debug_report_bug('Filter chain <strong>' . $filterName . '</strong> not found!');
+               //* Only for tracking: */ }
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' not found!');
 
                // Abort here and return content
                return $data;