From 9a3c870ae3fb6ba2be0949baa243a1d163f9544f Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 28 Apr 2010 02:12:46 +0000 Subject: [PATCH] Plagiarism Lib MDL-13680 - fix upgrade bug --- lib/db/upgrade.php | 16 +++++++++++++++- version.php | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index e27e5405720..54fb750569c 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3659,12 +3659,26 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); $table->add_key('cm', XMLDB_KEY_FOREIGN, array('cm'), 'course_modules', array('id')); $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id')); if (!$dbman->table_exists($table)) { - $result = $result && $dbman->create_table($table); + $dbman->create_table($table); } upgrade_main_savepoint($result, 2010042304); } + if ($result && $oldversion < 2010042305) { /// Plagiarsim API UPGRADE + $table = new XMLDBTable('plagiarism_config'); + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null); + $table->add_field('cm', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0'); + $table->add_field('name', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null); + $table->add_field('value', XMLDB_TYPE_TEXT, 'small', null, null, null, null); + //keys + $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); + $table->add_key('cm', XMLDB_KEY_FOREIGN, array('cm'), 'course_modules', array('id')); + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + upgrade_main_savepoint($result, 2010042305); + } return $result; } diff --git a/version.php b/version.php index a5cbdebfb48..211b727c76a 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 = 2010042304; // YYYYMMDD = date of the last version bump + $version = 2010042305; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20100428)'; // Human-friendly version name