[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * This file keeps track of upgrades to 20 * the lesson module 21 * 22 * Sometimes, changes between versions involve 23 * alterations to database structures and other 24 * major things that may break installations. 25 * 26 * The upgrade function in this file will attempt 27 * to perform all the necessary actions to upgrade 28 * your older installation to the current version. 29 * 30 * If there's something it cannot do itself, it 31 * will tell you what you need to do. 32 * 33 * The commands in here will all be database-neutral, 34 * using the methods of database_manager class 35 * 36 * Please do not forget to use upgrade_set_timeout() 37 * before any action that may take longer time to finish. 38 * 39 * @package mod_lesson 40 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} 41 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 o 42 */ 43 44 defined('MOODLE_INTERNAL') || die(); 45 46 /** 47 * 48 * @global stdClass $CFG 49 * @global moodle_database $DB 50 * @global core_renderer $OUTPUT 51 * @param int $oldversion 52 * @return bool 53 */ 54 function xmldb_lesson_upgrade($oldversion) { 55 global $CFG, $DB, $OUTPUT; 56 57 $dbman = $DB->get_manager(); 58 59 60 // Moodle v2.2.0 release upgrade line 61 // Put any upgrade step following this 62 63 // Moodle v2.3.0 release upgrade line 64 // Put any upgrade step following this 65 66 67 // Moodle v2.4.0 release upgrade line 68 // Put any upgrade step following this 69 70 71 // Moodle v2.5.0 release upgrade line. 72 // Put any upgrade step following this. 73 74 75 // Moodle v2.6.0 release upgrade line. 76 // Put any upgrade step following this. 77 78 // Moodle v2.7.0 release upgrade line. 79 // Put any upgrade step following this. 80 81 if ($oldversion < 2014091001) { 82 $table = new xmldb_table('lesson'); 83 $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name'); 84 // Conditionally launch add field. 85 if (!$dbman->field_exists($table, $field)) { 86 $dbman->add_field($table, $field); 87 } 88 $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro'); 89 if (!$dbman->field_exists($table, $field)) { 90 $dbman->add_field($table, $field); 91 } 92 upgrade_mod_savepoint(true, 2014091001, 'lesson'); 93 } 94 95 if ($oldversion < 2014100600) { 96 // Previously there was no module intro in lesson so don't require 97 // it to be filled in for upgraded sites. 98 set_config('requiremodintro', 0, 'lesson'); 99 upgrade_mod_savepoint(true, 2014100600, 'lesson'); 100 } 101 102 // Moodle v2.8.0 release upgrade line. 103 // Put any upgrade step following this. 104 105 return true; 106 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |