Made upload jobs avoid using the user session
[lhc/web/wiklou.git] / includes / api / ApiEditPage.php
index 8a0c280..8a76271 100644 (file)
@@ -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() {