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:
committed by
Aparup Banerjee
parent
89ce191be2
commit
63fbf99e07
@@ -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
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user