Do not allow a user to delete a page they can't edit
[lhc/web/wiklou.git] / includes / api / ApiImport.php
index 295f16e..25ce89b 100644 (file)
@@ -98,8 +98,6 @@ class ApiImport extends ApiBase {
        }
 
        public function getAllowedParams() {
-               global $wgImportSources;
-
                return array(
                        'token' => array(
                                ApiBase::PARAM_TYPE => 'string',
@@ -110,7 +108,7 @@ class ApiImport extends ApiBase {
                                ApiBase::PARAM_TYPE => 'upload',
                        ),
                        'interwikisource' => array(
-                               ApiBase::PARAM_TYPE => $wgImportSources
+                               ApiBase::PARAM_TYPE => $this->getConfig()->get( 'ImportSources' ),
                        ),
                        'interwikipage' => null,
                        'fullhistory' => false,
@@ -136,17 +134,6 @@ class ApiImport extends ApiBase {
                );
        }
 
-       public function getResultProperties() {
-               return array(
-                       ApiBase::PROP_LIST => true,
-                       '' => array(
-                               'ns' => 'namespace',
-                               'title' => 'string',
-                               'revisions' => 'integer'
-                       )
-               );
-       }
-
        public function getDescription() {
                return array(
                        'Import a page from another wiki, or an XML file.',
@@ -155,18 +142,6 @@ class ApiImport extends ApiBase {
                );
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array( 'cantimport' ),
-                       array( 'missingparam', 'interwikipage' ),
-                       array( 'cantimport-upload' ),
-                       array( 'import-unknownerror', 'source' ),
-                       array( 'import-unknownerror', 'result' ),
-                       array( 'import-rootpage-nosubpage', 'namespace' ),
-                       array( 'import-rootpage-invalid' ),
-               ) );
-       }
-
        public function needsToken() {
                return true;
        }
@@ -196,11 +171,11 @@ class ApiImportReporter extends ImportReporter {
        private $mResultArr = array();
 
        /**
-        * @param $title Title
-        * @param $origTitle Title
-        * @param $revisionCount int
-        * @param $successCount int
-        * @param $pageInfo
+        * @param Title $title
+        * @param Title $origTitle
+        * @param int $revisionCount
+        * @param int $successCount
+        * @param array $pageInfo
         * @return void
         */
        function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {