r68687 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68686‎ | r68687 | r68688 >
Date:22:13, 28 June 2010
Author:siebrand
Status:ok
Tags:
Comment:
Remove trailing whitespace, run stylize.php, update whitespace
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisionMove.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRevisionMove.php
@@ -20,7 +20,7 @@
2121 /**
2222 * Special page allowing users with the appropriate permissions to
2323 * move revisions of a page to a new target (either an existing page or not)
24 - *
 24+ *
2525 * The user selects revisions in the page history (HistoryPage.php),
2626 * clicks on the submit button and gets this special page.
2727 * A form is shown (showForm()) where the user has to enter a target page
@@ -29,10 +29,10 @@
3030 * If the target doesn't exist, a new page gets created. rev_page of the
3131 * selected revisions is updated, after that it is determined whether page_latest
3232 * of the target page and the source page require an update.
33 - *
 33+ *
3434 * **** NOTE: This feature is EXPERIMENTAL. ****
3535 * **** Do not use on any productive system. ****
36 - *
 36+ *
3737 * @file
3838 * @ingroup SpecialPage
3939 */
@@ -45,7 +45,6 @@
4646 */
4747
4848 class SpecialRevisionMove extends UnlistedSpecialPage {
49 -
5049 # common objects
5150 var $mOldTitle; # Title object.
5251 var $mNewTitle; # Title object. Desired new title
@@ -66,7 +65,7 @@
6766
6867 /**
6968 * @param $par subpage part, standard special page parameter, is ignored here
70 - *
 69+ *
7170 * Mostly initializes variables and calls either showForm() or submit()
7271 */
7372 public function execute( $par ) {
@@ -78,6 +77,7 @@
7978 $this->mIsAllowedRevisionMove = $wgUser->isAllowed( 'revisionmove' );
8079 $this->user = $wgUser;
8180 $this->skin = $wgUser->getSkin();
 81+
8282 if ( !$this->request instanceof WebRequest ) {
8383 $this->request = $GLOBALS['wgRequest'];
8484 }
@@ -125,7 +125,6 @@
126126 } else {
127127 $this->showForm();
128128 }
129 -
130129 }
131130
132131 /**
@@ -147,14 +146,14 @@
148147 }
149148
150149 $out = Xml::openElement( 'form', array( 'method' => 'post',
151 - 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
 150+ 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
152151 'id' => 'mw-revmove-form' ) ) .
153152 Xml::fieldset( wfMsg( 'revmove-legend' ) ) .
154153 Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .
155154 Xml::hidden( 'oldTitle', $this->mOldTitle->getPrefixedText() ) .
156155 '<div>' . Xml::inputLabel( wfMsg( 'revmove-reasonfield' ), 'wpReason', 'revmove-reasonfield', 60 ) . '</div>' .
157156 Xml::inputLabel( wfMsg( 'revmove-titlefield' ), 'newTitle', 'revmove-titlefield', 20, $this->mOldTitle->getPrefixedText() ) .
158 - Xml::hidden( 'ids', implode( ',', $this->mIds ) ) .
 157+ Xml::hidden( 'ids', implode( ',', $this->mIds ) ) .
159158 Xml::submitButton( wfMsg( 'revmove-submit' ),
160159 array( 'name' => 'wpSubmit' ) ) .
161160 Xml::closeElement( 'fieldset' ) . "\n" .
@@ -185,18 +184,19 @@
186185 }
187186
188187 # No valid revisions specified (e.g. only revs belonging to another page)
189 - if( $numRevisions == 0 ) {
 188+ if ( $numRevisions == 0 ) {
190189 $wgOut->showErrorPage( 'revmove-norevisions-title', 'revmove-norevisions' );
191190 return false;
192191 }
193 -
 192+
194193 $wgOut->addHTML( "</ul>" );
 194+
195195 return true;
196196 }
197197
198198 /**
199199 * Submit the posted changes (in $this->request).
200 - *
 200+ *
201201 * This function does some checks and then calls moveRevisions(), which does the real work
202202 */
203203 public function submit() {
@@ -208,8 +208,9 @@
209209 $wgOut->showPermissionsErrorPage( $permErrors, 'revisionmove' );
210210 return false;
211211 }
 212+
