From ead293420d0baf8af94309fa0e8b0518d8f68711 Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Wed, 22 Mar 2006 10:44:54 +0000 Subject: [PATCH] Questiontypes are doing their own database upgrade now. I modified the enrollment plugin mechanism to work for any type of plugin --- admin/index.php | 5 +- enrol/authorize/db/mysql.php | 2 +- enrol/authorize/db/postgres7.php | 2 +- enrol/authorize/version.php | 4 +- enrol/paypal/db/mysql.php | 2 +- enrol/paypal/db/postgres7.php | 2 +- enrol/paypal/version.php | 4 +- lang/en_utf8/error.php | 1 + lang/en_utf8/moodle.php | 1 + lib/adminlib.php | 81 +++---- mod/quiz/db/mysql.sql | 229 ------------------ mod/quiz/db/postgres7.sql | 216 ----------------- .../questiontypes/calculated/db/mysql.php | 23 ++ .../questiontypes/calculated/db/mysql.sql | 18 ++ .../questiontypes/calculated/db/postgre7.php | 23 ++ .../questiontypes/calculated/db/postgre7.sql | 19 ++ question/questiontypes/calculated/version.php | 6 + question/questiontypes/essay/db/mysql.php | 23 ++ question/questiontypes/essay/db/mysql.sql | 30 +++ question/questiontypes/essay/db/postgre7.php | 23 ++ question/questiontypes/essay/db/postgre7.sql | 27 +++ question/questiontypes/essay/version.php | 6 + question/questiontypes/match/db/mysql.php | 23 ++ question/questiontypes/match/db/mysql.sql | 32 +++ question/questiontypes/match/db/postgre7.php | 23 ++ question/questiontypes/match/db/postgre7.sql | 30 +++ question/questiontypes/match/version.php | 6 + .../questiontypes/multianswer/db/mysql.php | 23 ++ .../questiontypes/multianswer/db/mysql.sql | 15 ++ .../questiontypes/multianswer/db/postgre7.php | 23 ++ .../questiontypes/multianswer/db/postgre7.sql | 14 ++ .../questiontypes/multianswer/version.php | 6 + .../questiontypes/multichoice/db/mysql.php | 23 ++ .../questiontypes/multichoice/db/mysql.sql | 18 ++ .../questiontypes/multichoice/db/postgre7.php | 23 ++ .../questiontypes/multichoice/db/postgre7.sql | 18 ++ .../questiontypes/multichoice/version.php | 6 + question/questiontypes/numerical/db/mysql.php | 23 ++ question/questiontypes/numerical/db/mysql.sql | 17 ++ .../questiontypes/numerical/db/postgre7.php | 23 ++ .../questiontypes/numerical/db/postgre7.sql | 16 ++ question/questiontypes/numerical/version.php | 6 + .../questiontypes/randomsamatch/db/mysql.php | 23 ++ .../questiontypes/randomsamatch/db/mysql.sql | 14 ++ .../randomsamatch/db/postgre7.php | 23 ++ .../randomsamatch/db/postgre7.sql | 15 ++ .../questiontypes/randomsamatch/version.php | 6 + question/questiontypes/rqp/db/mysql.php | 23 ++ question/questiontypes/rqp/db/mysql.sql | 60 +++++ question/questiontypes/rqp/db/postgre7.php | 23 ++ question/questiontypes/rqp/db/postgre7.sql | 50 ++++ question/questiontypes/rqp/version.php | 6 + .../questiontypes/shortanswer/db/mysql.php | 23 ++ .../questiontypes/shortanswer/db/mysql.sql | 16 ++ .../questiontypes/shortanswer/db/postgre7.php | 23 ++ .../questiontypes/shortanswer/db/postgre7.sql | 14 ++ .../questiontypes/shortanswer/version.php | 6 + question/questiontypes/truefalse/db/mysql.php | 23 ++ question/questiontypes/truefalse/db/mysql.sql | 13 + .../questiontypes/truefalse/db/postgre7.php | 23 ++ .../questiontypes/truefalse/db/postgre7.sql | 13 + question/questiontypes/truefalse/version.php | 6 + version.php | 2 +- 63 files changed, 1024 insertions(+), 496 deletions(-) create mode 100644 question/questiontypes/calculated/db/mysql.php create mode 100644 question/questiontypes/calculated/db/mysql.sql create mode 100644 question/questiontypes/calculated/db/postgre7.php create mode 100644 question/questiontypes/calculated/db/postgre7.sql create mode 100644 question/questiontypes/calculated/version.php create mode 100644 question/questiontypes/essay/db/mysql.php create mode 100644 question/questiontypes/essay/db/mysql.sql create mode 100644 question/questiontypes/essay/db/postgre7.php create mode 100644 question/questiontypes/essay/db/postgre7.sql create mode 100644 question/questiontypes/essay/version.php create mode 100644 question/questiontypes/match/db/mysql.php create mode 100644 question/questiontypes/match/db/mysql.sql create mode 100644 question/questiontypes/match/db/postgre7.php create mode 100644 question/questiontypes/match/db/postgre7.sql create mode 100644 question/questiontypes/match/version.php create mode 100644 question/questiontypes/multianswer/db/mysql.php create mode 100644 question/questiontypes/multianswer/db/mysql.sql create mode 100644 question/questiontypes/multianswer/db/postgre7.php create mode 100644 question/questiontypes/multianswer/db/postgre7.sql create mode 100644 question/questiontypes/multianswer/version.php create mode 100644 question/questiontypes/multichoice/db/mysql.php create mode 100644 question/questiontypes/multichoice/db/mysql.sql create mode 100644 question/questiontypes/multichoice/db/postgre7.php create mode 100644 question/questiontypes/multichoice/db/postgre7.sql create mode 100644 question/questiontypes/multichoice/version.php create mode 100644 question/questiontypes/numerical/db/mysql.php create mode 100644 question/questiontypes/numerical/db/mysql.sql create mode 100644 question/questiontypes/numerical/db/postgre7.php create mode 100644 question/questiontypes/numerical/db/postgre7.sql create mode 100644 question/questiontypes/numerical/version.php create mode 100644 question/questiontypes/randomsamatch/db/mysql.php create mode 100644 question/questiontypes/randomsamatch/db/mysql.sql create mode 100644 question/questiontypes/randomsamatch/db/postgre7.php create mode 100644 question/questiontypes/randomsamatch/db/postgre7.sql create mode 100644 question/questiontypes/randomsamatch/version.php create mode 100644 question/questiontypes/rqp/db/mysql.php create mode 100644 question/questiontypes/rqp/db/mysql.sql create mode 100644 question/questiontypes/rqp/db/postgre7.php create mode 100644 question/questiontypes/rqp/db/postgre7.sql create mode 100644 question/questiontypes/rqp/version.php create mode 100644 question/questiontypes/shortanswer/db/mysql.php create mode 100644 question/questiontypes/shortanswer/db/mysql.sql create mode 100644 question/questiontypes/shortanswer/db/postgre7.php create mode 100644 question/questiontypes/shortanswer/db/postgre7.sql create mode 100644 question/questiontypes/shortanswer/version.php create mode 100644 question/questiontypes/truefalse/db/mysql.php create mode 100644 question/questiontypes/truefalse/db/mysql.sql create mode 100644 question/questiontypes/truefalse/db/postgre7.php create mode 100644 question/questiontypes/truefalse/db/postgre7.sql create mode 100644 question/questiontypes/truefalse/version.php diff --git a/admin/index.php b/admin/index.php index 634be0b774..f11e2afbc9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -239,6 +239,9 @@ redirect("config.php"); } +/// Check all questiontype plugins and upgrade if necessary + upgrade_plugins('qtype', 'question/questiontypes', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards + /// Find and check all main modules and load them up or upgrade them if necessary upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards @@ -254,7 +257,7 @@ upgrade_blocks_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards /// Check all enrolment plugins and upgrade if necessary - upgrade_enrol_plugins("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards + upgrade_plugins('enrol', 'enrol', "$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards /// Check for local database customisations require_once("$CFG->dirroot/lib/locallib.php"); diff --git a/enrol/authorize/db/mysql.php b/enrol/authorize/db/mysql.php index e3497ca65c..c3760ea092 100755 --- a/enrol/authorize/db/mysql.php +++ b/enrol/authorize/db/mysql.php @@ -2,7 +2,7 @@ // MySQL commands for upgrading this enrolment module -function authorize_upgrade($oldversion=0) { +function enrol_authorize_upgrade($oldversion=0) { global $CFG, $THEME, $db; require_once("$CFG->dirroot/enrol/authorize/const.php"); diff --git a/enrol/authorize/db/postgres7.php b/enrol/authorize/db/postgres7.php index a890e64c9f..ee4e4fd2a3 100644 --- a/enrol/authorize/db/postgres7.php +++ b/enrol/authorize/db/postgres7.php @@ -2,7 +2,7 @@ // PostgreSQL commands for upgrading this enrolment module -function authorize_upgrade($oldversion=0) { +function enrol_authorize_upgrade($oldversion=0) { global $CFG, $THEME, $db; require_once("$CFG->dirroot/enrol/authorize/const.php"); diff --git a/enrol/authorize/version.php b/enrol/authorize/version.php index c5561ec56f..0f23609259 100755 --- a/enrol/authorize/version.php +++ b/enrol/authorize/version.php @@ -1,6 +1,6 @@ version = 2006021500; -$module->requires = 2005072200; +$plugin->version = 2006021500; +$plugin->requires = 2005072200; ?> diff --git a/enrol/paypal/db/mysql.php b/enrol/paypal/db/mysql.php index 6f37388245..cb2b94dbd2 100644 --- a/enrol/paypal/db/mysql.php +++ b/enrol/paypal/db/mysql.php @@ -2,7 +2,7 @@ // MySQL commands for upgrading this enrolment module -function paypal_upgrade($oldversion=0) { +function enrol_paypal_upgrade($oldversion=0) { global $CFG, $THEME, $db; diff --git a/enrol/paypal/db/postgres7.php b/enrol/paypal/db/postgres7.php index 7650afee18..7ac6b989ab 100644 --- a/enrol/paypal/db/postgres7.php +++ b/enrol/paypal/db/postgres7.php @@ -2,7 +2,7 @@ // PostgreSQL commands for upgrading this enrolment module -function paypal_upgrade($oldversion=0) { +function enrol_paypal_upgrade($oldversion=0) { global $CFG, $THEME, $db; diff --git a/enrol/paypal/version.php b/enrol/paypal/version.php index d15999219d..f05da31fe8 100644 --- a/enrol/paypal/version.php +++ b/enrol/paypal/version.php @@ -5,8 +5,8 @@ /// This fragment is called by admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2004081800; // This module's version +$plugin->version = 2004081800; // This module's version -$module->requires = 2004081800; // Requires this Moodle version +$plugin->requires = 2004081800; // Requires this Moodle version ?> diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index 270b85b0bf..41a265a398 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -44,6 +44,7 @@ $string['notavailable'] = 'That is not currently available'; $string['onlyeditown'] = 'You can only edit your own information'; $string['onlyeditingteachers'] = 'Only editing teachers can do that.'; $string['onlyadmins'] = 'Only administrators can do that.'; +$string['pluginrequirementsnotmet'] = 'Plugin \"$a->pluginname\" ($a->pluginversion) could not be installed. It requires a newer version of Moodle (currently you are using $a->currentmoodle, you need $a->requiremoodle).'; $string['processingstops'] = 'Processing stops here. Remaining records ignored.'; $string['remotedownloadnotallowed'] = 'Download of components to your server isn\'t allowed (allow_url_fopen is disabled).

