Merge "Indicate the actual version of HHVM in use"
[lhc/web/wiklou.git] / includes / api / ApiDelete.php
index 2fa4518..abca824 100644 (file)
@@ -72,8 +72,10 @@ class ApiDelete extends ApiBase {
 
                // Deprecated parameters
                if ( $params['watch'] ) {
+                       $this->logFeatureUsage( 'action=delete&watch' );
                        $watch = 'watch';
                } elseif ( $params['unwatch'] ) {
+                       $this->logFeatureUsage( 'action=delete&unwatch' );
                        $watch = 'unwatch';
                } else {
                        $watch = $params['watchlist'];
@@ -104,8 +106,8 @@ class ApiDelete extends ApiBase {
         *
         * @param Page|WikiPage $page Page or WikiPage object to work on
         * @param User $user User doing the action
-        * @param string $token delete token (same as edit token)
-        * @param string|null $reason reason for the deletion. Autogenerated if null
+        * @param string $token Delete token (same as edit token)
+        * @param string|null $reason Reason for the deletion. Autogenerated if null
         * @return Status|array
         */
        public static function delete( Page $page, User $user, $token, &$reason = null ) {
@@ -186,10 +188,6 @@ class ApiDelete extends ApiBase {
                        'pageid' => array(
                                ApiBase::PARAM_TYPE => 'integer'
                        ),
-                       'token' => array(
-                               ApiBase::PARAM_TYPE => 'string',
-                               ApiBase::PARAM_REQUIRED => true
-                       ),
                        'reason' => null,
                        'watch' => array(
                                ApiBase::PARAM_DFLT => false,
@@ -218,7 +216,6 @@ class ApiDelete extends ApiBase {
                return array(
                        'title' => "Title of the page you want to delete. Cannot be used together with {$p}pageid",
                        'pageid' => "Page ID of the page you want to delete. Cannot be used together with {$p}title",
-                       'token' => 'A delete token previously retrieved through prop=info',
                        'reason'
                                => 'Reason for the deletion. If not set, an automatically generated reason will be used',
                        'watch' => 'Add the page to your watchlist',
@@ -229,40 +226,12 @@ class ApiDelete extends ApiBase {
                );
        }
 
-       public function getResultProperties() {
-               return array(
-                       '' => array(
-                               'title' => 'string',
-                               'reason' => 'string',
-                               'logid' => 'integer'
-                       )
-               );
-       }
-
        public function getDescription() {
                return 'Delete a page.';
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(),
-                       $this->getTitleOrPageIdErrorMessage(),
-                       array(
-                               array( 'notanarticle' ),
-                               array( 'hookaborted', 'error' ),
-                               array( 'delete-toobig', 'limit' ),
-                               array( 'cannotdelete', 'title' ),
-                               array( 'invalidoldimage' ),
-                               array( 'nodeleteablefile' ),
-                       )
-               );
-       }
-
        public function needsToken() {
-               return true;
-       }
-
-       public function getTokenSalt() {
-               return '';
+               return 'csrf';
        }
 
        public function getExamples() {