]> git.mjollnir.org Git - s9y.git/commitdiff
Let remoteRSS plugin fetch cache if it failed and not write empty caches.
authorgarvinhicking <garvinhicking>
Sun, 24 Jul 2005 11:38:00 +0000 (11:38 +0000)
committergarvinhicking <garvinhicking>
Sun, 24 Jul 2005 11:38:00 +0000 (11:38 +0000)
Thanks to Flo Solcher!

plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php

index 9717678be6dbc03e1080856344c528af03a81f11..c30d82fa21370a79ac8666831e70cc0d3b248677 100644 (file)
@@ -23,7 +23,7 @@ switch ($serendipity['lang']) {
         @define('PLUGIN_REMOTERSS_RSSTARGET_BLAHBLAH', 'Target des Links zu einem der angezeigten RSS-Einträge (Standard: _blank)');
         @define('PLUGIN_REMOTERSS_NOURI', 'Kein RSS/OPML-Feed gewählt');
         @define('PLUGIN_REMOTERSS_CACHETIME', 'Wann wird der Feed aktualisiert?');
-        @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'Die Inhalte des fremden Feeds werden gecached. Sobald der Cache älter ist als X Minuten wird er aktualisiert (Standard: 3 Stunden)');
+        @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'Die Inhalte des fremden Feeds werden gecached. Sobald der Cache älter ist als X Sekunden wird er aktualisiert (Standard: 3 Stunden)');
         @define('PLUGIN_REMOTERSS_FEEDTYPE', 'Typ des Feeds');
         @define('PLUGIN_REMOTERSS_FEEDTYPE_BLAHBLAH', 'Wählen Sie das Format des einzubindenden Feeds');
         @define('PLUGIN_REMOTERSS_BULLETIMG', 'Bullet Image');
@@ -48,7 +48,7 @@ switch ($serendipity['lang']) {
         @define('PLUGIN_REMOTERSS_RSSTARGET', 'RSS/OPML linktarget');
         @define('PLUGIN_REMOTERSS_RSSTARGET_BLAHBLAH', 'Target of the link to one of the displayed RSS items (Default: _blank)');
         @define('PLUGIN_REMOTERSS_CACHETIME', 'When to update the feed?');
-        @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'The contents of a feed are stored in a cache which will be updated as soon as its older than X minutes (Default: 3 hours)');
+        @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'The contents of a feed are stored in a cache which will be updated as soon as its older than X seconds (Default: 3 hours)');
         @define('PLUGIN_REMOTERSS_FEEDTYPE', 'Feedtype');
         @define('PLUGIN_REMOTERSS_FEEDTYPE_BLAHBLAH', 'Choose the format of the remote Feed');
         @define('PLUGIN_REMOTERSS_BULLETIMG', 'Bullet Image');
@@ -292,7 +292,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
         $propbag->add('description',   PLUGIN_REMOTERSS_BLAHBLAH);
         $propbag->add('stackable',     true);
         $propbag->add('author',        'Udo Gerhards, Richard Thomas Harrison');
-        $propbag->add('version',       '1.2');
+        $propbag->add('version',       '1.3');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -461,11 +461,14 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
                     }
 
                     $fp = @fopen($feedcache, 'w');
-                    if ($fp) {
+                    if (trim($content) != '' && $fp) {
                         fwrite($fp, $content);
                         fclose($fp);
                     } else {
                         echo '<!-- Cache failed to ' . $feedcache . ' in ' . getcwd() . ' --><br />';
+                        if (trim($content) == '') {
+                            $content = @file_get_contents($feedcache);
+                        }
                     }
                 } elseif ($feedtype == 'opml') {
                     $opml = new s9y_remoterss_OPML();
@@ -528,13 +531,15 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
                         }
 
                         $fp = @fopen($feedcache, 'w');
-                        if ($fp) {
+                        if (trim($content) != '' && $fp) {
                             fwrite($fp, $content);
                             fclose($fp);
                         } else {
                             echo '<!-- Cache failed to ' . $feedcache . ' in ' . getcwd() . ' --><br />';
+                            if (trim($content) == '') {
+                                $content = @file_get_contents($feedcache);
+                            }
                         }
-
                     } else {
                         echo '<!-- Not a valid OPML feed -->';
                     }