[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Atto upgrade script. 19 * 20 * @package editor_atto 21 * @copyright 2014 Damyon Wiese 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 /** 28 * Run all Atto upgrade steps between the current DB version and the current version on disk. 29 * @param int $oldversion The old version of atto in the DB. 30 * @return bool 31 */ 32 function xmldb_editor_atto_upgrade($oldversion) { 33 global $CFG, $DB; 34 35 $dbman = $DB->get_manager(); 36 37 if ($oldversion < 2014081400) { 38 39 // Define table editor_atto_autosave to be created. 40 $table = new xmldb_table('editor_atto_autosave'); 41 42 // Adding fields to table editor_atto_autosave. 43 $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); 44 $table->add_field('elementid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); 45 $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 46 $table->add_field('pagehash', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null); 47 $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); 48 $table->add_field('drafttext', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); 49 $table->add_field('draftid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); 50 $table->add_field('pageinstance', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null); 51 52 // Adding keys to table editor_atto_autosave. 53 $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); 54 $table->add_key('autosave_uniq_key', XMLDB_KEY_UNIQUE, array('elementid', 'contextid', 'userid', 'pagehash')); 55 56 // Conditionally launch create table for editor_atto_autosave. 57 if (!$dbman->table_exists($table)) { 58 $dbman->create_table($table); 59 } 60 61 // Atto savepoint reached. 62 upgrade_plugin_savepoint(true, 2014081400, 'editor', 'atto'); 63 } 64 65 if ($oldversion < 2014081900) { 66 67 // Define field timemodified to be added to editor_atto_autosave. 68 $table = new xmldb_table('editor_atto_autosave'); 69 $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'pageinstance'); 70 71 // Conditionally launch add field timemodified. 72 if (!$dbman->field_exists($table, $field)) { 73 $dbman->add_field($table, $field); 74 } 75 76 // Atto savepoint reached. 77 upgrade_plugin_savepoint(true, 2014081900, 'editor', 'atto'); 78 } 79 80 // Moodle v2.8.0 release upgrade line. 81 // Put any upgrade step following this. 82 83 // Moodle v2.9.0 release upgrade line. 84 // Put any upgrade step following this. 85 86 // Moodle v3.0.0 release upgrade line. 87 // Put any upgrade step following this. 88 89 // Moodle v3.1.0 release upgrade line. 90 // Put any upgrade step following this. 91 92 return true; 93 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |