]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16208 fixed deleting of orphaned module tables
authorskodak <skodak>
Tue, 26 Aug 2008 06:54:43 +0000 (06:54 +0000)
committerskodak <skodak>
Tue, 26 Aug 2008 06:54:43 +0000 (06:54 +0000)
lib/adminlib.php

index c2f955719c444d80b033b96650c5dd5aaba4d81b..75785523ccd21bf24bbdb8a7df00ca82cabbdb97 100644 (file)
@@ -149,7 +149,7 @@ function drop_plugin_tables($name, $file, $feedback=true) {
     global $CFG, $DB;
 
     // first try normal delete
-    if ($DB->get_manager()->delete_tables_from_xmldb_file($file)) {
+    if (file_exists($file) and $DB->get_manager()->delete_tables_from_xmldb_file($file)) {
         return true;
     }
 
@@ -164,6 +164,10 @@ function drop_plugin_tables($name, $file, $feedback=true) {
             continue;
         }
 
+        if (strpos($table, $name) !== 0) {
+            continue;
+        }
+
         // found orphan table --> delete it
         if ($DB->get_manager()->table_exists($table)) {
             $xmldb_table = new xmldb_table($table);