Index: branches/apiedit/phase3/includes/SpecialUndelete.php |
— | — | @@ -270,10 +270,10 @@ |
271 | 271 | $dbw = wfGetDB(DB_MASTER); |
272 | 272 | $dbw->begin(); |
273 | 273 | $restoreAll = empty( $timestamps ) && empty( $fileVersions ); |
274 | | - |
| 274 | + |
275 | 275 | $restoreText = $restoreAll || !empty( $timestamps ); |
276 | 276 | $restoreFiles = $restoreAll || !empty( $fileVersions ); |
277 | | - |
| 277 | + |
278 | 278 | if( $restoreFiles && $this->title->getNamespace() == NS_IMAGE ) { |
279 | 279 | $img = wfLocalFile( $this->title ); |
280 | 280 | $this->fileStatus = $img->restore( $fileVersions ); |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | } else { |
283 | 283 | $filesRestored = 0; |
284 | 284 | } |
285 | | - |
| 285 | + |
286 | 286 | if( $restoreText ) { |
287 | 287 | $textRestored = $this->undeleteRevisions( $timestamps ); |
288 | 288 | if($textRestored < 0) // It must be one of UNDELETE_* |
— | — | @@ -319,7 +319,7 @@ |
320 | 320 | $dbw->commit(); |
321 | 321 | return array($textRestored, $filesRestored, $reason); |
322 | 322 | } |
323 | | - |
| 323 | + |
324 | 324 | /** |
325 | 325 | * This is the meaty bit -- restores archived revisions of the given page |
326 | 326 | * to the cur/old tables. If the page currently exists, all revisions will |
— | — | @@ -755,13 +755,13 @@ |
756 | 756 | $logViewer = new LogViewer( |
757 | 757 | new LogReader( |
758 | 758 | new FauxRequest( |
759 | | - array( |
| 759 | + array( |
760 | 760 | 'page' => $this->mTargetObj->getPrefixedText(), |
761 | | - 'type' => 'delete' |
762 | | - ) |
| 761 | + 'type' => 'delete' |
| 762 | + ) |
763 | 763 | ) |
764 | 764 | ), LogViewer::NO_ACTION_LINK |
765 | | - ); |
| 765 | + ); |
766 | 766 | $logViewer->showList( $wgOut ); |
767 | 767 | |
768 | 768 | if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) { |
— | — | @@ -901,7 +901,6 @@ |
902 | 902 | } else { |
903 | 903 | $wgOut->showFatalError( wfMsg( "cannotundelete" ) ); |
904 | 904 | } |
905 | | - |
906 | 905 | return false; |
907 | 906 | } |
908 | 907 | } |
Index: branches/apiedit/phase3/includes/Article.php |
— | — | @@ -39,14 +39,14 @@ |
40 | 40 | /** |
41 | 41 | * Constants used by internal components to get rollback results |
42 | 42 | */ |
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 |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Constructor and clear the article |
— | — | @@ -1465,7 +1465,7 @@ |
1466 | 1466 | Article::onArticleCreate( $this->mTitle ); |
1467 | 1467 | |
1468 | 1468 | wfRunHooks( 'ArticleInsertComplete', array( &$this, &$wgUser, $text, $summary, |
1469 | | - $flags & EDIT_MINOR, null, null, &$flags, $revision ) ); |
| 1469 | + $flags & EDIT_MINOR, null, null, &$flags, $revision ) ); |
1470 | 1470 | } |
1471 | 1471 | |
1472 | 1472 | if ( $good && !( $flags & EDIT_DEFER_UPDATES ) ) { |
— | — | @@ -2121,8 +2121,8 @@ |
2122 | 2122 | 'ar_text_id' => 'rev_text_id', |
2123 | 2123 | 'ar_text' => '\'\'', // Be explicit to appease |
2124 | 2124 | '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', |
2127 | 2127 | ), array( |
2128 | 2128 | 'page_id' => $id, |
2129 | 2129 | 'page_id = rev_page' |
— | — | @@ -2179,22 +2179,21 @@ |
2180 | 2180 | * from the same user; fails if there are no eligible edits to |
2181 | 2181 | * roll back to, e.g. user is the sole contributor |
2182 | 2182 | * |
2183 | | - * @param string $fromP - Name of the user whose edits to rollback. |
| 2183 | + * @param string $fromP - Name of the user whose edits to rollback. |
2184 | 2184 | * @param string $summary - Custom summary. Set to default summary if empty. |
2185 | 2185 | * @param string $token - Rollback token. |
2186 | 2186 | * @param bool $bot - If true, mark all reverted edits as bot. |
2187 | | - * |
| 2187 | + * |
2188 | 2188 | * @param array $resultDetails contains result-specific dict of additional values |
2189 | 2189 | * ALREADY_ROLLED : 'current' (rev) |
2190 | 2190 | * SUCCESS : 'summary' (str), 'current' (rev), 'target' (rev) |
2191 | | - * |
| 2191 | + * |
2192 | 2192 | * @return self::SUCCESS on succes, self::* on failure |
2193 | 2193 | */ |
2194 | 2194 | public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails ) { |
2195 | 2195 | global $wgUser, $wgUseRCPatrol; |
2196 | 2196 | $resultDetails = null; |
2197 | 2197 | |
2198 | | - |
2199 | 2198 | # Just in case it's being called from elsewhere |
2200 | 2199 | |
2201 | 2200 | if( $wgUser->isAllowed( 'rollback' ) && $this->mTitle->userCan( 'edit' ) ) { |
— | — | @@ -2204,10 +2203,11 @@ |
2205 | 2204 | } else { |
2206 | 2205 | return self::PERM_DENIED; |
2207 | 2206 | } |
2208 | | - |
| 2207 | + |
2209 | 2208 | if ( wfReadOnly() ) { |
2210 | 2209 | return self::READONLY; |
2211 | 2210 | } |
| 2211 | + |
2212 | 2212 | if( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) ) |
2213 | 2213 | return self::BAD_TOKEN; |
2214 | 2214 | |
— | — | @@ -2278,12 +2278,12 @@ |
2279 | 2279 | $resultDetails = array( |
2280 | 2280 | 'summary' => $summary, |
2281 | 2281 | 'current' => $current, |
2282 | | - 'target' => $target |
| 2282 | + 'target' => $target, |
2283 | 2283 | ); |
2284 | 2284 | return self::SUCCESS; |
2285 | 2285 | } |
2286 | 2286 | |
2287 | | - /** |
| 2287 | + /** |
2288 | 2288 | * User interface for rollback operations |
2289 | 2289 | */ |
2290 | 2290 | function rollback() { |
— | — | @@ -2360,6 +2360,7 @@ |
2361 | 2361 | default: |
2362 | 2362 | throw new MWException( __METHOD__ . ": Unknown return value `{$result}`" ); |
2363 | 2363 | } |
| 2364 | + |
2364 | 2365 | } |
2365 | 2366 | |
2366 | 2367 | |
— | — | @@ -3088,5 +3089,3 @@ |
3089 | 3090 | } |
3090 | 3091 | |
3091 | 3092 | } |
3092 | | - |
3093 | | - |
Index: branches/apiedit/phase3/includes/AutoLoader.php |
— | — | @@ -295,9 +295,6 @@ |
296 | 296 | |
297 | 297 | # API |
298 | 298 | 'ApiBase' => 'includes/api/ApiBase.php', |
299 | | - 'ApiBlock' => 'includes/api/ApiBlock.php', |
300 | | - 'ApiChangeRights' => 'includes/api/ApiChangeRights.php', |
301 | | - 'ApiDelete' => 'includes/api/ApiDelete.php', |
302 | 299 | 'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php', |
303 | 300 | 'ApiFeedWatchlist' => 'includes/api/ApiFeedWatchlist.php', |
304 | 301 | 'ApiFormatBase' => 'includes/api/ApiFormatBase.php', |
— | — | @@ -313,7 +310,6 @@ |
314 | 311 | 'ApiMain' => 'includes/api/ApiMain.php', |
315 | 312 | 'ApiOpenSearch' => 'includes/api/ApiOpenSearch.php', |
316 | 313 | 'ApiPageSet' => 'includes/api/ApiPageSet.php', |
317 | | - 'ApiProtect' => 'includes/api/ApiProtect.php', |
318 | 314 | 'ApiQuery' => 'includes/api/ApiQuery.php', |
319 | 315 | 'ApiQueryAllpages' => 'includes/api/ApiQueryAllpages.php', |
320 | 316 | 'ApiQueryAllLinks' => 'includes/api/ApiQueryAllLinks.php', |
— | — | @@ -321,11 +317,9 @@ |
322 | 318 | 'ApiQueryBase' => 'includes/api/ApiQueryBase.php', |
323 | 319 | 'ApiQueryGeneratorBase' => 'includes/api/ApiQueryBase.php', |
324 | 320 | 'ApiQueryBacklinks' => 'includes/api/ApiQueryBacklinks.php', |
325 | | - 'ApiQueryBlocks' => 'includes/api/ApiQueryBlocks.php', |
326 | 321 | 'ApiQueryCategories' => 'includes/api/ApiQueryCategories.php', |
327 | 322 | 'ApiQueryCategoryMembers' => 'includes/api/ApiQueryCategoryMembers.php', |
328 | 323 | 'ApiQueryContributions' => 'includes/api/ApiQueryUserContributions.php', |
329 | | - 'ApiQueryDeletedrevs' => 'includes/api/ApiQueryDeletedrevs.php', |
330 | 324 | 'ApiQueryExternalLinks' => 'includes/api/ApiQueryExternalLinks.php', |
331 | 325 | 'ApiQueryExtLinksUsage' => 'includes/api/ApiQueryExtLinksUsage.php', |
332 | 326 | 'ApiQueryImages' => 'includes/api/ApiQueryImages.php', |
— | — | @@ -341,6 +335,14 @@ |
342 | 336 | 'ApiQueryUserInfo' => 'includes/api/ApiQueryUserInfo.php', |
343 | 337 | 'ApiQueryWatchlist' => 'includes/api/ApiQueryWatchlist.php', |
344 | 338 | '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', |
345 | 347 | 'ApiRollback' => 'includes/api/ApiRollback.php', |
346 | 348 | 'ApiUnblock' => 'includes/api/ApiUnblock.php', |
347 | 349 | 'ApiUndelete' => 'includes/api/ApiUndelete.php' |
— | — | @@ -393,4 +395,4 @@ |
394 | 396 | require( $file ); |
395 | 397 | } |
396 | 398 | } |
397 | | -} |
| 399 | +} |
\ No newline at end of file |