212213 # Confirm Token
213 - if( !$wgUser->matchEditToken( $this->request->getVal( 'wpEditToken' ) ) ) {
 214+ if ( !$wgUser->matchEditToken( $this->request->getVal( 'wpEditToken' ) ) ) {
214215 $wgOut->showErrorPage( 'sessionfailure-title', 'sessionfailure' );
215216 return false;
216217 }
@@ -256,7 +257,7 @@
257258 # Update revision table
258259 $dbw->update( 'revision',
259260 array( 'rev_page' => $this->mNewTitle->getArticleID() ),
260 - array(
 261+ array(
261262 'rev_id IN (' . $idstring . ')',
262263 'rev_page' => $this->mOldTitle->getArticleID(),
263264 ),
@@ -266,7 +267,7 @@
267268
268269 # Check if we need to update page_latest
269270 # Get the latest version of the revisions we are moving
270 - $timestampNewPage = $this->queryLatestTimestamp(
 271+ $timestampNewPage = $this->queryLatestTimestamp(
271272 $dbw,
272273 $this->mNewTitle->getArticleID(),
273274 array( 'rev_id IN (' . $idstring . ')' )
@@ -278,17 +279,17 @@
279280 $currentNewPageRev = Revision::newFromId( $this->mNewTitle->getLatestRevID() );
280281 if ( $this->createArticle || $timestampNewPage > $currentNewPageRev->getTimestamp() ) {
281282 # we have to set page_latest to $timestampNewPage's revid
282 - $this->updatePageLatest(
283 - $dbw,
 283+ $this->updatePageLatest(
 284+ $dbw,
284285 $this->mNewTitle,
285286 $newArticle,
286 - $timestampNewPage,
 287+ $timestampNewPage,
287288 array( 'rev_id IN (' . $idstring . ')' )
288289 );
289290 }
290291
291292 # Update the old page's page_latest field
292 - $timestampOldPage = $this->queryLatestTimestamp(
 293+ $timestampOldPage = $this->queryLatestTimestamp(
293294 $dbw,
294295 $this->mOldTitle->getArticleID()
295296 );
@@ -307,8 +308,8 @@
308309 # page_latest has to be updated
309310 $currentOldPageRev = Revision::newFromId( $this->mOldTitle->getLatestRevID() );
310311 if ( $timestampOldPage < $currentOldPageRev->getTimestamp() ) {
311 - $this->updatePageLatest(
312 - $dbw,
 312+ $this->updatePageLatest(
 313+ $dbw,
313314 $this->mOldTitle,
314315 $oldArticle,
315316 $timestampOldPage
@@ -336,12 +337,12 @@
337338 * @param &$dbw Database object (Master)
338339 * @param $articleId Integer page_id
339340 * @param $conds array database conditions
340 - *
 341+ *
341342 * @return String timestamp
342343 */
343344 protected function queryLatestTimestamp( &$dbw, $articleId, $conds = array() ) {
344 - $timestampNewRow = $dbw->selectRow(
345 - 'revision',
 345+ $timestampNewRow = $dbw->selectRow(
 346+ 'revision',
346347 'max(rev_timestamp) as maxtime',
347348 array_merge( array( 'rev_page' => $articleId ), $conds ),
348349 __METHOD__
@@ -352,19 +353,19 @@
353354 /**
354355 * Updates page_latest and similar database fields (see Article::updateRevisionOn).
355356 * Called two times, for the new and the old page
356 - *
 357+ *
357358 * @param &$dbw Database object (Master)
358359 * @param $articleTitle Title object of the page
359360 * @param $articleObj Article object of the page
360361 * @param $timestamp to search for (use queryLatestTimestamp to get the latest)
361362 * @param $conds array database conditions
362 - *
 363+ *
363364 * @return boolean indicating success
364365 */
365366 protected function updatePageLatest( &$dbw, $articleTitle, &$articleObj, $timestamp, $conds = array() ) {
366367 # Query to find out the rev_id
367 - $revisionRow = $dbw->selectRow(
368 - 'revision',
 368+ $revisionRow = $dbw->selectRow(
 369+ 'revision',
369370 'rev_id',
370371 array_merge( array(
371372 'rev_timestamp' => $timestamp,
@@ -372,6 +373,7 @@
373374 ), $conds ),
374375 __METHOD__
375376 );
 377+
376378 # Update page_latest
377379 $latestRev = Revision::newFromId( $revisionRow->rev_id );
378380 return $articleObj->updateRevisionOn( $dbw, $latestRev, $articleTitle->getLatestRevID(), null, /* set new page flag */ true );
@@ -385,19 +387,19 @@
386388 $this->mNewTitle->getPrefixedText(),
387389 $modifiedRevsNum
388390 );
 391+
389392 $log = new LogPage( 'move' );
390393 $log->addEntry( 'move_rev', $this->mOldTitle, $this->mReason, $paramArray, $this->user );
391 -
392394 }
393395
394396 protected function showSuccess( $modifiedRevsNum ) {
395397 global $wgOut;
396398
397399 if ( $this->createArticle ) {
398 - $wgOut->addWikiMsg( 'revmove-success-created', $modifiedRevsNum,
 400+ $wgOut->addWikiMsg( 'revmove-success-created', $modifiedRevsNum,
399401 $this->mOldTitle->getPrefixedText(), $this->mNewTitle->getPrefixedText() );
400402 } else {
401 - $wgOut->addWikiMsg( 'revmove-success-existing', $modifiedRevsNum,
 403+ $wgOut->addWikiMsg( 'revmove-success-existing', $modifiedRevsNum,
402404 $this->mOldTitle->getPrefixedText(), $this->mNewTitle->getPrefixedText() );
403405 }
404406 }

Status & tagging log