Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/tool/bloglevelupgrade/db/install.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00026 defined('MOODLE_INTERNAL') || die;
00027 
00028 function xmldb_tool_bloglevelupgrade_install() {
00029     global $CFG, $OUTPUT;
00030 
00031     // this is a hack - admins were long ago instructed to upgrade blog levels,
00032     // the problem is that blog is not supposed to be course level activity!!
00033 
00034     if (!empty($CFG->bloglevel_upgrade_complete)) {
00035         // somebody already upgrades, we do not need this any more
00036         unset_config('bloglevel_upgrade_complete');
00037         return;
00038     }
00039 
00040     if (!isset($CFG->bloglevel)) {
00041         // fresh install?
00042         return;
00043     }
00044 
00045     if (($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL)) {
00046         // inform admins that some settings require attention after upgrade
00047         $site = get_site();
00048 
00049         $a = new StdClass;
00050         $a->sitename = $site->fullname;
00051         $a->fixurl   = "$CFG->wwwroot/$CFG->admin/tool/bloglevelupgrade/index.php";
00052 
00053         $subject = get_string('bloglevelupgrade', 'tool_bloglevelupgrade');
00054         $description = get_string('bloglevelupgradedescription', 'tool_bloglevelupgrade', $a);
00055 
00056         // can not use messaging here because it is not configured yet!
00057         upgrade_log(UPGRADE_LOG_NOTICE, null, $subject, $description);
00058         set_config('tool_bloglevelupgrade_pending', 1);
00059 
00060         echo $OUTPUT->notification($description);
00061     }
00062 }
00063 
00064 
 All Data Structures Namespaces Files Functions Variables Enumerations