(bug 27862; follow-up r77714) Make emailuser api module not freak out when SpecialEma...
[lhc/web/wiklou.git] / includes / api / ApiUndelete.php
index 6082ef0..a027b7f 100644 (file)
@@ -1,10 +1,10 @@
 <?php
-
-/*
+/**
+ *
+ *
  * Created on Jul 3, 2007
- * API for MediaWiki 1.8+
  *
- * Copyright (C) 2007 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
  */
 
 if ( !defined( 'MEDIAWIKI' ) ) {
@@ -40,8 +42,6 @@ class ApiUndelete extends ApiBase {
                global $wgUser;
                $params = $this->extractRequestParams();
 
-               $titleObj = null;
-
                if ( !$wgUser->isAllowed( 'undelete' ) ) {
                        $this->dieUsageMsg( array( 'permdenied-undelete' ) );
                }
@@ -67,8 +67,6 @@ class ApiUndelete extends ApiBase {
                }
 
                $pa = new PageArchive( $titleObj );
-               $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin();
                $retval = $pa->undelete( ( isset( $params['timestamps'] ) ? $params['timestamps'] : array() ), $params['reason'] );
                if ( !is_array( $retval ) ) {
                        $this->dieUsageMsg( array( 'cannotundelete' ) );
@@ -100,7 +98,7 @@ class ApiUndelete extends ApiBase {
                return array(
                        'title' => array(
                                ApiBase::PARAM_TYPE => 'string',
-                               ApiBase::PARAM_REQUIRED => 1
+                               ApiBase::PARAM_REQUIRED => true
                        ),
                        'token' => null,
                        'reason' => '',
@@ -138,7 +136,6 @@ class ApiUndelete extends ApiBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'missingparam', 'title' ),
                        array( 'permdenied-undelete' ),
                        array( 'blockedtext' ),
                        array( 'invalidtitle', 'title' ),
@@ -146,6 +143,10 @@ class ApiUndelete extends ApiBase {
                ) );
        }
 
+       public function needsToken() {
+               return true;
+       }
+
        public function getTokenSalt() {
                return '';
        }