]> git.wh0rd.org Git - tt-rss.git/commitdiff
better debugging for matched filter rules
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Fri, 26 Aug 2016 11:45:34 +0000 (14:45 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Fri, 26 Aug 2016 11:45:34 +0000 (14:45 +0300)
include/rssfuncs.php

index cbd011e5c351a7c457969e3db7d460dcafa63917..32bc69819bf8a0fa0e059aa5044ca625403f2ed1 100644 (file)
 
                                /* Collect article tags here so we could filter by them: */
 
+                               $matched_rules = array();
+
                                $article_filters = get_article_filters($filters, $article["title"],
                                        $article["content"], $article["link"], 0, $article["author"],
-                                       $article["tags"]);
+                                       $article["tags"], $matched_rules);
 
                                if ($debug_enabled) {
-                                       _debug("article filters: ", $debug_enabled);
+                                       _debug("matched filter rules: ", $debug_enabled);
+
+                                       if (count($matched_rules) != 0) {
+                                               print_r($matched_rules);
+                                       }
+
+                                       _debug("filter actions: ", $debug_enabled);
+
                                        if (count($article_filters) != 0) {
                                                print_r($article_filters);
                                        }
 
                                if ($debug_enabled) {
                                        _debug("article labels:", $debug_enabled);
-                                       print_r($article_labels);
+
+                                       if (count($article_labels) != 0) {
+                                               print_r($article_labels);
+                                       }
                                }
 
                                _debug("force catchup: $entry_force_catchup");
                return $params;
        }
 
-       function get_article_filters($filters, $title, $content, $link, $timestamp, $author, $tags) {
+       function get_article_filters($filters, $title, $content, $link, $timestamp, $author, $tags, &$matched_rules = false) {
                $matches = array();
 
                foreach ($filters as $filter) {
                        if ($inverse) $filter_match = !$filter_match;
 
                        if ($filter_match) {
+                               if (is_array($matched_rules)) array_push($matched_rules, $rule);
+
                                foreach ($filter["actions"] AS $action) {
                                        array_push($matches, $action);