blog MDL-20617 adding checking for deleted blog posts
authorandyjdavis <andrew@moodle.com>
Mon, 20 Dec 2010 03:16:11 +0000 (11:16 +0800)
committerandyjdavis <andrew@moodle.com>
Mon, 20 Dec 2010 03:16:11 +0000 (11:16 +0800)
blog/lib.php

index e476d01..647e357 100644 (file)
@@ -163,6 +163,8 @@ function blog_sync_external_entries($externalblog) {
     if (empty($rss->data)) {
         return null;
     }
+    
+    $oldesttimestamp = null;
 
     foreach ($rss->get_items() as $entry) {
         // If filtertags are defined, use them to filter the entries by RSS category
@@ -220,6 +222,11 @@ function blog_sync_external_entries($externalblog) {
             $newentry->created = $timestamp;
         }
         $newentry->lastmodified = $timestamp;
+        
+        if (empty($oldesttimestamp) || $timestamp<$oldesttimestamp) {
+            //found an older post
+            $oldesttimestamp = $timestamp;
+        }
 
         $textlib = textlib_get_instance();
         if ($textlib->strlen($newentry->uniquehash) > 255) {