/// we need to say that these tables are already installed, otherwise XMLDB
/// will try to create them again and give an error.
if ($result && $oldversion < 2008082600) {
- set_config('version', 2008082600, 'qtype_datasetdependent');
+ // Since MDL-16505 was fixed, and we eliminated the datasetdependent
+ // question type, this is now a no-op.
upgrade_mod_savepoint($result, 2008082600, 'quiz');
}
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="question/type/calculated/db" VERSION="20060812" COMMENT="XMLDB file for Moodle question/type/calculated. This question type also relies on the question_numerical_units table created by the numerical question type, and the tables created by the datasetdependent question type base class.">
<TABLES>
- <TABLE NAME="question_calculated" COMMENT="Options for questions of type calculated">
+ <TABLE NAME="question_calculated" COMMENT="Options for questions of type calculated" NEXT="question_dataset_definitions">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="question"/>
<FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="answer"/>
<INDEX NAME="answer" UNIQUE="false" FIELDS="answer"/>
</INDEXES>
</TABLE>
+ <TABLE NAME="question_dataset_definitions" COMMENT="Organises and stores properties for dataset items" PREVIOUS="question_calculated" NEXT="question_dataset_items">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="category"/>
+ <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
+ <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="category" NEXT="type"/>
+ <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="options"/>
+ <FIELD NAME="options" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="itemcount"/>
+ <FIELD NAME="itemcount" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="options"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="category"/>
+ <KEY NAME="category" TYPE="foreign" FIELDS="category" REFTABLE="question_categories" REFFIELDS="id" PREVIOUS="primary"/>
+ </KEYS>
+ </TABLE>
+ <TABLE NAME="question_dataset_items" COMMENT="Individual dataset items" PREVIOUS="question_dataset_definitions" NEXT="question_datasets">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="definition"/>
+ <FIELD NAME="definition" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="itemnumber"/>
+ <FIELD NAME="itemnumber" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="definition" NEXT="value"/>
+ <FIELD NAME="value" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="itemnumber"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+ </KEYS>
+ <INDEXES>
+ <INDEX NAME="definition" UNIQUE="false" FIELDS="definition"/>
+ </INDEXES>
+ </TABLE>
+ <TABLE NAME="question_datasets" COMMENT="Many-many relation between questions and dataset definitions" PREVIOUS="question_dataset_items">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="question"/>
+ <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="datasetdefinition"/>
+ <FIELD NAME="datasetdefinition" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="question"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="question"/>
+ <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id" PREVIOUS="primary" NEXT="datasetdefinition"/>
+ <KEY NAME="datasetdefinition" TYPE="foreign" FIELDS="datasetdefinition" REFTABLE="question_dataset_definitions" REFFIELDS="id" PREVIOUS="question"/>
+ </KEYS>
+ <INDEXES>
+ <INDEX NAME="question-datasetdefinition" UNIQUE="false" FIELDS="question, datasetdefinition"/>
+ </INDEXES>
+ </TABLE>
</TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
$dbman = $DB->get_manager();
$result = true;
-/// And upgrade begins here. For each one, you'll need one
-/// block of code similar to the next one. Please, delete
-/// this comment lines once this file start handling proper
-/// upgrade code.
+ // MDL-16505.
+ if ($result && $oldversion < 2008091700) { //New version in version.php
+ if (get_config('qtype_datasetdependent', 'version')) {
+ $result = $result && unset_config('version', 'qtype_datasetdependent');
+ }
+ upgrade_plugin_savepoint($result, 2008091700, 'qtype', 'calculated');
+ }
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
+/// upgrade_plugin_savepoint($result, YYYYMMDD00, 'qtype', 'calculated');
/// }
return $result;
<?PHP // $Id$
-$plugin->version = 2006032200;
+$plugin->version = 2008091700;
$plugin->requires = 2007101000;
-
?>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="question/type/calculated/db" VERSION="20060812" COMMENT="XMLDB file for Moodle question/type/calculated">
- <TABLES>
- <TABLE NAME="question_dataset_definitions" COMMENT="Organises and stores properties for dataset items" NEXT="question_dataset_items">
- <FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="category"/>
- <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
- <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="category" NEXT="type"/>
- <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="options"/>
- <FIELD NAME="options" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="itemcount"/>
- <FIELD NAME="itemcount" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="options"/>
- </FIELDS>
- <KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="category"/>
- <KEY NAME="category" TYPE="foreign" FIELDS="category" REFTABLE="question_categories" REFFIELDS="id" PREVIOUS="primary"/>
- </KEYS>
- </TABLE>
- <TABLE NAME="question_dataset_items" COMMENT="Individual dataset items" PREVIOUS="question_dataset_definitions" NEXT="question_datasets">
- <FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="definition"/>
- <FIELD NAME="definition" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="itemnumber"/>
- <FIELD NAME="itemnumber" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="definition" NEXT="value"/>
- <FIELD NAME="value" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="itemnumber"/>
- </FIELDS>
- <KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
- </KEYS>
- <INDEXES>
- <INDEX NAME="definition" UNIQUE="false" FIELDS="definition"/>
- </INDEXES>
- </TABLE>
- <TABLE NAME="question_datasets" COMMENT="Many-many relation between questions and dataset definitions" PREVIOUS="question_dataset_items">
- <FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="question"/>
- <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="datasetdefinition"/>
- <FIELD NAME="datasetdefinition" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="question"/>
- </FIELDS>
- <KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="question"/>
- <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="question" REFFIELDS="id" PREVIOUS="primary" NEXT="datasetdefinition"/>
- <KEY NAME="datasetdefinition" TYPE="foreign" FIELDS="datasetdefinition" REFTABLE="question_dataset_definitions" REFFIELDS="id" PREVIOUS="question"/>
- </KEYS>
- <INDEXES>
- <INDEX NAME="question-datasetdefinition" UNIQUE="false" FIELDS="question, datasetdefinition"/>
- </INDEXES>
- </TABLE>
- </TABLES>
-</XMLDB>
+++ /dev/null
-<?php // $Id$
-
-// This file keeps track of upgrades to
-// the datasetdependent abstract qtype plugin
-//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
-//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installtion to the current version.
-//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
-
-function xmldb_qtype_datasetdependent_upgrade($oldversion) {
- global $CFG, $DB;
-
- $dbman = $DB->get_manager();
- $result = true;
-
-/// And upgrade begins here. For each one, you'll need one
-/// block of code similar to the next one. Please, delete
-/// this comment lines once this file start handling proper
-/// upgrade code.
-
-/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
-/// $result = result of database_manager methods
-/// }
-
- return $result;
-}
-
-?>
+++ /dev/null
-<?PHP // $Id$
-
-$plugin->version = 2008082600;
-$plugin->requires = 2007101000;
-
-?>