]> git.mjollnir.org Git - moodle.git/commitdiff
prevent some warnings on tables without indexes
authorstronk7 <stronk7>
Thu, 28 Sep 2006 19:43:17 +0000 (19:43 +0000)
committerstronk7 <stronk7>
Thu, 28 Sep 2006 19:43:17 +0000 (19:43 +0000)
lib/ddllib.php

index be7568e26d31ba490f4ee4762bbd4aa3a6b2ac0a..462ed952042663a7ef6fd0621f45bc8ad06a5e28 100644 (file)
@@ -312,7 +312,10 @@ function find_index_name($xmldb_table, $xmldb_index) {
     $indcolumns = $xmldb_index->getFields();
 
 /// Get list of indexes in table
-    $indexes = array_change_key_case($db->MetaIndexes($CFG->prefix . $xmldb_table->getName(), CASE_LOWER));
+    $indexes = null;
+    if ($indexes = $db->MetaIndexes($CFG->prefix . $xmldb_table->getName())) {
+        $indexes = array_change_key_case($indexes, CASE_LOWER);
+    }
 
 /// Iterate over them looking for columns coincidence
     if ($indexes) {
@@ -729,10 +732,12 @@ function drop_index($table, $index, $continue=true, $feedback=true) {
         return true; //Index doesn't exist, nothing to do
     }
 
+
     if(!$sqlarr = $table->getDropIndexSQL($CFG->dbtype, $CFG->prefix, $index, false)) {
         return true; //Empty array = nothing to do = no error
     }
 
+
     return execute_sql_arr($sqlarr, $continue, $feedback);
 }