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

Conflicts:
	lib/db/upgrade.php
	version.php

Conflicts:
	version.php
This commit is contained in:
Andrew Davis
2012-08-28 10:41:02 +08:00
committed by Aparup Banerjee
parent 89ce191be2
commit 63fbf99e07
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -7149,5 +7149,15 @@ FROM
upgrade_main_savepoint(true, 2011120504.05);
}
if ($oldversion < 2011120504.11) {
$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, 2011120504.11);
}
return true;
}
+1 -1
View File
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2011120504.10; // 20111205 = branching date YYYYMMDD - do not modify!
$version = 2011120504.11; // 20111205 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches
// .XX = incremental changes