Index: trunk/phase3/includes/specials/SpecialRevisionMove.php |
— | — | @@ -151,8 +151,10 @@ |
152 | 152 | Xml::fieldset( wfMsg( 'revmove-legend' ) ) . |
153 | 153 | Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
154 | 154 | Html::hidden( 'oldTitle', $this->mOldTitle->getPrefixedText() ) . |
155 | | - '<div>' . Xml::inputLabel( wfMsg( 'revmove-reasonfield' ), 'wpReason', 'revmove-reasonfield', 60 ) . '</div>' . |
156 | | - Xml::inputLabel( wfMsg( 'revmove-titlefield' ), 'newTitle', 'revmove-titlefield', 20, $this->mOldTitle->getPrefixedText() ) . |
| 155 | + '<div>' . Xml::inputLabel( wfMsg( 'revmove-reasonfield' ), 'wpReason', |
| 156 | + 'revmove-reasonfield', 60 ) . '</div>' . |
| 157 | + Xml::inputLabel( wfMsg( 'revmove-titlefield' ), 'newTitle', 'revmove-titlefield', 20, |
| 158 | + $this->mOldTitle->getPrefixedText() ) . |
157 | 159 | Html::hidden( 'ids', implode( ',', $this->mIds ) ) . |
158 | 160 | Xml::submitButton( wfMsg( 'revmove-submit' ), |
159 | 161 | array( 'name' => 'wpSubmit' ) ) . |
— | — | @@ -237,8 +239,6 @@ |
238 | 240 | $oldArticle = new Article( $this->mOldTitle ); |
239 | 241 | $newArticle = new Article( $this->mNewTitle ); |
240 | 242 | |
241 | | - $idstring = implode( ", ", $this->mIds ); |
242 | | - |
243 | 243 | # Get DB connection and begin transaction |
244 | 244 | $dbw = wfGetDB( DB_MASTER ); |
245 | 245 | $dbw->begin(); |
— | — | @@ -256,7 +256,7 @@ |
257 | 257 | $dbw->update( 'revision', |
258 | 258 | array( 'rev_page' => $this->mNewTitle->getArticleID() ), |
259 | 259 | array( |
260 | | - 'rev_id IN (' . $idstring . ')', |
| 260 | + 'rev_id' => $this->mIds, |
261 | 261 | 'rev_page' => $this->mOldTitle->getArticleID(), |
262 | 262 | ), |
263 | 263 | __METHOD__ |
— | — | @@ -266,9 +266,8 @@ |
267 | 267 | # Check if we need to update page_latest |
268 | 268 | # Get the latest version of the revisions we are moving |
269 | 269 | $timestampNewPage = $this->queryLatestTimestamp( |
270 | | - $dbw, |
271 | 270 | $this->mNewTitle->getArticleID(), |
272 | | - array( 'rev_id IN (' . $idstring . ')' ) |
| 271 | + array( 'rev_id' => $this->mIds ) |
273 | 272 | ); |
274 | 273 | |
275 | 274 | # Compare the new page's page_latest against db query. |
— | — | @@ -278,17 +277,15 @@ |
279 | 278 | if ( $this->createArticle || $timestampNewPage > $currentNewPageRev->getTimestamp() ) { |
280 | 279 | # we have to set page_latest to $timestampNewPage's revid |
281 | 280 | $this->updatePageLatest( |
282 | | - $dbw, |
283 | 281 | $this->mNewTitle, |
284 | 282 | $newArticle, |
285 | 283 | $timestampNewPage, |
286 | | - array( 'rev_id IN (' . $idstring . ')' ) |
| 284 | + array( 'rev_id' => $this->mIds ) |
287 | 285 | ); |
288 | 286 | } |
289 | 287 | |
290 | 288 | # Update the old page's page_latest field |
291 | 289 | $timestampOldPage = $this->queryLatestTimestamp( |
292 | | - $dbw, |
293 | 290 | $this->mOldTitle->getArticleID() |
294 | 291 | ); |
295 | 292 | |
— | — | @@ -298,7 +295,7 @@ |
299 | 296 | if ( is_null( $timestampOldPage ) ) { |
300 | 297 | $dbw->delete( |
301 | 298 | 'page', |
302 | | - array( 'page_id = ' . $this->mOldTitle->getArticleID() ), |
| 299 | + array( 'page_id' => $this->mOldTitle->getArticleID() ), |
303 | 300 | __METHOD__ |
304 | 301 | ); |
305 | 302 | } else { |
— | — | @@ -306,7 +303,6 @@ |
307 | 304 | $currentOldPageRev = Revision::newFromId( $this->mOldTitle->getLatestRevID() ); |
308 | 305 | if ( $timestampOldPage < $currentOldPageRev->getTimestamp() ) { |
309 | 306 | $this->updatePageLatest( |
310 | | - $dbw, |
311 | 307 | $this->mOldTitle, |
312 | 308 | $oldArticle, |
313 | 309 | $timestampOldPage |
— | — | @@ -331,13 +327,13 @@ |
332 | 328 | /** |
333 | 329 | * Query for the latest timestamp in order to update page_latest and |
334 | 330 | * page_timestamp. |
335 | | - * @param &$dbw Database object (Master) |
336 | 331 | * @param $articleId Integer page_id |
337 | 332 | * @param $conds array database conditions |
338 | 333 | * |
339 | 334 | * @return String timestamp |
340 | 335 | */ |
341 | | - protected function queryLatestTimestamp( &$dbw, $articleId, $conds = array() ) { |
| 336 | + protected function queryLatestTimestamp( $articleId, $conds = array() ) { |
| 337 | + $dbw = wfGetDB( DB_MASTER ); |
342 | 338 | $timestampNewRow = $dbw->selectRow( |
343 | 339 | 'revision', |
344 | 340 | 'max(rev_timestamp) AS maxtime', |
— | — | @@ -351,7 +347,6 @@ |
352 | 348 | * Updates page_latest and similar database fields (see Article::updateRevisionOn). |
353 | 349 | * Called two times, for the new and the old page |
354 | 350 | * |
355 | | - * @param &$dbw Database object (Master) |
356 | 351 | * @param $articleTitle Title object of the page |
357 | 352 | * @param $articleObj Article object of the page |
358 | 353 | * @param $timestamp to search for (use queryLatestTimestamp to get the latest) |
— | — | @@ -359,7 +354,8 @@ |
360 | 355 | * |
361 | 356 | * @return boolean indicating success |
362 | 357 | */ |
363 | | - protected function updatePageLatest( &$dbw, $articleTitle, &$articleObj, $timestamp, $conds = array() ) { |
| 358 | + protected function updatePageLatest( $articleTitle, $articleObj, $timestamp, $conds = array() ) { |
| 359 | + $dbw = wfGetDB( DB_MASTER ); |
364 | 360 | # Query to find out the rev_id |
365 | 361 | $revisionRow = $dbw->selectRow( |
366 | 362 | 'revision', |
— | — | @@ -373,7 +369,8 @@ |
374 | 370 | |
375 | 371 | # Update page_latest |
376 | 372 | $latestRev = Revision::newFromId( $revisionRow->rev_id ); |
377 | | - return $articleObj->updateRevisionOn( $dbw, $latestRev, $articleTitle->getLatestRevID(), null, /* set new page flag */ true ); |
| 373 | + return $articleObj->updateRevisionOn( $dbw, $latestRev, $articleTitle->getLatestRevID(), null, |
| 374 | + /* set new page flag */ true ); |
378 | 375 | } |
379 | 376 | |
380 | 377 | /** |