Merge "API: Handle exceptions from ApiBeforeMain hook in a user-friendly manner"
[lhc/web/wiklou.git] / includes / db / Database.php
index 21c868e..91ab0ca 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @defgroup Database Database
  *
@@ -1921,12 +1922,12 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
        }
 
        /**
-        * Make UPDATE options for the DatabaseBase::update function
+        * Make UPDATE options array for DatabaseBase::makeUpdateOptions
         *
-        * @param array $options The options passed to DatabaseBase::update
-        * @return string
+        * @param array $options
+        * @return array
         */
-       protected function makeUpdateOptions( $options ) {
+       protected function makeUpdateOptionsArray( $options ) {
                if ( !is_array( $options ) ) {
                        $options = array( $options );
                }
@@ -1941,6 +1942,18 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                        $opts[] = 'IGNORE';
                }
 
+               return $opts;
+       }
+
+       /**
+        * Make UPDATE options for the DatabaseBase::update function
+        *
+        * @param array $options The options passed to DatabaseBase::update
+        * @return string
+        */
+       protected function makeUpdateOptions( $options ) {
+               $opts = $this->makeUpdateOptionsArray( $options );
+
                return implode( ' ', $opts );
        }
 
@@ -2423,11 +2436,12 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                                }
 
                                $retJOIN[] = $tableClause;
-                       // Is there an INDEX clause for this table?
                        } elseif ( isset( $use_index[$alias] ) ) {
+                               // Is there an INDEX clause for this table?
                                $tableClause = $this->tableNameWithAlias( $table, $alias );
                                $tableClause .= ' ' . $this->useIndexClause(
-                                       implode( ',', (array)$use_index[$alias] ) );
+                                       implode( ',', (array)$use_index[$alias] )
+                               );
 
                                $ret[] = $tableClause;
                        } else {