MDL-25012 blogs: Remove bloglevelupgrade tool
authorDan Poltawski <dan@moodle.com>
Thu, 19 Jul 2012 03:20:19 +0000 (11:20 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 6 Aug 2012 03:25:21 +0000 (11:25 +0800)
This was used for 1.9->2.x upgrade and is not longer relevant.

admin/tool/bloglevelupgrade/db/install.php [deleted file]
admin/tool/bloglevelupgrade/index.php [deleted file]
admin/tool/bloglevelupgrade/lang/en/tool_bloglevelupgrade.php [deleted file]
admin/tool/bloglevelupgrade/settings.php [deleted file]
admin/tool/bloglevelupgrade/version.php [deleted file]
lib/pluginlib.php

diff --git a/admin/tool/bloglevelupgrade/db/install.php b/admin/tool/bloglevelupgrade/db/install.php
deleted file mode 100644 (file)
index cdff384..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Post installation and migration code.
- *
- * @package    tool
- * @subpackage bloglevelupgrade
- * @copyright  2011 Petr Skoda {@link http://skodak.org}
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die;
-
-function xmldb_tool_bloglevelupgrade_install() {
-    global $CFG, $OUTPUT;
-
-}
-
-
diff --git a/admin/tool/bloglevelupgrade/index.php b/admin/tool/bloglevelupgrade/index.php
deleted file mode 100644 (file)
index 823f210..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Create "blog" forums in each course and copy blog entries from these courses' participants in these forums
- *
- * @package    tool
- * @subpackage bloglevelupgrade
- * @copyright  2009 Nicolas Connault
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-define('NO_OUTPUT_BUFFERING', true);
-
-require('../../../config.php');
-require_once($CFG->dirroot.'/course/lib.php');
-require_once($CFG->dirroot.'/blog/lib.php');
-require_once($CFG->dirroot.'/mod/forum/lib.php');
-require_once($CFG->libdir.'/adminlib.php');
-
-admin_externalpage_setup('toolbloglevelupgrade');
-$PAGE->set_pagelayout('maintenance');
-
-$go = optional_param('go', 0, PARAM_BOOL);
-
-echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('pluginname', 'tool_bloglevelupgrade'));
-
-$strbloglevelupgrade = get_string('bloglevelupgradeinfo', 'tool_bloglevelupgrade');
-
-if (!$go or !data_submitted() or !confirm_sesskey()) {   /// Print a form
-    $optionsyes = array('go'=>1, 'sesskey'=>sesskey());
-    echo $OUTPUT->confirm($strbloglevelupgrade, new moodle_url('/admin/tool/bloglevelupgrade/index.php', $optionsyes), new moodle_url('/admin/index.php'));
-    echo $OUTPUT->footer();
-    die;
-}
-
-echo $OUTPUT->box_start();
-
-/// Turn off time limits, sometimes upgrades can be slow.
-
-set_time_limit(0);
-
-$i = 0;
-
-// If $CFG->bloglevel is set to BLOG_GROUP_LEVEL or BLOG_COURSE_LEVEL, create a new "blog" forum in each course
-// whose enrolled students have written blog entries, copy these entries in that forum and switch off blogs at site level
-
-if ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) {
-    $pbar = new progress_bar('toolbloglevelupgrade', 500, true);
-
-    $bloggers = $DB->get_records_sql("SELECT userid FROM {post} WHERE module = 'blog' GROUP BY userid");
-    require_once($CFG->dirroot.'/mod/forum/lib.php');
-
-    $a = new stdClass();
-    $a->userscount = 0;
-    $a->blogcount = 0;
-
-    foreach ($bloggers as $blogger) {
-        $courses = enrol_get_users_courses($blogger->userid, true, 'groupmode,groupmodeforce');
-        $blogentries = $DB->get_records('post', array('module' => 'blog', 'userid' => $blogger->userid));
-
-        foreach ($courses as $course) {
-            $forum = forum_get_course_forum($course->id, 'blog');
-            $cm = get_coursemodule_from_instance('forum', $forum->id);
-
-            if ($CFG->bloglevel == BLOG_GROUP_LEVEL && $course->groupmode != NOGROUPS) {
-                // Unless the course is set to separate groups forced, force the forum to Separate groups
-                if (!($course->groupmode == SEPARATEGROUPS && $course->groupmodeforce)) {
-                    $cm->groupmode = SEPARATEGROUPS;
-                    $DB->update_record('course_modules', $cm);
-                }
-
-                $groups = groups_get_user_groups($course->id, $blogger->userid);
-                foreach ($groups[0] as $groupid) { // [0] is for all groupings combined
-                    $a->blogcount += bloglevelupgrade_entries($blogentries, $forum, $cm, $groupid);
-                }
-            } else {
-                $a->blogcount += bloglevelupgrade_entries($blogentries, $forum, $cm);
-            }
-        }
-
-        $a->userscount = $i . '/' .  count($bloggers);
-        $pbar->update($i, count($bloggers), get_string('bloglevelupgradeprogress', 'tool_bloglevelupgrade', $a));
-        $i++;
-    }
-}
-
-function bloglevelupgrade_entries($blogentries, $forum, $cm, $groupid=-1) {
-    $count = 0;
-
-    $forumcontext = context_module::instance($cm->id);
-    $sitecontext = context_system::instance();
-
-    foreach ($blogentries as $blogentry) {
-        $discussion = new stdClass();
-        $discussion->course = $forum->course;
-        $discussion->forum = $forum->id;
-        $discussion->name = $blogentry->subject;
-        $discussion->assessed = $forum->assessed;
-        $discussion->message = $blogentry->summary;
-        $discussion->messageformat = $blogentry->summaryformat;
-        $discussion->messagetrust = 0;
-        $discussion->attachments = 0;
-        $discussion->mailnow = false;
-        $discussion->timemodified = $blogentry->created;
-        $discussion->itemid = null;
-        $discussion->groupid = $groupid;
-        $message = '';
-
-        $discussionid = forum_add_discussion($discussion, null, $message, $blogentry->userid);
-
-        // Copy file attachment records
-        $fs = get_file_storage();
-        $files = $fs->get_area_files($sitecontext->id, 'blog', 'attachment', $blogentry->id);
-
-        if (!empty($files)) {
-            foreach ($files as $storedfile) {
-                $newfile = new stdClass();
-                $newfile->component = 'mod_forum';
-                $newfile->filearea = 'attachment';
-                $newfile->itemid = $discussion->firstpost;
-                $newfile->contextid = $forumcontext->id;
-                $fs->create_file_from_storedfile($newfile, $storedfile->get_id());
-            }
-        }
-
-        $files = $fs->get_area_files($sitecontext->id, 'blog', 'post', $blogentry->id);
-
-        if (!empty($files)) {
-            foreach ($files as $storedfile) {
-                $newfile = new stdClass();
-                $newfile->component = 'mod_forum';
-                $newfile->filearea = 'post';
-                $newfile->itemid = $discussion->firstpost;
-                $newfile->contextid = $forumcontext->id;
-                $fs->create_file_from_storedfile($newfile, $storedfile->get_id());
-            }
-        }
-        $count++;
-    }
-    return $count;
-}
-// END OF LOOP
-
-// set conversion flag - switches to new plugin automatically
-unset_config('tool_bloglevelupgrade_pending');
-// Finally switch bloglevel to 0 (disabled)
-set_config('bloglevel', 0);
-
-echo $OUTPUT->box_end();
-
-/// Rebuild course cache which might be incorrect now
-echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
-rebuild_course_cache();
-echo $OUTPUT->notification('...finished', 'notifysuccess');
-
-echo $OUTPUT->continue_button(new moodle_url('/admin/index.php'));
-
-echo $OUTPUT->footer();
-die;
diff --git a/admin/tool/bloglevelupgrade/lang/en/tool_bloglevelupgrade.php b/admin/tool/bloglevelupgrade/lang/en/tool_bloglevelupgrade.php
deleted file mode 100644 (file)
index b73749e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Strings for component 'tool_bloglevelupgrade', language 'en', branch 'MOODLE_22_STABLE'
- *
- * @package    tool
- * @subpackage bloglevelupgrade
- * @copyright  1999 onwards Martin Dougiamas  {@link http://moodle.com}
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['bloglevelupgradedescription'] = '<p>This site has recently been upgraded to Moodle 2.0.</p>
-<p>Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types. </p>
-<p>To preserve the course-based or group-based visibility of the blog entries on your site, you need to run the following upgrade script, which will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum. </p>
-<p>Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process.</p>
-<p>You can run the script by visiting <a href="{$a->fixurl}">the blog level upgrade page</a>.</p>';
-$string['bloglevelupgradeinfo'] = 'Blog visibility was simplified in 2.0, but your site still uses one of the old visibility types. To preserve the course-based or group-based visibility of the blog entries on your site, the following upgrade script will create a special "blog" type forum in each course whose enrolled users have posted blog entries, and will copy these blog entries in this special forum. Blogs will then be entirely switched off at the site level. No blog entries will be deleted in the process.';
-$string['bloglevelupgradeprogress'] = 'Conversion progress: {$a->userscount} users reviewed, {$a->blogcount} entries converted.';
-$string['pluginname'] = 'Blog visibility upgrade';
diff --git a/admin/tool/bloglevelupgrade/settings.php b/admin/tool/bloglevelupgrade/settings.php
deleted file mode 100644 (file)
index 646126f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Capability overview settings
- *
- * @package    tool
- * @subpackage bloglevelupgrade
- * @copyright  2011 Petr Skoda
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die;
-
-if ($hassiteconfig) {
-    $ADMIN->add('root', new admin_externalpage('toolbloglevelupgrade', get_string('pluginname', 'tool_bloglevelupgrade'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/bloglevelupgrade/index.php', 'moodle/site:config', empty($CFG->tool_bloglevelupgrade_pending)));
-}
diff --git a/admin/tool/bloglevelupgrade/version.php b/admin/tool/bloglevelupgrade/version.php
deleted file mode 100644 (file)
index 92585d6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * Version details.
- *
- * @package    tool
- * @subpackage bloglevelupgrade
- * @copyright  2011 Petr Skoda
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version   = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires  = 2012061700; // Requires this Moodle version
-$plugin->component = 'tool_bloglevelupgrade'; // Full name of the plugin (used for diagnostics)
index 43de510..0653f37 100644 (file)
@@ -527,7 +527,7 @@ class plugin_manager {
             ),
 
             'tool' => array(
-                'assignmentupgrade', 'bloglevelupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
+                'assignmentupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
                 'health', 'innodb', 'langimport', 'multilangupgrade', 'phpunit', 'profiling',
                 'qeupgradehelper', 'replace', 'spamcleaner', 'timezoneimport', 'unittest',
                 'uploaduser', 'unsuproles', 'xmldb'