MediaWiki  REL1_24
ApiEditPage.php
Go to the documentation of this file.
00001 <?php
00034 class ApiEditPage extends ApiBase {
00035     public function execute() {
00036         $user = $this->getUser();
00037         $params = $this->extractRequestParams();
00038 
00039         if ( is_null( $params['text'] ) && is_null( $params['appendtext'] ) &&
00040             is_null( $params['prependtext'] ) &&
00041             $params['undo'] == 0
00042         ) {
00043             $this->dieUsageMsg( 'missingtext' );
00044         }
00045 
00046         $pageObj = $this->getTitleOrPageId( $params );
00047         $titleObj = $pageObj->getTitle();
00048         $apiResult = $this->getResult();
00049 
00050         if ( $params['redirect'] ) {
00051             if ( $params['prependtext'] === null && $params['appendtext'] === null && $params['section'] !== 'new' ) {
00052                 $this->dieUsage( 'You have attempted to edit using the "redirect"-following mode, which must be used in conjuction with section=new, prependtext, or appendtext.', 'redirect-appendonly' );
00053             }
00054             if ( $titleObj->isRedirect() ) {
00055                 $oldTitle = $titleObj;
00056 
00057                 $titles = Revision::newFromTitle( $oldTitle, false, Revision::READ_LATEST )
00058                     ->getContent( Revision::FOR_THIS_USER, $user )
00059                     ->getRedirectChain();
00060                 // array_shift( $titles );
00061 
00062                 $redirValues = array();
00063 
00065                 foreach ( $titles as $id => $newTitle ) {
00066 
00067                     if ( !isset( $titles[$id - 1] ) ) {
00068                         $titles[$id - 1] = $oldTitle;
00069                     }
00070 
00071                     $redirValues[] = array(
00072                         'from' => $titles[$id - 1]->getPrefixedText(),
00073                         'to' => $newTitle->getPrefixedText()
00074                     );
00075 
00076                     $titleObj = $newTitle;
00077                 }
00078 
00079                 $apiResult->setIndexedTagName( $redirValues, 'r' );
00080                 $apiResult->addValue( null, 'redirects', $redirValues );
00081 
00082                 // Since the page changed, update $pageObj
00083                 $pageObj = WikiPage::factory( $titleObj );
00084             }
00085         }
00086 
00087         if ( !isset( $params['contentmodel'] ) || $params['contentmodel'] == '' ) {
00088             $contentHandler = $pageObj->getContentHandler();
00089         } else {
00090             $contentHandler = ContentHandler::getForModelID( $params['contentmodel'] );
00091         }
00092 
00093         // @todo Ask handler whether direct editing is supported at all! make
00094         // allowFlatEdit() method or some such
00095 
00096         if ( !isset( $params['contentformat'] ) || $params['contentformat'] == '' ) {
00097             $params['contentformat'] = $contentHandler->getDefaultFormat();
00098         }
00099 
00100         $contentFormat = $params['contentformat'];
00101 
00102         if ( !$contentHandler->isSupportedFormat( $contentFormat ) ) {
00103             $name = $titleObj->getPrefixedDBkey();
00104             $model = $contentHandler->getModelID();
00105 
00106             $this->dieUsage( "The requested format $contentFormat is not supported for content model " .
00107                 " $model used by $name", 'badformat' );
00108         }
00109 
00110         if ( $params['createonly'] && $titleObj->exists() ) {
00111             $this->dieUsageMsg( 'createonly-exists' );
00112         }
00113         if ( $params['nocreate'] && !$titleObj->exists() ) {
00114             $this->dieUsageMsg( 'nocreate-missing' );
00115         }
00116 
00117         // Now let's check whether we're even allowed to do this
00118         $errors = $titleObj->getUserPermissionsErrors( 'edit', $user );
00119         if ( !$titleObj->exists() ) {
00120             $errors = array_merge( $errors, $titleObj->getUserPermissionsErrors( 'create', $user ) );
00121         }
00122         if ( count( $errors ) ) {
00123             $this->dieUsageMsg( $errors[0] );
00124         }
00125 
00126         $toMD5 = $params['text'];
00127         if ( !is_null( $params['appendtext'] ) || !is_null( $params['prependtext'] ) ) {
00128             $content = $pageObj->getContent();
00129 
00130             if ( !$content ) {
00131                 if ( $titleObj->getNamespace() == NS_MEDIAWIKI ) {
00132                     # If this is a MediaWiki:x message, then load the messages
00133                     # and return the message value for x.
00134                     $text = $titleObj->getDefaultMessageText();
00135                     if ( $text === false ) {
00136                         $text = '';
00137                     }
00138 
00139                     try {
00140                         $content = ContentHandler::makeContent( $text, $this->getTitle() );
00141                     } catch ( MWContentSerializationException $ex ) {
00142                         $this->dieUsage( $ex->getMessage(), 'parseerror' );
00143 
00144                         return;
00145                     }
00146                 } else {
00147                     # Otherwise, make a new empty content.
00148                     $content = $contentHandler->makeEmptyContent();
00149                 }
00150             }
00151 
00152             // @todo Add support for appending/prepending to the Content interface
00153 
00154             if ( !( $content instanceof TextContent ) ) {
00155                 $mode = $contentHandler->getModelID();
00156                 $this->dieUsage( "Can't append to pages using content model $mode", 'appendnotsupported' );
00157             }
00158 
00159             if ( !is_null( $params['section'] ) ) {
00160                 if ( !$contentHandler->supportsSections() ) {
00161                     $modelName = $contentHandler->getModelID();
00162                     $this->dieUsage(
00163                         "Sections are not supported for this content model: $modelName.",
00164                         'sectionsnotsupported'
00165                     );
00166                 }
00167 
00168                 if ( $params['section'] == 'new' ) {
00169                     // DWIM if they're trying to prepend/append to a new section.
00170                     $content = null;
00171                 } else {
00172                     // Process the content for section edits
00173                     $section = $params['section'];
00174                     $content = $content->getSection( $section );
00175 
00176                     if ( !$content ) {
00177                         $this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
00178                     }
00179                 }
00180             }
00181 
00182             if ( !$content ) {
00183                 $text = '';
00184             } else {
00185                 $text = $content->serialize( $contentFormat );
00186             }
00187 
00188             $params['text'] = $params['prependtext'] . $text . $params['appendtext'];
00189             $toMD5 = $params['prependtext'] . $params['appendtext'];
00190         }
00191 
00192         if ( $params['undo'] > 0 ) {
00193             if ( $params['undoafter'] > 0 ) {
00194                 if ( $params['undo'] < $params['undoafter'] ) {
00195                     list( $params['undo'], $params['undoafter'] ) =
00196                         array( $params['undoafter'], $params['undo'] );
00197                 }
00198                 $undoafterRev = Revision::newFromID( $params['undoafter'] );
00199             }
00200             $undoRev = Revision::newFromID( $params['undo'] );
00201             if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) ) {
00202                 $this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) );
00203             }
00204 
00205             if ( $params['undoafter'] == 0 ) {
00206                 $undoafterRev = $undoRev->getPrevious();
00207             }
00208             if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) ) {
00209                 $this->dieUsageMsg( array( 'nosuchrevid', $params['undoafter'] ) );
00210             }
00211 
00212             if ( $undoRev->getPage() != $pageObj->getID() ) {
00213                 $this->dieUsageMsg( array( 'revwrongpage', $undoRev->getID(),
00214                     $titleObj->getPrefixedText() ) );
00215             }
00216             if ( $undoafterRev->getPage() != $pageObj->getID() ) {
00217                 $this->dieUsageMsg( array( 'revwrongpage', $undoafterRev->getID(),
00218                     $titleObj->getPrefixedText() ) );
00219             }
00220 
00221             $newContent = $contentHandler->getUndoContent(
00222                 $pageObj->getRevision(),
00223                 $undoRev,
00224                 $undoafterRev
00225             );
00226 
00227             if ( !$newContent ) {
00228                 $this->dieUsageMsg( 'undo-failure' );
00229             }
00230 
00231             $params['text'] = $newContent->serialize( $params['contentformat'] );
00232 
00233             // If no summary was given and we only undid one rev,
00234             // use an autosummary
00235             if ( is_null( $params['summary'] ) &&
00236                 $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo']
00237             ) {
00238                 $params['summary'] = wfMessage( 'undo-summary' )
00239                     ->params ( $params['undo'], $undoRev->getUserText() )->inContentLanguage()->text();
00240             }
00241         }
00242 
00243         // See if the MD5 hash checks out
00244         if ( !is_null( $params['md5'] ) && md5( $toMD5 ) !== $params['md5'] ) {
00245             $this->dieUsageMsg( 'hashcheckfailed' );
00246         }
00247 
00248         // EditPage wants to parse its stuff from a WebRequest
00249         // That interface kind of sucks, but it's workable
00250         $requestArray = array(
00251             'wpTextbox1' => $params['text'],
00252             'format' => $contentFormat,
00253             'model' => $contentHandler->getModelID(),
00254             'wpEditToken' => $params['token'],
00255             'wpIgnoreBlankSummary' => '',
00256             'wpIgnoreBlankArticle' => true
00257         );
00258 
00259         if ( !is_null( $params['summary'] ) ) {
00260             $requestArray['wpSummary'] = $params['summary'];
00261         }
00262 
00263         if ( !is_null( $params['sectiontitle'] ) ) {
00264             $requestArray['wpSectionTitle'] = $params['sectiontitle'];
00265         }
00266 
00267         // TODO: Pass along information from 'undoafter' as well
00268         if ( $params['undo'] > 0 ) {
00269             $requestArray['wpUndidRevision'] = $params['undo'];
00270         }
00271 
00272         // Watch out for basetimestamp == ''
00273         // wfTimestamp() treats it as NOW, almost certainly causing an edit conflict
00274         if ( !is_null( $params['basetimestamp'] ) && $params['basetimestamp'] != '' ) {
00275             $requestArray['wpEdittime'] = wfTimestamp( TS_MW, $params['basetimestamp'] );
00276         } else {
00277             $requestArray['wpEdittime'] = $pageObj->getTimestamp();
00278         }
00279 
00280         if ( !is_null( $params['starttimestamp'] ) && $params['starttimestamp'] != '' ) {
00281             $requestArray['wpStarttime'] = wfTimestamp( TS_MW, $params['starttimestamp'] );
00282         } else {
00283             $requestArray['wpStarttime'] = wfTimestampNow(); // Fake wpStartime
00284         }
00285 
00286         if ( $params['minor'] || ( !$params['notminor'] && $user->getOption( 'minordefault' ) ) ) {
00287             $requestArray['wpMinoredit'] = '';
00288         }
00289 
00290         if ( $params['recreate'] ) {
00291             $requestArray['wpRecreate'] = '';
00292         }
00293 
00294         if ( !is_null( $params['section'] ) ) {
00295             $section = $params['section'];
00296             if ( !preg_match( '/^((T-)?\d+|new)$/', $section ) ) {
00297                 $this->dieUsage( "The section parameter must be a valid section id or 'new'", "invalidsection" );
00298             }
00299             $content = $pageObj->getContent();
00300             if ( $section !== '0' && $section != 'new' && ( !$content || !$content->getSection( $section ) ) ) {
00301                 $this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
00302             }
00303             $requestArray['wpSection'] = $params['section'];
00304         } else {
00305             $requestArray['wpSection'] = '';
00306         }
00307 
00308         $watch = $this->getWatchlistValue( $params['watchlist'], $titleObj );
00309 
00310         // Deprecated parameters
00311         if ( $params['watch'] ) {
00312             $this->logFeatureUsage( 'action=edit&watch' );
00313             $watch = true;
00314         } elseif ( $params['unwatch'] ) {
00315             $this->logFeatureUsage( 'action=edit&unwatch' );
00316             $watch = false;
00317         }
00318 
00319         if ( $watch ) {
00320             $requestArray['wpWatchthis'] = '';
00321         }
00322 
00323         // Pass through anything else we might have been given, to support extensions
00324         // This is kind of a hack but it's the best we can do to make extensions work
00325         $requestArray += $this->getRequest()->getValues();
00326 
00327         global $wgTitle, $wgRequest;
00328 
00329         $req = new DerivativeRequest( $this->getRequest(), $requestArray, true );
00330 
00331         // Some functions depend on $wgTitle == $ep->mTitle
00332         // TODO: Make them not or check if they still do
00333         $wgTitle = $titleObj;
00334 
00335         $articleContext = new RequestContext;
00336         $articleContext->setRequest( $req );
00337         $articleContext->setWikiPage( $pageObj );
00338         $articleContext->setUser( $this->getUser() );
00339 
00341         $articleObject = Article::newFromWikiPage( $pageObj, $articleContext );
00342 
00343         $ep = new EditPage( $articleObject );
00344 
00345         // allow editing of non-textual content.
00346         $ep->allowNonTextContent = true;
00347 
00348         $ep->setContextTitle( $titleObj );
00349         $ep->importFormData( $req );
00350         $content = $ep->textbox1;
00351 
00352         // The following is needed to give the hook the full content of the
00353         // new revision rather than just the current section. (Bug 52077)
00354         if ( !is_null( $params['section'] ) &&
00355             $contentHandler->supportsSections() && $titleObj->exists()
00356         ) {
00357             // If sectiontitle is set, use it, otherwise use the summary as the section title (for
00358             // backwards compatibility with old forms/bots).
00359             if ( $ep->sectiontitle !== '' ) {
00360                 $sectionTitle = $ep->sectiontitle;
00361             } else {
00362                 $sectionTitle = $ep->summary;
00363             }
00364 
00365             $contentObj = $contentHandler->unserializeContent( $content, $contentFormat );
00366 
00367             $fullContentObj = $articleObject->replaceSectionContent(
00368                 $params['section'],
00369                 $contentObj,
00370                 $sectionTitle
00371             );
00372             if ( $fullContentObj ) {
00373                 $content = $fullContentObj->serialize( $contentFormat );
00374             } else {
00375                 // This most likely means we have an edit conflict which means that the edit
00376                 // wont succeed anyway.
00377                 $this->dieUsageMsg( 'editconflict' );
00378             }
00379         }
00380 
00381         // Run hooks
00382         // Handle APIEditBeforeSave parameters
00383         $r = array();
00384         if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $content, &$r ) ) ) {
00385             if ( count( $r ) ) {
00386                 $r['result'] = 'Failure';
00387                 $apiResult->addValue( null, $this->getModuleName(), $r );
00388 
00389                 return;
00390             }
00391 
00392             $this->dieUsageMsg( 'hookaborted' );
00393         }
00394 
00395         // Do the actual save
00396         $oldRevId = $articleObject->getRevIdFetched();
00397         $result = null;
00398         // Fake $wgRequest for some hooks inside EditPage
00399         // @todo FIXME: This interface SUCKS
00400         $oldRequest = $wgRequest;
00401         $wgRequest = $req;
00402 
00403         $status = $ep->internalAttemptSave( $result, $user->isAllowed( 'bot' ) && $params['bot'] );
00404         $wgRequest = $oldRequest;
00405 
00406         switch ( $status->value ) {
00407             case EditPage::AS_HOOK_ERROR:
00408             case EditPage::AS_HOOK_ERROR_EXPECTED:
00409                 $this->dieUsageMsg( 'hookaborted' );
00410 
00411             case EditPage::AS_PARSE_ERROR:
00412                 $this->dieUsage( $status->getMessage(), 'parseerror' );
00413 
00414             case EditPage::AS_IMAGE_REDIRECT_ANON:
00415                 $this->dieUsageMsg( 'noimageredirect-anon' );
00416 
00417             case EditPage::AS_IMAGE_REDIRECT_LOGGED:
00418                 $this->dieUsageMsg( 'noimageredirect-logged' );
00419 
00420             case EditPage::AS_SPAM_ERROR:
00421                 $this->dieUsageMsg( array( 'spamdetected', $result['spam'] ) );
00422 
00423             case EditPage::AS_BLOCKED_PAGE_FOR_USER:
00424                 $this->dieUsageMsg( 'blockedtext' );
00425 
00426             case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
00427             case EditPage::AS_CONTENT_TOO_BIG:
00428                 $this->dieUsageMsg( array( 'contenttoobig', $this->getConfig()->get( 'MaxArticleSize' ) ) );
00429 
00430             case EditPage::AS_READ_ONLY_PAGE_ANON:
00431                 $this->dieUsageMsg( 'noedit-anon' );
00432 
00433             case EditPage::AS_READ_ONLY_PAGE_LOGGED:
00434                 $this->dieUsageMsg( 'noedit' );
00435 
00436             case EditPage::AS_READ_ONLY_PAGE:
00437                 $this->dieReadOnly();
00438 
00439             case EditPage::AS_RATE_LIMITED:
00440                 $this->dieUsageMsg( 'actionthrottledtext' );
00441 
00442             case EditPage::AS_ARTICLE_WAS_DELETED:
00443                 $this->dieUsageMsg( 'wasdeleted' );
00444 
00445             case EditPage::AS_NO_CREATE_PERMISSION:
00446                 $this->dieUsageMsg( 'nocreate-loggedin' );
00447 
00448             case EditPage::AS_BLANK_ARTICLE:
00449                 $this->dieUsageMsg( 'blankpage' );
00450 
00451             case EditPage::AS_CONFLICT_DETECTED:
00452                 $this->dieUsageMsg( 'editconflict' );
00453 
00454             // case EditPage::AS_SUMMARY_NEEDED: Can't happen since we set wpIgnoreBlankSummary
00455             case EditPage::AS_TEXTBOX_EMPTY:
00456                 $this->dieUsageMsg( 'emptynewsection' );
00457 
00458             case EditPage::AS_SUCCESS_NEW_ARTICLE:
00459                 $r['new'] = '';
00460                 // fall-through
00461 
00462             case EditPage::AS_SUCCESS_UPDATE:
00463                 $r['result'] = 'Success';
00464                 $r['pageid'] = intval( $titleObj->getArticleID() );
00465                 $r['title'] = $titleObj->getPrefixedText();
00466                 $r['contentmodel'] = $titleObj->getContentModel();
00467                 $newRevId = $articleObject->getLatest();
00468                 if ( $newRevId == $oldRevId ) {
00469                     $r['nochange'] = '';
00470                 } else {
00471                     $r['oldrevid'] = intval( $oldRevId );
00472                     $r['newrevid'] = intval( $newRevId );
00473                     $r['newtimestamp'] = wfTimestamp( TS_ISO_8601,
00474                         $pageObj->getTimestamp() );
00475                 }
00476                 break;
00477 
00478             case EditPage::AS_SUMMARY_NEEDED:
00479                 $this->dieUsageMsg( 'summaryrequired' );
00480 
00481             case EditPage::AS_END:
00482             default:
00483                 // $status came from WikiPage::doEdit()
00484                 $errors = $status->getErrorsArray();
00485                 $this->dieUsageMsg( $errors[0] ); // TODO: Add new errors to message map
00486                 break;
00487         }
00488         $apiResult->addValue( null, $this->getModuleName(), $r );
00489     }
00490 
00491     public function mustBePosted() {
00492         return true;
00493     }
00494 
00495     public function isWriteMode() {
00496         return true;
00497     }
00498 
00499     public function getDescription() {
00500         return 'Create and edit pages.';
00501     }
00502 
00503     public function getAllowedParams() {
00504         return array(
00505             'title' => array(
00506                 ApiBase::PARAM_TYPE => 'string',
00507             ),
00508             'pageid' => array(
00509                 ApiBase::PARAM_TYPE => 'integer',
00510             ),
00511             'section' => null,
00512             'sectiontitle' => array(
00513                 ApiBase::PARAM_TYPE => 'string',
00514             ),
00515             'text' => null,
00516             'summary' => null,
00517             'minor' => false,
00518             'notminor' => false,
00519             'bot' => false,
00520             'basetimestamp' => null,
00521             'starttimestamp' => null,
00522             'recreate' => false,
00523             'createonly' => false,
00524             'nocreate' => false,
00525             'watch' => array(
00526                 ApiBase::PARAM_DFLT => false,
00527                 ApiBase::PARAM_DEPRECATED => true,
00528             ),
00529             'unwatch' => array(
00530                 ApiBase::PARAM_DFLT => false,
00531                 ApiBase::PARAM_DEPRECATED => true,
00532             ),
00533             'watchlist' => array(
00534                 ApiBase::PARAM_DFLT => 'preferences',
00535                 ApiBase::PARAM_TYPE => array(
00536                     'watch',
00537                     'unwatch',
00538                     'preferences',
00539                     'nochange'
00540                 ),
00541             ),
00542             'md5' => null,
00543             'prependtext' => null,
00544             'appendtext' => null,
00545             'undo' => array(
00546                 ApiBase::PARAM_TYPE => 'integer'
00547             ),
00548             'undoafter' => array(
00549                 ApiBase::PARAM_TYPE => 'integer'
00550             ),
00551             'redirect' => array(
00552                 ApiBase::PARAM_TYPE => 'boolean',
00553                 ApiBase::PARAM_DFLT => false,
00554             ),
00555             'contentformat' => array(
00556                 ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
00557             ),
00558             'contentmodel' => array(
00559                 ApiBase::PARAM_TYPE => ContentHandler::getContentModels(),
00560             )
00561         );
00562     }
00563 
00564     public function getParamDescription() {
00565         $p = $this->getModulePrefix();
00566 
00567         return array(
00568             'title' => "Title of the page you want to edit. Cannot be used together with {$p}pageid",
00569             'pageid' => "Page ID of the page you want to edit. Cannot be used together with {$p}title",
00570             'section' => 'Section number. 0 for the top section, \'new\' for a new section',
00571             'sectiontitle' => 'The title for a new section',
00572             'text' => 'Page content',
00573             'token' => array(
00574                 /* Standard description is automatically prepended */
00575                 'The token should always be sent as the last parameter, or at ' .
00576                     "least, after the {$p}text parameter"
00577             ),
00578             'summary'
00579                 => "Edit summary. Also section title when {$p}section=new and {$p}sectiontitle is not set",
00580             'minor' => 'Minor edit',
00581             'notminor' => 'Non-minor edit',
00582             'bot' => 'Mark this edit as bot',
00583             'basetimestamp' => array(
00584                 'Timestamp of the base revision (obtained through prop=revisions&rvprop=timestamp).',
00585                 'Used to detect edit conflicts; leave unset to ignore conflicts'
00586             ),
00587             'starttimestamp' => array(
00588                 'Timestamp when you began the editing process, e.g. when the current page content ' .
00589                     'was loaded for editing.',
00590                 'Used to detect edit conflicts; leave unset to ignore conflicts'
00591             ),
00592             'recreate' => 'Override any errors about the article having been deleted in the meantime',
00593             'createonly' => 'Don\'t edit the page if it exists already',
00594             'nocreate' => 'Throw an error if the page doesn\'t exist',
00595             'watch' => 'Add the page to your watchlist',
00596             'unwatch' => 'Remove the page from your watchlist',
00597             'watchlist' => 'Unconditionally add or remove the page from your ' .
00598                 'watchlist, use preferences or do not change watch',
00599             'md5' => array(
00600                 "The MD5 hash of the {$p}text parameter, or the {$p}prependtext " .
00601                     "and {$p}appendtext parameters concatenated.",
00602                 'If set, the edit won\'t be done unless the hash is correct'
00603             ),
00604             'prependtext' => "Add this text to the beginning of the page. Overrides {$p}text",
00605             'appendtext' => array( "Add this text to the end of the page. Overrides {$p}text.",
00606                 "Use {$p}section=new to append a new section" ),
00607             'undo' => "Undo this revision. Overrides {$p}text, {$p}prependtext and {$p}appendtext",
00608             'undoafter' => 'Undo all revisions from undo to this one. If not set, just undo one revision',
00609             'redirect' => 'Automatically resolve redirects',
00610             'contentformat' => 'Content serialization format used for the input text',
00611             'contentmodel' => 'Content model of the new content',
00612         );
00613     }
00614 
00615     public function needsToken() {
00616         return 'csrf';
00617     }
00618 
00619     public function getExamples() {
00620         return array(
00621             'api.php?action=edit&title=Test&summary=test%20summary&' .
00622             'text=article%20content&basetimestamp=20070824123454&token=%2B\\'
00623                 => 'Edit a page (anonymous user)',
00624             'api.php?action=edit&title=Test&summary=NOTOC&minor=&' .
00625                 'prependtext=__NOTOC__%0A&basetimestamp=20070824123454&token=%2B\\'
00626                 => 'Prepend __NOTOC__ to a page (anonymous user)',
00627             'api.php?action=edit&title=Test&undo=13585&undoafter=13579&' .
00628                 'basetimestamp=20070824123454&token=%2B\\'
00629                 => 'Undo r13579 through r13585 with autosummary (anonymous user)',
00630         );
00631     }
00632 
00633     public function getHelpUrls() {
00634         return 'https://www.mediawiki.org/wiki/API:Edit';
00635     }
00636 }