return $grades;
}
-function make_unique_id_code($version=1) {
+function make_unique_id_code($extra="") {
$hostname = "unknownhost";
if (!empty($_SERVER["HTTP_HOST"])) {
$random = random_string(6);
- return "$hostname+$date+$random+$version";
-
+ if ($extra) {
+ return "$hostname+$date+$random+$extra";
+ } else {
+ return "$hostname+$date+$random";
+ }
}
}
if ($oldversion < 2003082300) {
- table_column("quiz_questions", "", "stamp", "varchar", "255", "", "qtype");
+ table_column("quiz_questions", "", "stamp", "varchar", "255", "", "", "not null", "qtype");
+ }
+ if ($oldversion < 2003082301) {
+ table_column("quiz_questions", "stamp", "stamp", "varchar", "255", "", "", "not null");
+ table_column("quiz_questions", "", "version", "integer", "10", "", "1", "not null", "stamp");
if ($questions = get_records("quiz_questions")) {
foreach ($questions as $question) {
$stamp = make_unique_id_code();
`defaultgrade` INT UNSIGNED DEFAULT '1' NOT NULL,
`qtype` smallint(6) NOT NULL default '0',
`stamp` varchar(255) NOT NULL default '',
+ `version` int(10) NOT NULL default '1',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='The quiz questions themselves';
# --------------------------------------------------------
table_column("quiz", "", "attemptonlast", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "attempts");
table_column("quiz_questions", "", "stamp", "varchar", "255", "", "qtype");
+ }
+ if ($oldversion < 2003082301) {
+ table_column("quiz_questions", "", "version", "integer", "10", "", "1", "not null", "stamp");
if ($questions = get_records("quiz_questions")) {
foreach ($questions as $question) {
$stamp = make_unique_id_code();
image varchar(255) NOT NULL default '',
defaultgrade integer NOT NULL default '1',
qtype integer NOT NULL default '0',
- stamp varchar(255) NOT NULL default ''
+ stamp varchar(255) NOT NULL default '',
+ version integer NOT NULL default '1'
);
# --------------------------------------------------------
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003082300; // The (date) version of this module
+$module->version = 2003082301; // The (date) version of this module
$module->cron = 0; // How often should cron check this module (seconds)?
?>