Skip to content
Permalink
Browse files

Merge branch 'MDL-26504_blog_unregister' of git://github.com/andyjdav…

…is/moodle

Conflicts:
	lib/db/upgrade.php
	version.php
  • Loading branch information...
Aparup Banerjee
Aparup Banerjee committed Sep 4, 2012
2 parents b5b82ae + f361678 commit 736cc6a24691634468d578fe88881e4dd24a7347
Showing with 20 additions and 1 deletion.
  1. +9 −0 blog/external_blogs.php
  2. +10 −0 lib/db/upgrade.php
  3. +1 −1 version.php
@@ -44,7 +44,16 @@
if ($delete && confirm_sesskey()) {
$externalbloguserid = $DB->get_field('blog_external', 'userid', array('id' => $delete));
if ($externalbloguserid == $USER->id) {
// Delete the external blog
$DB->delete_records('blog_external', array('id' => $delete));
// Delete the external blog's posts
$deletewhere = 'module = :module
AND userid = :userid
AND ' . $DB->sql_isnotempty('post', 'uniquehash', false, false) . '
AND ' . $DB->sql_compare_text('content') . ' = ' . $DB->sql_compare_text(':delete');
$DB->delete_records_select('post', $deletewhere, array('module' => 'blog_external', 'userid' => $USER->id, 'delete' => $delete));
$message = get_string('externalblogdeleted', 'blog');
}
}
@@ -1184,5 +1184,15 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012082300.02);
}
if ($oldversion < 2012090400.00) {
$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, 2012090400.00);
}
return true;
}
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2012083100.00; // YYYYMMDD = weekly release date of this DEV branch
$version = 2012090400.00; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit 736cc6a

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