r25842 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25841‎ | r25842 | r25843 >
Date:00:36, 14 September 2007
Author:yurik
Status:old
Tags:
Comment:
Minimized changes compared to the current trunk to simplify future merge
Modified paths:
  • /branches/apiedit/phase3/includes/Article.php (modified) (history)
  • /branches/apiedit/phase3/includes/AutoLoader.php (modified) (history)
  • /branches/apiedit/phase3/includes/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: branches/apiedit/phase3/includes/SpecialUndelete.php
@@ -270,10 +270,10 @@
271271 $dbw = wfGetDB(DB_MASTER);
272272 $dbw->begin();
273273 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
274 -
 274+
275275 $restoreText = $restoreAll || !empty( $timestamps );
276276 $restoreFiles = $restoreAll || !empty( $fileVersions );
277 -
 277+
278278 if( $restoreFiles && $this->title->getNamespace() == NS_IMAGE ) {
279279 $img = wfLocalFile( $this->title );
280280 $this->fileStatus = $img->restore( $fileVersions );
@@ -281,7 +281,7 @@
282282 } else {
283283 $filesRestored = 0;
284284 }
285 -
 285+
286286 if( $restoreText ) {
287287 $textRestored = $this->undeleteRevisions( $timestamps );
288288 if($textRestored < 0) // It must be one of UNDELETE_*
@@ -319,7 +319,7 @@
320320 $dbw->commit();
321321 return array($textRestored, $filesRestored, $reason);
322322 }
323 -
 323+
324324 /**
325325 * This is the meaty bit -- restores archived revisions of the given page
326326 * to the cur/old tables. If the page currently exists, all revisions will
@@ -755,13 +755,13 @@
756756 $logViewer = new LogViewer(
757757 new LogReader(
758758 new FauxRequest(
759 - array(
 759+ array(
760760 'page' => $this->mTargetObj->getPrefixedText(),
761 - 'type' => 'delete'
762 - )
 761+ 'type' => 'delete'
 762+ )
763763 )
764764 ), LogViewer::NO_ACTION_LINK
765 - );
 765+ );
766766 $logViewer->showList( $wgOut );
767767
768768 if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
@@ -901,7 +901,6 @@
902902 } else {
903903 $wgOut->showFatalError( wfMsg( "cannotundelete" ) );
904904 }
905 -
906905 return false;
907906 }
908907 }
Index: branches/apiedit/phase3/includes/Article.php
@@ -39,14 +39,14 @@
4040 /**
4141 * Constants used by internal components to get rollback results
4242 */
43 - const SUCCESS = 0; // Operation successful
44 - const PERM_DENIED = 1; // Permission denied
45 - const BLOCKED = 2; // User has been blocked
46 - const READONLY = 3; // Wiki is in read-only mode
47 - const BAD_TOKEN = 4; // Invalid token specified
48 - const BAD_TITLE = 5; // $this is not a valid Article
49 - const ALREADY_ROLLED = 6;// Someone else already rolled this back. $from and $summary will be set
50 - const ONLY_AUTHOR = 7; // User is the only author of the page
 43+ const SUCCESS = 0; // Operation successful
 44+ const PERM_DENIED = 1; // Permission denied
 45+ const BLOCKED = 2; // User has been blocked
 46+ const READONLY = 3; // Wiki is in read-only mode
 47+ const BAD_TOKEN = 4; // Invalid token specified
 48+ const BAD_TITLE = 5; // $this is not a valid Article
 49+ const ALREADY_ROLLED = 6; // Someone else already rolled this back. $from and $summary will be set
 50+ const ONLY_AUTHOR = 7; // User is the only author of the page
5151
5252 /**
5353 * Constructor and clear the article
@@ -1465,7 +1465,7 @@
14661466 Article::onArticleCreate( $this->mTitle );
14671467
14681468 wfRunHooks( 'ArticleInsertComplete', array( &$this, &$wgUser, $text, $summary,
1469 - $flags & EDIT_MINOR, null, null, &$flags, $revision ) );
 1469+ $flags & EDIT_MINOR, null, null, &$flags, $revision ) );
14701470 }
14711471
14721472 if ( $good && !( $flags & EDIT_DEFER_UPDATES ) ) {
@@ -2121,8 +2121,8 @@
21222122 'ar_text_id' => 'rev_text_id',
21232123 'ar_text' => '\'\'', // Be explicit to appease
21242124 'ar_flags' => '\'\'', // MySQL's "strict mode"...
2125 - 'ar_len' => 'rev_len',
2126 - 'ar_page_id' => 'page_id'
 2125+ 'ar_len' => 'rev_len',
 2126+ 'ar_page_id' => 'page_id',
21272127 ), array(
21282128 'page_id' => $id,
21292129 'page_id = rev_page'
@@ -2179,22 +2179,21 @@
21802180 * from the same user; fails if there are no eligible edits to
21812181 * roll back to, e.g. user is the sole contributor
21822182 *
2183 - * @param string $fromP - Name of the user whose edits to rollback.
 2183+ * @param string $fromP - Name of the user whose edits to rollback.
21842184 * @param string $summary - Custom summary. Set to default summary if empty.
21852185 * @param string $token - Rollback token.
21862186 * @param bool $bot - If true, mark all reverted edits as bot.
2187 - *
 2187+ *
21882188 * @param array $resultDetails contains result-specific dict of additional values
21892189 * ALREADY_ROLLED : 'current' (rev)
21902190 * SUCCESS : 'summary' (str), 'current' (rev), 'target' (rev)
2191 - *
 2191+ *
21922192 * @return self::SUCCESS on succes, self::* on failure
21932193 */
21942194 public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails ) {
21952195 global $wgUser, $wgUseRCPatrol;
21962196 $resultDetails = null;
21972197
2198 -
21992198 # Just in case it's being called from elsewhere
22002199
22012200 if( $wgUser->isAllowed( 'rollback' ) && $this->mTitle->userCan( 'edit' ) ) {
@@ -2204,10 +2203,11 @@
22052204 } else {
22062205 return self::PERM_DENIED;
22072206 }
2208 -
 2207+
22092208 if ( wfReadOnly() ) {
22102209 return self::READONLY;
22112210 }
 2211+
22122212 if( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) )
22132213 return self::BAD_TOKEN;
22142214
@@ -2278,12 +2278,12 @@
22792279 $resultDetails = array(
22802280 'summary' => $summary,
22812281 'current' => $current,
2282 - 'target' => $target
 2282+ 'target' => $target,
22832283 );
22842284 return self::SUCCESS;
22852285 }
22862286
2287 - /**
 2287+ /**
22882288 * User interface for rollback operations
22892289 */
22902290 function rollback() {
@@ -2360,6 +2360,7 @@
23612361 default:
23622362 throw new MWException( __METHOD__ . ": Unknown return value `{$result}`" );
23632363 }
 2364+
