Skip to content

Commit

Permalink
MDL-26010 External blog synchronization removes non-relevant post rec…
Browse files Browse the repository at this point in the history
…ords
  • Loading branch information
andyjdavis authored and mudrd8mz committed Feb 18, 2011
1 parent 99faefb commit 42291c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blog/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ function blog_sync_external_entries($externalblog) {
//Look at the posts we have in the database to check if any of them have been deleted from the feed.
//Only checking posts within the time frame returned by the rss feed. Older items may have been deleted or
//may just not be returned anymore. We cant tell the difference so we leave older posts alone.
$dbposts = $DB->get_records_select('post', 'created > :ts', array('ts' => $oldesttimestamp), '', 'id, uniquehash');
$sql = "SELECT id, uniquehash FROM {post} WHERE ".$DB->sql_compare_text('content')." = :blogid AND module = 'blog_external' AND created > :ts";
$dbposts = $DB->get_records_sql($sql, array('blogid' => $externalblog->id, 'ts' => $oldesttimestamp));

$todelete = array();
foreach($dbposts as $dbpost) {
if ( !in_array($dbpost->uniquehash, $uniquehashes) ) {
Expand Down

0 comments on commit 42291c6

Please sign in to comment.