From f6b07feddeef28cfd196db14cf6bacbb4acc0f29 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Wed, 10 Jun 2015 07:32:06 -0700 Subject: [PATCH] MDL-31355 mod_forum: new db field for due and cutoff date --- mod/forum/db/install.xml | 4 +++- mod/forum/db/upgrade.php | 26 +++++++++++++++++++++++++- mod/forum/version.php | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/mod/forum/db/install.xml b/mod/forum/db/install.xml index 3c3cf624073..bf593194367 100644 --- a/mod/forum/db/install.xml +++ b/mod/forum/db/install.xml @@ -1,5 +1,5 @@ - @@ -12,6 +12,8 @@ + + diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index 978e8c95d74..9127de4fe96 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -43,7 +43,7 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_forum_upgrade($oldversion) { - global $CFG, $DB; + global $DB; $dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes. @@ -118,5 +118,29 @@ function xmldb_forum_upgrade($oldversion) { upgrade_mod_savepoint(true, 2019031200, 'forum'); } + if ($oldversion < 2019040400) { + + $table = new xmldb_table('forum'); + + // Define field duedate to be added to forum. + $field = new xmldb_field('duedate', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'introformat'); + + // Conditionally launch add field duedate. + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + // Define field cutoffdate to be added to forum. + $field = new xmldb_field('cutoffdate', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'duedate'); + + // Conditionally launch add field cutoffdate. + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + // Forum savepoint reached. + upgrade_mod_savepoint(true, 2019040400, 'forum'); + } + return true; } diff --git a/mod/forum/version.php b/mod/forum/version.php index 52f7fce43dd..b84b45c4259 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2019031300; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2019040400; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2018112800; // Requires this Moodle version $plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)