You must download the url\">$a->url file manually, copy it to \"$a->dest\" in your server and unzip it there.'; $string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that.'; diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 2aacb71808..d1a9f96282 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -991,6 +991,7 @@ $string['periodending'] = 'Period ending ($a)'; $string['personalprofile'] = 'Personal profile'; $string['phone'] = 'Phone'; $string['phpinfo'] = 'PHP info'; +$string['pluginsetup'] = 'Setting up plugin tables'; $string['policyagree'] = 'You must agree to this policy to continue using this site. Do you agree?'; $string['policyagreement'] = 'Site Policy Agreement'; $string['policyagreementclick'] = 'Click here to read the Site Policy Agreement'; diff --git a/lib/adminlib.php b/lib/adminlib.php index e66d181c73..6d8e69062b 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -11,93 +11,92 @@ */ /** - * upgrade_enrol_plugins - * - * long description + * Upgrade plugins * * @uses $db * @uses $CFG - * @param string $return The url to prompt the user to continue to - * @todo Finish documenting this function + * @param string $type The type of plugins that should be updated (e.g. 'enrol', 'qtype') + * @param string $dir The directory where the plugins are located (e.g. 'question/questiontypes') + * @param string $return The url to prompt the user to continue to */ -function upgrade_enrol_plugins($return) { +function upgrade_plugins($type, $dir, $return) { global $CFG, $db; - if (!$mods = get_list_of_plugins('enrol') ) { - error('No modules installed!'); + if (!$plugs = get_list_of_plugins($dir) ) { + error('No '.$type.' plugins installed!'); } - foreach ($mods as $mod) { + foreach ($plugs as $plug) { - $fullmod = $CFG->dirroot .'/enrol/'. $mod; + $fullplug = $CFG->dirroot .'/'.$dir.'/'. $plug; - unset($module); + unset($plugin); - if ( is_readable($fullmod .'/version.php')) { - include_once($fullmod .'/version.php'); // defines $module with version etc + if ( is_readable($fullplug .'/version.php')) { + include_once($fullplug .'/version.php'); // defines $plugin with version etc } else { continue; // Nothing to do. } - if ( is_readable($fullmod .'/db/'. $CFG->dbtype .'.php')) { - include_once($fullmod .'/db/'. $CFG->dbtype .'.php'); // defines upgrading function + if ( is_readable($fullplug .'/db/'. $CFG->dbtype .'.php')) { + include_once($fullplug .'/db/'. $CFG->dbtype .'.php'); // defines upgrading function } else { continue; } - if (!isset($module)) { + if (!isset($plugin)) { continue; } - if (!empty($module->requires)) { - if ($module->requires > $CFG->version) { - $info->modulename = $mod; - $info->moduleversion = $module->version; + if (!empty($plugin->requires)) { + if ($plugin->requires > $CFG->version) { + $info->pluginname = $plug; + $info->pluginversion = $plugin->version; $info->currentmoodle = $CFG->version; - $info->requiremoodle = $module->requires; - notify(get_string('modulerequirementsnotmet', 'error', $info)); + $info->requiremoodle = $plugin->requires; + notify(get_string('pluginrequirementsnotmet', 'error', $info)); unset($info); continue; } } - $module->name = $mod; // The name MUST match the directory + $plugin->name = $plug; // The name MUST match the directory - $moduleversion = 'enrol_'.$mod.'_version'; + $pluginversion = $type.'_'.$plug.'_version'; - if (!isset($CFG->$moduleversion)) { - set_config($moduleversion, 0); + if (!isset($CFG->$pluginversion)) { + set_config($pluginversion, 0); } - if ($CFG->$moduleversion == $module->version) { + if ($CFG->$pluginversion == $plugin->version) { // do nothing - } else if ($CFG->$moduleversion < $module->version) { - if (empty($updated_modules)) { - $strmodulesetup = get_string('modulesetup'); - print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '', '', false, ' ', ' '); + } else if ($CFG->$pluginversion < $plugin->version) { + if (empty($updated_plugins)) { + $strpluginsetup = get_string('pluginsetup'); + print_header($strpluginsetup, $strpluginsetup, $strpluginsetup, '', '', false, ' ', ' '); } - print_heading($module->name .' module needs upgrading'); - $upgrade_function = $module->name .'_upgrade'; + print_heading($plugin->name .' plugin needs upgrading'); + $upgrade_function = $type.'_'.$plugin->name .'_upgrade'; if (function_exists($upgrade_function)) { $db->debug=true; - if ($upgrade_function($CFG->$moduleversion)) { + if ($upgrade_function($CFG->$pluginversion)) { $db->debug=false; - // OK so far, now update the modules record - set_config($moduleversion, $module->version); - notify(get_string('modulesuccess', '', $module->name), 'notifysuccess'); + // OK so far, now update the plugins record + set_config($pluginversion, $plugin->version); + notify(get_string('modulesuccess', '', $plugin->name), 'notifysuccess'); echo '
'; } else { $db->debug=false; - notify('Upgrading '. $module->name .' from '. $CFG->$moduleversion .' to '. $module->version .' FAILED!'); + notify('Upgrading '. $plugin->name .' from '. $CFG->$pluginversion .' to '. $plugin->version .' FAILED!'); } } - $updated_modules = true; + $updated_plugins = true; } else { - error('Version mismatch: '. $module->name .' can\'t downgrade '. $CFG->$moduleversion .' -> '. $module->version .' !'); + error('Version mismatch: '. $plugin->name .' can\'t downgrade '. $CFG->$pluginversion .' -> '. $plugin->version .' !'); } } - if (!empty($updated_modules)) { + if (!empty($updated_plugins)) { print_continue($return); die; } diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index 711f555a05..83fe73eddc 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -105,25 +105,6 @@ CREATE TABLE prefix_quiz_attempts ( -- -------------------------------------------------------- --- --- Table structure for table `prefix_question_calculated` --- - -CREATE TABLE prefix_question_calculated ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answer int(10) unsigned NOT NULL default '0', - tolerance varchar(20) NOT NULL default '0.0', - tolerancetype int(10) NOT NULL default '1', - correctanswerlength int(10) NOT NULL default '2', - correctanswerformat int(10) NOT NULL default '2', - PRIMARY KEY (id), - KEY question (question), - KEY answer (answer) -) TYPE=MyISAM COMMENT='Options for questions of type calculated'; - --- -------------------------------------------------------- - -- -- Table structure for table `prefix_question_categories` -- @@ -175,35 +156,6 @@ CREATE TABLE prefix_question_dataset_items ( -- -------------------------------------------------------- --- --- Table structure for table `mdl_question_essay` --- - -CREATE TABLE `prefix_question_essay` ( - `id` int(10) unsigned NOT NULL auto_increment, - `question` int(10) unsigned NOT NULL default '0', - `answer` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `question` (`question`) -) TYPE=MyISAM COMMENT='Options for essay questions'; - --- -------------------------------------------------------- - --- --- Table structure for table `mdl_question_essay_states` --- - -CREATE TABLE `prefix_question_essay_states` ( - `id` int(10) unsigned NOT NULL auto_increment, - `stateid` int(10) unsigned NOT NULL default '0', - `graded` tinyint(4) unsigned NOT NULL default '0', - `fraction` float NOT NULL default '0', - `response` text NOT NULL default '', - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT='essay question type specific state information'; - --- -------------------------------------------------------- - -- -- Table structure for table `prefix_quiz_grades` -- @@ -221,68 +173,6 @@ CREATE TABLE prefix_quiz_grades ( -- -------------------------------------------------------- --- --- Table structure for table `prefix_question_match` --- - -CREATE TABLE prefix_question_match ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - subquestions varchar(255) NOT NULL default '', - shuffleanswers tinyint(4) NOT NULL default '1', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Defines fixed matching questions'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_match_sub` --- - -CREATE TABLE prefix_question_match_sub ( - id int(10) unsigned NOT NULL auto_increment, - code int(10) unsigned NOT NULL default '0', - question int(10) unsigned NOT NULL default '0', - questiontext text NOT NULL default '', - answertext varchar(255) NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Defines the subquestions that make up a matching question'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_multianswer` --- - -CREATE TABLE prefix_question_multianswer ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - sequence text NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for multianswer questions'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_multichoice` --- - -CREATE TABLE prefix_question_multichoice ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - layout tinyint(4) NOT NULL default '0', - answers varchar(255) NOT NULL default '', - single tinyint(4) NOT NULL default '0', - shuffleanswers tinyint(4) NOT NULL default '1', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for multiple choice questions'; - --- -------------------------------------------------------- - -- -- Table structure for table `prefix_question_sessions` -- @@ -300,22 +190,6 @@ CREATE TABLE prefix_question_sessions ( -- -------------------------------------------------------- --- --- Table structure for table `prefix_question_numerical` --- - -CREATE TABLE prefix_question_numerical ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answer int(10) unsigned NOT NULL default '0', - tolerance varchar(255) NOT NULL default '0.0', - PRIMARY KEY (id), - KEY answer (answer), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for numerical questions'; - --- -------------------------------------------------------- - -- -- Table structure for table `prefix_question_numerical_units` -- @@ -403,97 +277,6 @@ CREATE TABLE prefix_question ( -- -------------------------------------------------------- --- --- Table structure for table `prefix_question_randomsamatch` --- - -CREATE TABLE prefix_question_randomsamatch ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - choose int(10) unsigned NOT NULL default '4', - shuffleanswers tinyint(4) NOT NULL default '1', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Info about a random short-answer matching question'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp` --- - -CREATE TABLE prefix_question_rqp ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - type int(10) unsigned NOT NULL default '0', - source longblob NOT NULL default '', - format varchar(255) NOT NULL default '', - flags tinyint(3) unsigned NOT NULL default '0', - maxscore int(10) unsigned NOT NULL default '1', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for RQP questions'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp_servers` --- - -CREATE TABLE prefix_question_rqp_servers ( - id int(10) unsigned NOT NULL auto_increment, - typeid int(10) unsigned NOT NULL default '0', - url varchar(255) NOT NULL default '', - can_render tinyint(2) unsigned NOT NULL default '0', - can_author tinyint(2) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='Information about RQP servers'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp_states` --- - -CREATE TABLE prefix_question_rqp_states ( - id int(10) unsigned NOT NULL auto_increment, - stateid int(10) unsigned NOT NULL default '0', - responses text NOT NULL default '', - persistent_data text NOT NULL default '', - template_vars text NOT NULL default '', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='RQP question type specific state information'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp_types` --- - -CREATE TABLE prefix_question_rqp_types ( - id int(10) unsigned NOT NULL auto_increment, - name varchar(255) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY name (name) -) TYPE=MyISAM COMMENT='RQP question types'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_shortanswer` --- - -CREATE TABLE prefix_question_shortanswer ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answers varchar(255) NOT NULL default '', - usecase tinyint(2) NOT NULL default '0', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for short answer questions'; - --- -------------------------------------------------------- - -- -- Table structure for table `prefix_question_states` -- @@ -517,18 +300,6 @@ CREATE TABLE prefix_question_states ( -- -------------------------------------------------------- --- --- Table structure for table `prefix_question_truefalse` --- - -CREATE TABLE prefix_question_truefalse ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - trueanswer int(10) unsigned NOT NULL default '0', - falseanswer int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for True-False questions'; INSERT INTO prefix_log_display VALUES ('quiz', 'add', 'quiz', 'name'); INSERT INTO prefix_log_display VALUES ('quiz', 'update', 'quiz', 'name'); diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql index a663b85193..6192d3d607 100644 --- a/mod/quiz/db/postgres7.sql +++ b/mod/quiz/db/postgres7.sql @@ -99,25 +99,6 @@ CREATE INDEX prefix_quiz_attempts_quiz_idx ON prefix_quiz_attempts (quiz); CREATE INDEX prefix_quiz_attempts_userid_idx ON prefix_quiz_attempts (userid); CREATE UNIQUE INDEX prefix_quiz_attempts_uniqueid_uk ON prefix_quiz_attempts (uniqueid); -# -------------------------------------------------------- -# -# Table structure for table prefix_question_calculated -# - -CREATE TABLE prefix_question_calculated ( - id SERIAL8 PRIMARY KEY, - question INT8 NOT NULL default '0', - answer INT8 NOT NULL default '0', - tolerance varchar(20) NOT NULL default '0.0', - tolerancetype INT8 NOT NULL default '1', - correctanswerlength INT8 NOT NULL default '2', - correctanswerformat INT8 NOT NULL default '2' -); - -CREATE INDEX prefix_question_calculated_question_idx ON prefix_question_calculated (question); -CREATE INDEX prefix_question_calculated_answer_idx ON prefix_question_calculated (answer); - - # -------------------------------------------------------- # @@ -170,32 +151,6 @@ CREATE INDEX prefix_question_dataset_items_definition_idx ON prefix_question_da # -------------------------------------------------------- -# -# Table structure for table prefix_question_essay -# - -CREATE TABLE mdl_question_essay ( - id serial NOT NULL, - question integer NOT NULL DEFAULT 0, - answer varchar(255) NOT NULL DEFAULT '' -); - - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_essay_states -# - -CREATE TABLE mdl_question_essay_states ( - id serial NOT NULL, - stateid integer NOT NULL DEFAULT 0, - graded integer NOT NULL DEFAULT 0, - response text NOT NULL DEFAULT '', - fraction real NOT NULL DEFAULT 0 -); -# -------------------------------------------------------- - # # Table structure for table prefix_quiz_grades # @@ -211,68 +166,6 @@ CREATE TABLE prefix_quiz_grades ( CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz); CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid); -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_match -# - -CREATE TABLE prefix_question_match ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - subquestions varchar(255) NOT NULL default '', - shuffleanswers integer NOT NULL default '1' -); - -CREATE INDEX prefix_question_match_question_idx ON prefix_question_match (question); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_match_sub -# - -CREATE TABLE prefix_question_match_sub ( - id SERIAL PRIMARY KEY, - code integer NOT NULL default '0', - question integer NOT NULL default '0', - questiontext text NOT NULL default '', - answertext varchar(255) NOT NULL default '' -); -CREATE INDEX prefix_question_match_sub_question_idx ON prefix_question_match_sub (question); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_multianswer -# - -CREATE TABLE prefix_question_multianswer ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - sequence text NOT NULL default '' -); - -CREATE INDEX prefix_question_multianswer_question_idx ON prefix_question_multianswer (question); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_multichoice -# - -CREATE TABLE prefix_question_multichoice ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - layout integer NOT NULL default '0', - answers varchar(255) NOT NULL default '', - single integer NOT NULL default '0', - shuffleanswers integer NOT NULL default '1' -); - -CREATE INDEX prefix_question_multichoice_question_idx ON prefix_question_multichoice (question); - - # -------------------------------------------------------- # @@ -291,22 +184,6 @@ CREATE TABLE prefix_question_sessions ( CREATE UNIQUE INDEX prefix_question_sessions_attempt_idx ON prefix_question_sessions (attemptid,questionid); -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_numerical -# - -CREATE TABLE prefix_question_numerical ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - answer integer NOT NULL default '0', - tolerance varchar(255) NOT NULL default '0.0' -); - -CREATE INDEX prefix_question_numerical_answer_idx ON prefix_question_numerical (answer); -CREATE INDEX prefix_question_numerical_question_idx ON prefix_question_numerical (question); - # -------------------------------------------------------- # # Table structure for table prefix_question_numerical_units @@ -391,85 +268,6 @@ CREATE TABLE prefix_question ( CREATE INDEX prefix_question_category_idx ON prefix_question (category); -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_randomsamatch -# - -CREATE TABLE prefix_question_randomsamatch ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - choose integer NOT NULL default '4', - shuffleanswers integer NOT NULL default '1' -); - -CREATE INDEX prefix_question_randomsamatch_question_idx ON prefix_question_randomsamatch (question); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_rqp -# - -CREATE TABLE prefix_question_rqp ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - type integer NOT NULL default '0', - source text NOT NULL, - format varchar(255) NOT NULL default '', - flags integer NOT NULL default '0', - maxscore integer NOT NULL default '1' -); - -CREATE INDEX prefix_question_rqp_question_idx ON prefix_question_rqp (question); - - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_rqp_states -# - -CREATE TABLE prefix_question_rqp_states ( - id SERIAL PRIMARY KEY, - stateid integer NOT NULL default '0', - responses text NOT NULL, - persistent_data text NOT NULL, - template_vars text NOT NULL -); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_rqp_type -# - -CREATE TABLE prefix_question_rqp_types ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - rendering_server varchar(255) NOT NULL default '', - cloning_server varchar(255) NOT NULL default '', - flags integer NOT NULL default '0' -); - -CREATE UNIQUE INDEX prefix_question_rqp_types_name_uk ON prefix_question_rqp_types (name); - - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_shortanswer -# - -CREATE TABLE prefix_question_shortanswer ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - answers varchar(255) NOT NULL default '', - usecase integer NOT NULL default '0' -); -CREATE INDEX prefix_question_shortanswer_question_idx ON prefix_question_shortanswer (question); - # -------------------------------------------------------- @@ -495,20 +293,6 @@ CREATE INDEX prefix_question_states_attempt_idx ON prefix_question_states (attem CREATE INDEX prefix_question_states_question_idx ON prefix_question_states (question);; -# -------------------------------------------------------- -# -# Table structure for table prefix_question_truefalse -# - -CREATE TABLE prefix_question_truefalse ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - trueanswer integer NOT NULL default '0', - falseanswer integer NOT NULL default '0' -); -CREATE INDEX prefix_question_truefalse_question_idx ON prefix_question_truefalse (question); - - INSERT INTO prefix_log_display VALUES ('quiz', 'add', 'quiz', 'name'); INSERT INTO prefix_log_display VALUES ('quiz', 'update', 'quiz', 'name'); INSERT INTO prefix_log_display VALUES ('quiz', 'view', 'quiz', 'name'); diff --git a/question/questiontypes/calculated/db/mysql.php b/question/questiontypes/calculated/db/mysql.php new file mode 100644 index 0000000000..f0f6687276 --- /dev/null +++ b/question/questiontypes/calculated/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/calculated/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/calculated/db/mysql.sql b/question/questiontypes/calculated/db/mysql.sql new file mode 100644 index 0000000000..70a633c27e --- /dev/null +++ b/question/questiontypes/calculated/db/mysql.sql @@ -0,0 +1,18 @@ +-- +-- Table structure for table `prefix_question_calculated` +-- + +CREATE TABLE prefix_question_calculated ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + answer int(10) unsigned NOT NULL default '0', + tolerance varchar(20) NOT NULL default '0.0', + tolerancetype int(10) NOT NULL default '1', + correctanswerlength int(10) NOT NULL default '2', + correctanswerformat int(10) NOT NULL default '2', + PRIMARY KEY (id), + KEY question (question), + KEY answer (answer) +) TYPE=MyISAM COMMENT='Options for questions of type calculated'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/calculated/db/postgre7.php b/question/questiontypes/calculated/db/postgre7.php new file mode 100644 index 0000000000..cc7dc75a59 --- /dev/null +++ b/question/questiontypes/calculated/db/postgre7.php @@ -0,0 +1,23 @@ +libdir/questionlib.php"); + + if ($oldversion == 0) { // First time install + $result = modify_database("$CFG->dirroot/question/questiontypes/calculated/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/calculated/db/postgre7.sql b/question/questiontypes/calculated/db/postgre7.sql new file mode 100644 index 0000000000..bc6d6e986b --- /dev/null +++ b/question/questiontypes/calculated/db/postgre7.sql @@ -0,0 +1,19 @@ + +# -------------------------------------------------------- +# +# Table structure for table prefix_question_calculated +# + +CREATE TABLE prefix_question_calculated ( + id SERIAL8 PRIMARY KEY, + question INT8 NOT NULL default '0', + answer INT8 NOT NULL default '0', + tolerance varchar(20) NOT NULL default '0.0', + tolerancetype INT8 NOT NULL default '1', + correctanswerlength INT8 NOT NULL default '2', + correctanswerformat INT8 NOT NULL default '2' +); + +CREATE INDEX prefix_question_calculated_question_idx ON prefix_question_calculated (question); +CREATE INDEX prefix_question_calculated_answer_idx ON prefix_question_calculated (answer); + diff --git a/question/questiontypes/calculated/version.php b/question/questiontypes/calculated/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/calculated/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/essay/db/mysql.php b/question/questiontypes/essay/db/mysql.php new file mode 100644 index 0000000000..903793f7ef --- /dev/null +++ b/question/questiontypes/essay/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/essay/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/essay/db/mysql.sql b/question/questiontypes/essay/db/mysql.sql new file mode 100644 index 0000000000..cf0f6e9919 --- /dev/null +++ b/question/questiontypes/essay/db/mysql.sql @@ -0,0 +1,30 @@ + + +-- +-- Table structure for table `mdl_question_essay` +-- + +CREATE TABLE `prefix_question_essay` ( + `id` int(10) unsigned NOT NULL auto_increment, + `question` int(10) unsigned NOT NULL default '0', + `answer` varchar(255) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `question` (`question`) +) TYPE=MyISAM COMMENT='Options for essay questions'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mdl_question_essay_states` +-- + +CREATE TABLE `prefix_question_essay_states` ( + `id` int(10) unsigned NOT NULL auto_increment, + `stateid` int(10) unsigned NOT NULL default '0', + `graded` tinyint(4) unsigned NOT NULL default '0', + `fraction` float NOT NULL default '0', + `response` text NOT NULL default '', + PRIMARY KEY (`id`) +) TYPE=MyISAM COMMENT='essay question type specific state information'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/essay/db/postgre7.php b/question/questiontypes/essay/db/postgre7.php new file mode 100644 index 0000000000..7283040c39 --- /dev/null +++ b/question/questiontypes/essay/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/essay/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/essay/db/postgre7.sql b/question/questiontypes/essay/db/postgre7.sql new file mode 100644 index 0000000000..b41fc1f684 --- /dev/null +++ b/question/questiontypes/essay/db/postgre7.sql @@ -0,0 +1,27 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_essay +# + +CREATE TABLE mdl_question_essay ( + id serial NOT NULL, + question integer NOT NULL DEFAULT 0, + answer varchar(255) NOT NULL DEFAULT '' +); + + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_essay_states +# + +CREATE TABLE mdl_question_essay_states ( + id serial NOT NULL, + stateid integer NOT NULL DEFAULT 0, + graded integer NOT NULL DEFAULT 0, + response text NOT NULL DEFAULT '', + fraction real NOT NULL DEFAULT 0 +); \ No newline at end of file diff --git a/question/questiontypes/essay/version.php b/question/questiontypes/essay/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/essay/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/match/db/mysql.php b/question/questiontypes/match/db/mysql.php new file mode 100644 index 0000000000..29ae16521f --- /dev/null +++ b/question/questiontypes/match/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/match/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/match/db/mysql.sql b/question/questiontypes/match/db/mysql.sql new file mode 100644 index 0000000000..ebeb9e0bca --- /dev/null +++ b/question/questiontypes/match/db/mysql.sql @@ -0,0 +1,32 @@ + + +-- +-- Table structure for table `prefix_question_match` +-- + +CREATE TABLE prefix_question_match ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + subquestions varchar(255) NOT NULL default '', + shuffleanswers tinyint(4) NOT NULL default '1', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Defines fixed matching questions'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `prefix_question_match_sub` +-- + +CREATE TABLE prefix_question_match_sub ( + id int(10) unsigned NOT NULL auto_increment, + code int(10) unsigned NOT NULL default '0', + question int(10) unsigned NOT NULL default '0', + questiontext text NOT NULL default '', + answertext varchar(255) NOT NULL default '', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Defines the subquestions that make up a matching question'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/match/db/postgre7.php b/question/questiontypes/match/db/postgre7.php new file mode 100644 index 0000000000..c8d0d16db7 --- /dev/null +++ b/question/questiontypes/match/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/match/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/match/db/postgre7.sql b/question/questiontypes/match/db/postgre7.sql new file mode 100644 index 0000000000..8bb5efe457 --- /dev/null +++ b/question/questiontypes/match/db/postgre7.sql @@ -0,0 +1,30 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_match +# + +CREATE TABLE prefix_question_match ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + subquestions varchar(255) NOT NULL default '', + shuffleanswers integer NOT NULL default '1' +); + +CREATE INDEX prefix_question_match_question_idx ON prefix_question_match (question); + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_match_sub +# + +CREATE TABLE prefix_question_match_sub ( + id SERIAL PRIMARY KEY, + code integer NOT NULL default '0', + question integer NOT NULL default '0', + questiontext text NOT NULL default '', + answertext varchar(255) NOT NULL default '' +); +CREATE INDEX prefix_question_match_sub_question_idx ON prefix_question_match_sub (question); diff --git a/question/questiontypes/match/version.php b/question/questiontypes/match/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/match/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/multianswer/db/mysql.php b/question/questiontypes/multianswer/db/mysql.php new file mode 100644 index 0000000000..32337c043b --- /dev/null +++ b/question/questiontypes/multianswer/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/multianswer/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/multianswer/db/mysql.sql b/question/questiontypes/multianswer/db/mysql.sql new file mode 100644 index 0000000000..e90d697772 --- /dev/null +++ b/question/questiontypes/multianswer/db/mysql.sql @@ -0,0 +1,15 @@ + + +-- +-- Table structure for table `prefix_question_multianswer` +-- + +CREATE TABLE prefix_question_multianswer ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + sequence text NOT NULL default '', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Options for multianswer questions'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/multianswer/db/postgre7.php b/question/questiontypes/multianswer/db/postgre7.php new file mode 100644 index 0000000000..312310cbc6 --- /dev/null +++ b/question/questiontypes/multianswer/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/multianswer/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/multianswer/db/postgre7.sql b/question/questiontypes/multianswer/db/postgre7.sql new file mode 100644 index 0000000000..626d056867 --- /dev/null +++ b/question/questiontypes/multianswer/db/postgre7.sql @@ -0,0 +1,14 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_multianswer +# + +CREATE TABLE prefix_question_multianswer ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + sequence text NOT NULL default '' +); + +CREATE INDEX prefix_question_multianswer_question_idx ON prefix_question_multianswer (question); diff --git a/question/questiontypes/multianswer/version.php b/question/questiontypes/multianswer/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/multianswer/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/multichoice/db/mysql.php b/question/questiontypes/multichoice/db/mysql.php new file mode 100644 index 0000000000..d717705fb6 --- /dev/null +++ b/question/questiontypes/multichoice/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/multichoice/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/multichoice/db/mysql.sql b/question/questiontypes/multichoice/db/mysql.sql new file mode 100644 index 0000000000..e729bb199f --- /dev/null +++ b/question/questiontypes/multichoice/db/mysql.sql @@ -0,0 +1,18 @@ + + +-- +-- Table structure for table `prefix_question_multichoice` +-- + +CREATE TABLE prefix_question_multichoice ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + layout tinyint(4) NOT NULL default '0', + answers varchar(255) NOT NULL default '', + single tinyint(4) NOT NULL default '0', + shuffleanswers tinyint(4) NOT NULL default '1', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Options for multiple choice questions'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/multichoice/db/postgre7.php b/question/questiontypes/multichoice/db/postgre7.php new file mode 100644 index 0000000000..b2e6bd4f00 --- /dev/null +++ b/question/questiontypes/multichoice/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/multichoice/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/multichoice/db/postgre7.sql b/question/questiontypes/multichoice/db/postgre7.sql new file mode 100644 index 0000000000..036278b9e8 --- /dev/null +++ b/question/questiontypes/multichoice/db/postgre7.sql @@ -0,0 +1,18 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_multichoice +# + +CREATE TABLE prefix_question_multichoice ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + layout integer NOT NULL default '0', + answers varchar(255) NOT NULL default '', + single integer NOT NULL default '0', + shuffleanswers integer NOT NULL default '1' +); + +CREATE INDEX prefix_question_multichoice_question_idx ON prefix_question_multichoice (question); + diff --git a/question/questiontypes/multichoice/version.php b/question/questiontypes/multichoice/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/multichoice/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/numerical/db/mysql.php b/question/questiontypes/numerical/db/mysql.php new file mode 100644 index 0000000000..ec184a6c7d --- /dev/null +++ b/question/questiontypes/numerical/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/numerical/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/numerical/db/mysql.sql b/question/questiontypes/numerical/db/mysql.sql new file mode 100644 index 0000000000..c234b0bcd4 --- /dev/null +++ b/question/questiontypes/numerical/db/mysql.sql @@ -0,0 +1,17 @@ + + +-- +-- Table structure for table `prefix_question_numerical` +-- + +CREATE TABLE prefix_question_numerical ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + answer int(10) unsigned NOT NULL default '0', + tolerance varchar(255) NOT NULL default '0.0', + PRIMARY KEY (id), + KEY answer (answer), + KEY question (question) +) TYPE=MyISAM COMMENT='Options for numerical questions'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/numerical/db/postgre7.php b/question/questiontypes/numerical/db/postgre7.php new file mode 100644 index 0000000000..5657caf2fa --- /dev/null +++ b/question/questiontypes/numerical/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/numerical/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/numerical/db/postgre7.sql b/question/questiontypes/numerical/db/postgre7.sql new file mode 100644 index 0000000000..4e3b53d834 --- /dev/null +++ b/question/questiontypes/numerical/db/postgre7.sql @@ -0,0 +1,16 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_numerical +# + +CREATE TABLE prefix_question_numerical ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + answer integer NOT NULL default '0', + tolerance varchar(255) NOT NULL default '0.0' +); + +CREATE INDEX prefix_question_numerical_answer_idx ON prefix_question_numerical (answer); +CREATE INDEX prefix_question_numerical_question_idx ON prefix_question_numerical (question); diff --git a/question/questiontypes/numerical/version.php b/question/questiontypes/numerical/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/numerical/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/randomsamatch/db/mysql.php b/question/questiontypes/randomsamatch/db/mysql.php new file mode 100644 index 0000000000..cb57d53899 --- /dev/null +++ b/question/questiontypes/randomsamatch/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/randomsamatch/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/randomsamatch/db/mysql.sql b/question/questiontypes/randomsamatch/db/mysql.sql new file mode 100644 index 0000000000..43a8c53564 --- /dev/null +++ b/question/questiontypes/randomsamatch/db/mysql.sql @@ -0,0 +1,14 @@ +-- +-- Table structure for table `prefix_question_randomsamatch` +-- + +CREATE TABLE prefix_question_randomsamatch ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + choose int(10) unsigned NOT NULL default '4', + shuffleanswers tinyint(4) NOT NULL default '1', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Info about a random short-answer matching question'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/randomsamatch/db/postgre7.php b/question/questiontypes/randomsamatch/db/postgre7.php new file mode 100644 index 0000000000..46fccc559d --- /dev/null +++ b/question/questiontypes/randomsamatch/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/randomsamatch/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/randomsamatch/db/postgre7.sql b/question/questiontypes/randomsamatch/db/postgre7.sql new file mode 100644 index 0000000000..ac9392778a --- /dev/null +++ b/question/questiontypes/randomsamatch/db/postgre7.sql @@ -0,0 +1,15 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_randomsamatch +# + +CREATE TABLE prefix_question_randomsamatch ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + choose integer NOT NULL default '4', + shuffleanswers integer NOT NULL default '1' +); + +CREATE INDEX prefix_question_randomsamatch_question_idx ON prefix_question_randomsamatch (question); diff --git a/question/questiontypes/randomsamatch/version.php b/question/questiontypes/randomsamatch/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/randomsamatch/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/rqp/db/mysql.php b/question/questiontypes/rqp/db/mysql.php new file mode 100644 index 0000000000..424d48f37e --- /dev/null +++ b/question/questiontypes/rqp/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/rqp/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/rqp/db/mysql.sql b/question/questiontypes/rqp/db/mysql.sql new file mode 100644 index 0000000000..65b1f5b861 --- /dev/null +++ b/question/questiontypes/rqp/db/mysql.sql @@ -0,0 +1,60 @@ +-- +-- Table structure for table `prefix_question_rqp` +-- + +CREATE TABLE prefix_question_rqp ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + type int(10) unsigned NOT NULL default '0', + source longblob NOT NULL default '', + format varchar(255) NOT NULL default '', + flags tinyint(3) unsigned NOT NULL default '0', + maxscore int(10) unsigned NOT NULL default '1', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Options for RQP questions'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `prefix_question_rqp_servers` +-- + +CREATE TABLE prefix_question_rqp_servers ( + id int(10) unsigned NOT NULL auto_increment, + typeid int(10) unsigned NOT NULL default '0', + url varchar(255) NOT NULL default '', + can_render tinyint(2) unsigned NOT NULL default '0', + can_author tinyint(2) unsigned NOT NULL default '0', + PRIMARY KEY (id) +) TYPE=MyISAM COMMENT='Information about RQP servers'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `prefix_question_rqp_states` +-- + +CREATE TABLE prefix_question_rqp_states ( + id int(10) unsigned NOT NULL auto_increment, + stateid int(10) unsigned NOT NULL default '0', + responses text NOT NULL default '', + persistent_data text NOT NULL default '', + template_vars text NOT NULL default '', + PRIMARY KEY (id) +) TYPE=MyISAM COMMENT='RQP question type specific state information'; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `prefix_question_rqp_types` +-- + +CREATE TABLE prefix_question_rqp_types ( + id int(10) unsigned NOT NULL auto_increment, + name varchar(255) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE KEY name (name) +) TYPE=MyISAM COMMENT='RQP question types'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/rqp/db/postgre7.php b/question/questiontypes/rqp/db/postgre7.php new file mode 100644 index 0000000000..e27e225179 --- /dev/null +++ b/question/questiontypes/rqp/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/rqp/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/rqp/db/postgre7.sql b/question/questiontypes/rqp/db/postgre7.sql new file mode 100644 index 0000000000..63ff3451cf --- /dev/null +++ b/question/questiontypes/rqp/db/postgre7.sql @@ -0,0 +1,50 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_rqp +# + +CREATE TABLE prefix_question_rqp ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + type integer NOT NULL default '0', + source text NOT NULL, + format varchar(255) NOT NULL default '', + flags integer NOT NULL default '0', + maxscore integer NOT NULL default '1' +); + +CREATE INDEX prefix_question_rqp_question_idx ON prefix_question_rqp (question); + + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_rqp_states +# + +CREATE TABLE prefix_question_rqp_states ( + id SERIAL PRIMARY KEY, + stateid integer NOT NULL default '0', + responses text NOT NULL, + persistent_data text NOT NULL, + template_vars text NOT NULL +); + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_rqp_type +# + +CREATE TABLE prefix_question_rqp_types ( + id SERIAL PRIMARY KEY, + name varchar(255) NOT NULL default '', + rendering_server varchar(255) NOT NULL default '', + cloning_server varchar(255) NOT NULL default '', + flags integer NOT NULL default '0' +); + +CREATE UNIQUE INDEX prefix_question_rqp_types_name_uk ON prefix_question_rqp_types (name); + diff --git a/question/questiontypes/rqp/version.php b/question/questiontypes/rqp/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/rqp/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/shortanswer/db/mysql.php b/question/questiontypes/shortanswer/db/mysql.php new file mode 100644 index 0000000000..a21e44f6ad --- /dev/null +++ b/question/questiontypes/shortanswer/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/shortanswer/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/shortanswer/db/mysql.sql b/question/questiontypes/shortanswer/db/mysql.sql new file mode 100644 index 0000000000..5ce8966bcb --- /dev/null +++ b/question/questiontypes/shortanswer/db/mysql.sql @@ -0,0 +1,16 @@ + + +-- +-- Table structure for table `prefix_question_shortanswer` +-- + +CREATE TABLE prefix_question_shortanswer ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + answers varchar(255) NOT NULL default '', + usecase tinyint(2) NOT NULL default '0', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Options for short answer questions'; + +-- -------------------------------------------------------- \ No newline at end of file diff --git a/question/questiontypes/shortanswer/db/postgre7.php b/question/questiontypes/shortanswer/db/postgre7.php new file mode 100644 index 0000000000..51cbec7f27 --- /dev/null +++ b/question/questiontypes/shortanswer/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/shortanswer/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/shortanswer/db/postgre7.sql b/question/questiontypes/shortanswer/db/postgre7.sql new file mode 100644 index 0000000000..ff58a0b0f1 --- /dev/null +++ b/question/questiontypes/shortanswer/db/postgre7.sql @@ -0,0 +1,14 @@ + +# -------------------------------------------------------- + +# +# Table structure for table prefix_question_shortanswer +# + +CREATE TABLE prefix_question_shortanswer ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + answers varchar(255) NOT NULL default '', + usecase integer NOT NULL default '0' +); +CREATE INDEX prefix_question_shortanswer_question_idx ON prefix_question_shortanswer (question); diff --git a/question/questiontypes/shortanswer/version.php b/question/questiontypes/shortanswer/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/shortanswer/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/question/questiontypes/truefalse/db/mysql.php b/question/questiontypes/truefalse/db/mysql.php new file mode 100644 index 0000000000..3a5a62b51f --- /dev/null +++ b/question/questiontypes/truefalse/db/mysql.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/truefalse/db/mysql.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/truefalse/db/mysql.sql b/question/questiontypes/truefalse/db/mysql.sql new file mode 100644 index 0000000000..675df73f3b --- /dev/null +++ b/question/questiontypes/truefalse/db/mysql.sql @@ -0,0 +1,13 @@ + +-- +-- Table structure for table `prefix_question_truefalse` +-- + +CREATE TABLE prefix_question_truefalse ( + id int(10) unsigned NOT NULL auto_increment, + question int(10) unsigned NOT NULL default '0', + trueanswer int(10) unsigned NOT NULL default '0', + falseanswer int(10) unsigned NOT NULL default '0', + PRIMARY KEY (id), + KEY question (question) +) TYPE=MyISAM COMMENT='Options for True-False questions'; \ No newline at end of file diff --git a/question/questiontypes/truefalse/db/postgre7.php b/question/questiontypes/truefalse/db/postgre7.php new file mode 100644 index 0000000000..2f1cc01e6e --- /dev/null +++ b/question/questiontypes/truefalse/db/postgre7.php @@ -0,0 +1,23 @@ +dirroot/question/questiontypes/truefalse/db/postgres7.sql"); + return $result; + } + + // Question type was installed before. Upgrades must be applied + +// if ($oldversion < 2005071600) { +// +// } + + return true; +} + +?> diff --git a/question/questiontypes/truefalse/db/postgre7.sql b/question/questiontypes/truefalse/db/postgre7.sql new file mode 100644 index 0000000000..07cb9eb5ed --- /dev/null +++ b/question/questiontypes/truefalse/db/postgre7.sql @@ -0,0 +1,13 @@ + +# -------------------------------------------------------- +# +# Table structure for table prefix_question_truefalse +# + +CREATE TABLE prefix_question_truefalse ( + id SERIAL PRIMARY KEY, + question integer NOT NULL default '0', + trueanswer integer NOT NULL default '0', + falseanswer integer NOT NULL default '0' +); +CREATE INDEX prefix_question_truefalse_question_idx ON prefix_question_truefalse (question); diff --git a/question/questiontypes/truefalse/version.php b/question/questiontypes/truefalse/version.php new file mode 100644 index 0000000000..2d2a8d9fa7 --- /dev/null +++ b/question/questiontypes/truefalse/version.php @@ -0,0 +1,6 @@ +version = 2006032200; +$plugin->requires = 2006032200; + +?> diff --git a/version.php b/version.php index 24e19a3bc7..2fbd14efaa 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2006032001; // YYYYMMDD = date + $version = 2006032200; // YYYYMMDD = date // XY = increments within a single day $release = '1.6 development'; // Human-friendly version name -- 2.39.5