23642365 }
23652366
23662367
@@ -3088,5 +3089,3 @@
30893090 }
30903091
30913092 }
3092 -
3093 -
Index: branches/apiedit/phase3/includes/AutoLoader.php
@@ -295,9 +295,6 @@
296296
297297 # API
298298 'ApiBase' => 'includes/api/ApiBase.php',
299 - 'ApiBlock' => 'includes/api/ApiBlock.php',
300 - 'ApiChangeRights' => 'includes/api/ApiChangeRights.php',
301 - 'ApiDelete' => 'includes/api/ApiDelete.php',
302299 'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php',
303300 'ApiFeedWatchlist' => 'includes/api/ApiFeedWatchlist.php',
304301 'ApiFormatBase' => 'includes/api/ApiFormatBase.php',
@@ -313,7 +310,6 @@
314311 'ApiMain' => 'includes/api/ApiMain.php',
315312 'ApiOpenSearch' => 'includes/api/ApiOpenSearch.php',
316313 'ApiPageSet' => 'includes/api/ApiPageSet.php',
317 - 'ApiProtect' => 'includes/api/ApiProtect.php',
318314 'ApiQuery' => 'includes/api/ApiQuery.php',
319315 'ApiQueryAllpages' => 'includes/api/ApiQueryAllpages.php',
320316 'ApiQueryAllLinks' => 'includes/api/ApiQueryAllLinks.php',
@@ -321,11 +317,9 @@
322318 'ApiQueryBase' => 'includes/api/ApiQueryBase.php',
323319 'ApiQueryGeneratorBase' => 'includes/api/ApiQueryBase.php',
324320 'ApiQueryBacklinks' => 'includes/api/ApiQueryBacklinks.php',
325 - 'ApiQueryBlocks' => 'includes/api/ApiQueryBlocks.php',
326321 'ApiQueryCategories' => 'includes/api/ApiQueryCategories.php',
327322 'ApiQueryCategoryMembers' => 'includes/api/ApiQueryCategoryMembers.php',
328323 'ApiQueryContributions' => 'includes/api/ApiQueryUserContributions.php',
329 - 'ApiQueryDeletedrevs' => 'includes/api/ApiQueryDeletedrevs.php',
330324 'ApiQueryExternalLinks' => 'includes/api/ApiQueryExternalLinks.php',
331325 'ApiQueryExtLinksUsage' => 'includes/api/ApiQueryExtLinksUsage.php',
332326 'ApiQueryImages' => 'includes/api/ApiQueryImages.php',
@@ -341,6 +335,14 @@
342336 'ApiQueryUserInfo' => 'includes/api/ApiQueryUserInfo.php',
343337 'ApiQueryWatchlist' => 'includes/api/ApiQueryWatchlist.php',
344338 'ApiResult' => 'includes/api/ApiResult.php',
 339+
 340+ # apiedit branch
 341+ 'ApiBlock' => 'includes/api/ApiBlock.php',
 342+ 'ApiChangeRights' => 'includes/api/ApiChangeRights.php',
 343+ 'ApiDelete' => 'includes/api/ApiDelete.php',
 344+ 'ApiProtect' => 'includes/api/ApiProtect.php',
 345+ 'ApiQueryBlocks' => 'includes/api/ApiQueryBlocks.php',
 346+ 'ApiQueryDeletedrevs' => 'includes/api/ApiQueryDeletedrevs.php',
345347 'ApiRollback' => 'includes/api/ApiRollback.php',
346348 'ApiUnblock' => 'includes/api/ApiUnblock.php',
347349 'ApiUndelete' => 'includes/api/ApiUndelete.php'
@@ -393,4 +395,4 @@
394396 require( $file );
395397 }
396398 }
397 -}
 399+}
\ No newline at end of file

Status & tagging log