Revert "Merge branch 'MDL-31914-master-4' of git://git.luns.net.uk/moodle"
authorDan Poltawski <dan@moodle.com>
Thu, 29 Mar 2012 08:05:47 +0000 (16:05 +0800)
committerDan Poltawski <dan@moodle.com>
Thu, 29 Mar 2012 08:07:30 +0000 (16:07 +0800)
This reverts commit 296c0247c6cc9e525721fc92b5a78c7146e6887d, reversing
changes made to 2511b0742a3695298d8216fe9723581c089909d7.

Conflicts:

lib/db/upgrade.php
version.php

course/lib.php
lib/db/upgrade.php

index b4488d9..dfc33df 100644 (file)
@@ -2929,7 +2929,6 @@ function delete_course_module($id) {
     // very quick on an empty table)
     $DB->delete_records('course_modules_completion', array('coursemoduleid' => $cm->id));
     $DB->delete_records('course_modules_availability', array('coursemoduleid'=> $cm->id));
-    $DB->delete_records('course_completion_criteria', array('moduleinstance'=> $cm->id));
 
     delete_context(CONTEXT_MODULE, $cm->id);
     return $DB->delete_records('course_modules', array('id'=>$cm->id));
index 28d37ec..8d8ffff 100644 (file)
@@ -317,24 +317,6 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2012031500.04);
     }
 
-    if ($oldversion < 2012032300.01) {
-        // Delete orphaned criteria which were left when modules were removed
-        if ($DB->get_dbfamily() === 'mysql') {
-            $sql = "DELETE cc FROM {course_completion_criteria} cc
-                    LEFT JOIN {course_modules} cm ON cm.id = cc.moduleinstance
-                    WHERE cm.id IS NULL";
-        } else {
-            $sql = "DELETE FROM {course_completion_criteria}
-                    WHERE NOT EXISTS (
-                        SELECT 'x' FROM {course_modules}
-                        WHERE {course_modules}.id = {course_completion_criteria}.moduleinstance)";
-        }
-        $DB->execute($sql);
-
-        // Main savepoint reached
-        upgrade_main_savepoint(true, 2012032300.01);
-    }
-
     if ($oldversion < 2012032300.02) {
         // Migrate the old admin debug setting.
         if ($CFG->debug == 38911) {