]> git.mjollnir.org Git - moodle.git/commitdiff
Prevent tables without prefix to be duplicated at install time. MDL-6614
authorstronk7 <stronk7>
Sat, 30 Sep 2006 14:36:52 +0000 (14:36 +0000)
committerstronk7 <stronk7>
Sat, 30 Sep 2006 14:36:52 +0000 (14:36 +0000)
lib/xmldb/classes/generators/XMLDBGenerator.class.php

index 5593cd0ea1d9101a5154540b27b4ab865b0f9000..f82ce6011fec3bd1ea8ffe3a3673435bb9989a50 100644 (file)
@@ -151,7 +151,7 @@ class XMLDBgenerator {
             $prefixtouse = '';
         }
     /// Get the name
-        $tablename = $this->prefix . $xmldb_table->getName();
+        $tablename = $prefixtouse . $xmldb_table->getName();
     /// Apply quotes conditionally
         if ($quoted) {
             $tablename = $this->getEncQuoted($tablename);
@@ -174,6 +174,13 @@ class XMLDBgenerator {
         if (!$xmldb_fields = $xmldb_table->getFields()) {
             return false;
         }
+
+    /// Prevent tables without prefix to be duplicated (part of MDL-6614)
+        if (in_array($xmldb_table->getName(), $this->getTablesWithoutPrefix()) &&
+            table_exists($xmldb_table)) {
+            return false;
+        }
+
     /// Add the fields, separated by commas
         foreach ($xmldb_fields as $xmldb_field) {
             $table .= "\n    " . $this->getFieldSQL($xmldb_field);