MDL-31355 mod_forum: new db field for due and cutoff date

This commit is contained in:
Shamim Rezaie
2019-04-11 02:03:02 +10:00
parent dafcc3cf7b
commit f6b07fedde
3 changed files with 29 additions and 3 deletions
+3 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/forum/db" VERSION="20190311" COMMENT="XMLDB file for Moodle mod/forum"
<XMLDB PATH="mod/forum/db" VERSION="20190404" COMMENT="XMLDB file for Moodle mod/forum"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
@@ -12,6 +12,8 @@
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="intro" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="text format of intro field"/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="A due date to show in the calendar. Not used for grading."/>
<FIELD NAME="cutoffdate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The final date after which forum posts will no longer be accepted for this forum."/>
<FIELD NAME="assessed" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="assesstimestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="assesstimefinish" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
+25 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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)