diff --git a/lib/db/install.xml b/lib/db/install.xml index 33807c4503e..7c59818984c 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -2594,7 +2594,7 @@ - +
@@ -2610,13 +2610,13 @@
- +
- - - + + + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 49bb9ed6455..7e943c073e3 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -4007,6 +4007,8 @@ AND EXISTS (SELECT 'x' /// Main savepoint reached upgrade_main_savepoint($result, 2010050403); } + + // fix repository_alfresco version number if ($result && $oldversion < 2010050411) { // force to change repository_alfresco version number to upgrade smoothly (from preview 1 -> preview 2) @@ -4017,43 +4019,36 @@ AND EXISTS (SELECT 'x' upgrade_main_savepoint($result, 2010050411); } - if ($result && $oldversion < 2010050413) { - /// Define table published_courses to be created + if ($result && $oldversion < 2010051500) { + + /// Fix a bad table name that existed for a few days in HEAD $table = new xmldb_table('published_courses'); + if ($dbman->table_exists($table)) { + $dbman->drop_table($table); + } - /// Adding fields to table published_courses + /// Define table course_published to be created + $table = new xmldb_table('course_published'); + + /// Adding fields to table course_published $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); $table->add_field('hubid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); - $table->add_field('time', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('timepublished', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); $table->add_field('enrollable', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1'); + $table->add_field('hubcourseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); - /// Adding keys to table published_courses + /// Adding keys to table course_published $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); - /// Conditionally launch create table for published_courses + /// Conditionally launch create table for course_published if (!$dbman->table_exists($table)) { $dbman->create_table($table); } /// Main savepoint reached - upgrade_main_savepoint($result, 2010050413); - } - - if ($result && $oldversion < 2010050414) { - - /// Define field hubcourseid to be added to published_courses - $table = new xmldb_table('published_courses'); - $field = new xmldb_field('hubcourseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'enrollable'); - - /// Conditionally launch add field hubcourseid - if (!$dbman->field_exists($table, $field)) { - $dbman->add_field($table, $field); - } - - /// Main savepoint reached - upgrade_main_savepoint($result, 2010050414); + upgrade_main_savepoint($result, 2010051500); } diff --git a/lib/hublib.php b/lib/hublib.php index 18aa6f3b02f..cb9dba3ce1b 100644 --- a/lib/hublib.php +++ b/lib/hublib.php @@ -197,28 +197,28 @@ class hub { $publication->courseid = $courseid; $publication->hubcourseid = $hubcourseid; $publication->enrollable = $enrollable; - $publication->time = time(); - $DB->insert_record('published_courses', $publication); + $publication->timepublished = time(); + $DB->insert_record('course_published', $publication); } public function update_enrollable_course_publication($publicationid) { global $DB; $publication = new stdClass(); $publication->id = $publicationid; - $publication->time = time(); - $DB->update_record('published_courses', $publication); + $publication->timepublished = time(); + $DB->update_record('course_published', $publication); } public function get_publications($hubid, $courseid, $enrollable) { global $DB; - return $DB->get_records('published_courses', + return $DB->get_records('course_published', array('hubid' => $hubid, 'courseid' => $courseid, 'enrollable' => $enrollable)); } public function get_publication($hubcourseid) { global $DB; - return $DB->get_record('published_courses', + return $DB->get_record('course_published', array('hubcourseid' => $hubcourseid)); } @@ -347,4 +347,4 @@ class hub { return $hubs; } -} \ No newline at end of file +} diff --git a/version.php b/version.php index b52125754cd..9250356baa7 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 = 2010050414; // YYYYMMDD = date of the last version bump + $version = 2010051500; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 Preview 1 (Build: 20100516)'; // Human-friendly version name