* (bug 5195) rebuildrecentchanges.php works again; Database::insertSelect now has...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 4 Apr 2006 06:06:36 +0000 (06:06 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 4 Apr 2006 06:06:36 +0000 (06:06 +0000)
RELEASE-NOTES
includes/Database.php
maintenance/rebuildrecentchanges.inc

index 06d8d1a..1c3693d 100644 (file)
@@ -739,6 +739,8 @@ fully support the editing toolbar, but was found to be too confusing.
   when wikibits.js was moved up before user JS inclusion.
 * Added $wgColorErrors: if set, database error messages will be highlighted
   when running command-line scripts in a Unix terminal.
+* (bug 5195) rebuildrecentchanges.php works again; Database::insertSelect now
+  has a parameter for select options.
 
 
 === Caveats ===
index b7e09da..4e1414a 100644 (file)
@@ -1338,23 +1338,28 @@ class Database {
         * srcTable may be an array of tables.
         */
        function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'Database::insertSelect',
-               $options = array() )
+               $insertOptions = array(), $selectOptions = array() )
        {
                $destTable = $this->tableName( $destTable );
-               if ( is_array( $options ) ) {
-                       $options = implode( ' ', $options );
+               if ( is_array( $insertOptions ) ) {
+                       $insertOptions = implode( ' ', $insertOptions );
                }
+               if( !is_array( $selectOptions ) ) {
+                       $selectOptions = array( $selectOptions );
+               }
+               list( $useIndex, $tailOpts ) = $this->makeSelectOptions( $selectOptions );
                if( is_array( $srcTable ) ) {
                        $srcTable =  implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) );
                } else {
                        $srcTable = $this->tableName( $srcTable );
                }
-               $sql = "INSERT $options INTO $destTable (" . implode( ',', array_keys( $varMap ) ) . ')' .
+               $sql = "INSERT $insertOptions INTO $destTable (" . implode( ',', array_keys( $varMap ) ) . ')' .
                        ' SELECT ' . implode( ',', $varMap ) .
-                       " FROM $srcTable";
+                       " FROM $srcTable $useIndex ";
                if ( $conds != '*' ) {
                        $sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND );
                }
+               $sql .= " $tailOpts";
                return $this->query( $sql, $fname );
        }
 
index 26f334e..e077da5 100644 (file)
@@ -37,9 +37,11 @@ function rebuildRecentChangesTablePass1()
                        'rc_last_oldid' => 0, // is this ok?
                        'rc_type'       => $dbw->conditional( 'page_is_new != 0', RC_NEW, RC_EDIT ),
                ), array(
-                       'rev_timestamp > ' . $dbw->timestamp( $cutoff ),
+                       'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $cutoff ) ),
                        'rev_page=page_id'
-               ), $fname, array( 'ORDER BY' => 'rev_timestamp', 'LIMIT' => 5000 )
+               ), $fname,
+               array(), // INSERT options
+               array( 'ORDER BY' => 'rev_timestamp', 'LIMIT' => 5000 ) // SELECT options
        );
 }