Skip to content
Permalink
Browse files

MDL-26504 blog: added upgrade code to remove orphan external blog posts

  • Loading branch information...
andyjdavis committed Aug 28, 2012
1 parent 4db11a2 commit f361678362dddc74552be117558281d29b506656
Showing with 10 additions and 1 deletion.
  1. +9 −0 lib/db/upgrade.php
  2. +1 −1 version.php
@@ -1119,6 +1119,15 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012081600.01);
}
if ($oldversion < 2012082300.01) {
$subquery = 'SELECT b.id FROM {blog_external} b where ' . $DB->sql_compare_text('b.id') . ' = ' . $DB->sql_compare_text('{post}.content');
$sql = 'DELETE FROM {post}
WHERE {post}.module = \'blog_external\'
AND NOT EXISTS (' . $subquery . ')
AND ' . $DB->sql_isnotempty('post', 'uniquehash', false, false);
$DB->execute($sql);
upgrade_main_savepoint(true, 2012082300.01);
}
return true;
}
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2012082300.00; // YYYYMMDD = weekly release date of this DEV branch
$version = 2012082300.01; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit f361678

Please sign in to comment.
You can’t perform that action at this time.