From: Brion Vibber Date: Tue, 4 Apr 2006 06:06:36 +0000 (+0000) Subject: * (bug 5195) rebuildrecentchanges.php works again; Database::insertSelect now has... X-Git-Tag: 1.6.0~44 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=e9be90914158d8028b85b4735fab59aad1c4cda3;p=lhc%2Fweb%2Fwiklou.git * (bug 5195) rebuildrecentchanges.php works again; Database::insertSelect now has a parameter for select options. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 06d8d1a6e8..1c3693dee1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Database.php b/includes/Database.php index b7e09dadaa..4e1414a557 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -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 ); } diff --git a/maintenance/rebuildrecentchanges.inc b/maintenance/rebuildrecentchanges.inc index 26f334e23a..e077da5221 100644 --- a/maintenance/rebuildrecentchanges.inc +++ b/maintenance/rebuildrecentchanges.inc @@ -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 ); }