]> git.wh0rd.org - tt-rss.git/commitdiff
attempt to recalculate favicon avg color if it changes
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 23 Apr 2013 18:33:23 +0000 (22:33 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 23 Apr 2013 18:33:23 +0000 (22:33 +0400)
include/rssfuncs.php

index 8bc5fcbd8003e96d8feb3a43d668305e83856b43..bc054ca52399465ac9d1343a5ad656b012f7cd8e 100644 (file)
                        if ($favicon_needs_check || $force_refetch) {
 
                                /* terrible hack: if we crash on floicon shit here, we won't check
-                                * the icon avgcolor again */
+                                * the icon avgcolor again (unless the icon got updated) */
 
                                db_query("UPDATE ttrss_feeds SET favicon_avg_color = 'fail' WHERE
                                        id = '$feed'");
 
+                               $favicon_file = ICONS_DIR . "/$feed.ico";
+                               $favicon_modified = @filemtime($favicon_file);
+
                                _debug("checking favicon...", $debug_enabled);
 
                                check_feed_favicon($site_url, $feed, $link);
-                               $favicon_file = ICONS_DIR . "/$feed.ico";
+                               $favicon_modified_new = @filemtime($favicon_file);
+
+                               if ($favicon_modified_new > $favicon_modified)
+                                       $favicon_avg_color = '';
 
                                if (file_exists($favicon_file) && function_exists("imagecreatefromstring") && $favicon_avg_color != 'fail') {
                                                require_once "colors.php";