2009-11-01 13:17:47 +00:00
|
|
|
<?php
|
2014-07-23 09:58:29 +08:00
|
|
|
// This file is part of Moodle - http://moodle.org/
|
2006-10-26 17:33:40 +00:00
|
|
|
//
|
2014-07-23 09:58:29 +08:00
|
|
|
// 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.
|
2006-10-26 17:33:40 +00:00
|
|
|
//
|
2014-07-23 09:58:29 +08:00
|
|
|
// 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.
|
2008-08-16 12:16:01 +00:00
|
|
|
//
|
2014-07-23 09:58:29 +08:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Upgrade code for the chat activity
|
|
|
|
*
|
|
|
|
* @package mod_chat
|
|
|
|
* @copyright 2006 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
2006-10-26 17:33:40 +00:00
|
|
|
|
2016-02-06 12:33:09 +01:00
|
|
|
defined('MOODLE_INTERNAL') || die();
|
2012-12-11 13:11:11 +01:00
|
|
|
|
2016-02-06 12:33:09 +01:00
|
|
|
function xmldb_chat_upgrade($oldversion) {
|
2017-11-14 00:24:29 +01:00
|
|
|
global $CFG, $DB;
|
|
|
|
|
|
|
|
$dbman = $DB->get_manager();
|
2014-05-28 01:13:42 +02:00
|
|
|
|
2017-05-16 02:04:27 +02:00
|
|
|
// Automatically generated Moodle v3.3.0 release upgrade line.
|
|
|
|
// Put any upgrade step following this.
|
|
|
|
|
2017-11-12 18:43:30 +01:00
|
|
|
// Automatically generated Moodle v3.4.0 release upgrade line.
|
|
|
|
// Put any upgrade step following this.
|
|
|
|
|
2017-11-14 00:24:29 +01:00
|
|
|
if ($oldversion < 2017111301) {
|
|
|
|
// Rename field 'system' on table 'chat_messages' as it is a reserved word in MySQL 8+.
|
|
|
|
$table = new xmldb_table('chat_messages');
|
|
|
|
$field = new xmldb_field('system');
|
|
|
|
if ($dbman->field_exists($table, $field)) {
|
|
|
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'groupid');
|
|
|
|
// Extend the execution time limit of the script to 2 hours.
|
|
|
|
upgrade_set_timeout(7200);
|
|
|
|
// Rename it to 'issystem'.
|
|
|
|
$dbman->rename_field($table, $field, 'issystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rename field 'system' on table 'chat_messages_current' as it is a reserved word in MySQL 8+.
|
|
|
|
$table = new xmldb_table('chat_messages_current');
|
|
|
|
$field = new xmldb_field('system');
|
|
|
|
if ($dbman->field_exists($table, $field)) {
|
|
|
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'groupid');
|
|
|
|
// Extend the execution time limit of the script to 5 minutes.
|
|
|
|
upgrade_set_timeout(300);
|
|
|
|
// Rename it to 'issystem'.
|
|
|
|
$dbman->rename_field($table, $field, 'issystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Savepoint reached.
|
|
|
|
upgrade_mod_savepoint(true, 2017111301, 'chat');
|
|
|
|
}
|
|
|
|
|
2018-05-19 21:22:04 +02:00
|
|
|
// Automatically generated Moodle v3.5.0 release upgrade line.
|
|
|
|
// Put any upgrade step following this.
|
|
|
|
|
2018-12-02 18:36:40 +01:00
|
|
|
// Automatically generated Moodle v3.6.0 release upgrade line.
|
|
|
|
// Put any upgrade step following this.
|
|
|
|
|
2019-05-20 19:35:05 +02:00
|
|
|
// Automatically generated Moodle v3.7.0 release upgrade line.
|
|
|
|
// Put any upgrade step following this.
|
|
|
|
|
2019-11-17 11:40:19 +01:00
|
|
|
// Automatically generated Moodle v3.8.0 release upgrade line.
|
|
|
|
// Put any upgrade step following this.
|
|
|
|
|
2010-07-04 10:27:56 +00:00
|
|
|
return true;
|
2006-10-26 17:33:40 +00:00
|
|
|
}
|