X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiEditPage.php;h=8a762714eb552353e8496722c175682c1f801827;hb=50dee21f7a852e2cb4865b9ec83e272a25ab90c3;hp=8a0c28081e60d46eeb9d33790ee64bd89b3b6587;hpb=e054e34af8dcda9c454c8cb04caa0d55d0d3c5af;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 8a0c28081e..8a762714eb 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -309,8 +309,10 @@ class ApiEditPage extends ApiBase { // Deprecated parameters if ( $params['watch'] ) { + $this->logFeatureUsage( 'action=edit&watch' ); $watch = true; } elseif ( $params['unwatch'] ) { + $this->logFeatureUsage( 'action=edit&unwatch' ); $watch = false; } @@ -498,65 +500,6 @@ class ApiEditPage extends ApiBase { return 'Create and edit pages.'; } - public function getPossibleErrors() { - return array_merge( parent::getPossibleErrors(), - $this->getTitleOrPageIdErrorMessage(), - array( - array( 'missingtext' ), - array( 'createonly-exists' ), - array( 'nocreate-missing' ), - array( 'nosuchrevid', 'undo' ), - array( 'nosuchrevid', 'undoafter' ), - array( 'revwrongpage', 'id', 'text' ), - array( 'undo-failure' ), - array( 'hashcheckfailed' ), - array( 'hookaborted' ), - array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ), - array( 'noimageredirect-anon' ), - array( 'noimageredirect-logged' ), - array( 'spamdetected', 'spam' ), - array( 'summaryrequired' ), - array( 'blockedtext' ), - array( 'contenttoobig', $this->getConfig()->get( 'MaxArticleSize' ) ), - array( 'noedit-anon' ), - array( 'noedit' ), - array( 'actionthrottledtext' ), - array( 'wasdeleted' ), - array( 'nocreate-loggedin' ), - array( 'blankpage' ), - array( 'editconflict' ), - array( 'emptynewsection' ), - array( 'unknownerror', 'retval' ), - array( 'code' => 'nosuchsection', 'info' => 'There is no such section.' ), - array( - 'code' => 'invalidsection', - 'info' => 'The section parameter must be a valid section id or \'new\'' - ), - array( - 'code' => 'sectionsnotsupported', - 'info' => 'Sections are not supported for this type of page.' - ), - array( - 'code' => 'editnotsupported', - 'info' => 'Editing of this type of page is not supported using the text based edit API.' - ), - array( - 'code' => 'appendnotsupported', - 'info' => 'This type of page can not be edited by appending or prepending text.' ), - array( - 'code' => 'redirect-appendonly', - 'info' => 'You have attempted to edit using the "redirect"-following mode, which must be used in conjuction with section=new, prependtext, or appendtext.', - ), - array( - 'code' => 'badformat', - 'info' => 'The requested serialization format can not be applied to the page\'s content model' - ), - array( 'customcssprotected' ), - array( 'customjsprotected' ), - ) - ); - } - public function getAllowedParams() { return array( 'title' => array( @@ -570,10 +513,6 @@ class ApiEditPage extends ApiBase { ApiBase::PARAM_TYPE => 'string', ), 'text' => null, - 'token' => array( - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => true - ), 'summary' => null, 'minor' => false, 'notminor' => false, @@ -632,8 +571,8 @@ class ApiEditPage extends ApiBase { 'sectiontitle' => 'The title for a new section', 'text' => 'Page content', 'token' => array( - 'Edit token. You can get one of these through prop=info.', - "The token should always be sent as the last parameter, or at " . + /* Standard description is automatically prepended */ + 'The token should always be sent as the last parameter, or at ' . "least, after the {$p}text parameter" ), 'summary' @@ -646,7 +585,8 @@ class ApiEditPage extends ApiBase { 'Used to detect edit conflicts; leave unset to ignore conflicts' ), 'starttimestamp' => array( - 'Timestamp when you obtained the edit token.', + 'Timestamp when you began the editing process, e.g. when the current page content ' . + 'was loaded for editing.', 'Used to detect edit conflicts; leave unset to ignore conflicts' ), 'recreate' => 'Override any errors about the article having been deleted in the meantime', @@ -672,47 +612,8 @@ class ApiEditPage extends ApiBase { ); } - public function getResultProperties() { - return array( - '' => array( - 'new' => 'boolean', - 'result' => array( - ApiBase::PROP_TYPE => array( - 'Success', - 'Failure' - ), - ), - 'pageid' => array( - ApiBase::PROP_TYPE => 'integer', - ApiBase::PROP_NULLABLE => true - ), - 'title' => array( - ApiBase::PROP_TYPE => 'string', - ApiBase::PROP_NULLABLE => true - ), - 'nochange' => 'boolean', - 'oldrevid' => array( - ApiBase::PROP_TYPE => 'integer', - ApiBase::PROP_NULLABLE => true - ), - 'newrevid' => array( - ApiBase::PROP_TYPE => 'integer', - ApiBase::PROP_NULLABLE => true - ), - 'newtimestamp' => array( - ApiBase::PROP_TYPE => 'string', - ApiBase::PROP_NULLABLE => true - ) - ) - ); - } - public function needsToken() { - return true; - } - - public function getTokenSalt() { - return ''; + return 'csrf'; } public function getExamples() {