Merge "Split ApiImport.php to have one class in one file"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 14 Apr 2019 00:29:32 +0000 (00:29 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 14 Apr 2019 00:29:32 +0000 (00:29 +0000)
.phpcs.xml
autoload.php
includes/api/ApiImport.php
includes/api/ApiImportReporter.php [new file with mode: 0644]

index 0a818a8..6b625e5 100644 (file)
                        any new occurrences.
                -->
                <exclude-pattern>*/includes/api/ApiErrorFormatter\.php</exclude-pattern>
-               <exclude-pattern>*/includes/api/ApiImport\.php</exclude-pattern>
                <exclude-pattern>*/includes/compat/XMPReader\.php</exclude-pattern>
                <exclude-pattern>*/includes/diff/DairikiDiff\.php</exclude-pattern>
                <exclude-pattern>*/includes/filerepo/file/LocalFile\.php</exclude-pattern>
index b9b4add..38ad652 100644 (file)
@@ -57,7 +57,7 @@ $wgAutoloadLocalClasses = [
        'ApiHelpParamValueMessage' => __DIR__ . '/includes/api/ApiHelpParamValueMessage.php',
        'ApiImageRotate' => __DIR__ . '/includes/api/ApiImageRotate.php',
        'ApiImport' => __DIR__ . '/includes/api/ApiImport.php',
-       'ApiImportReporter' => __DIR__ . '/includes/api/ApiImport.php',
+       'ApiImportReporter' => __DIR__ . '/includes/api/ApiImportReporter.php',
        'ApiLinkAccount' => __DIR__ . '/includes/api/ApiLinkAccount.php',
        'ApiLogin' => __DIR__ . '/includes/api/ApiLogin.php',
        'ApiLogout' => __DIR__ . '/includes/api/ApiLogout.php',
index 596ab75..b36045e 100644 (file)
@@ -181,42 +181,3 @@ class ApiImport extends ApiBase {
                return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Import';
        }
 }
-
-/**
- * Import reporter for the API
- * @ingroup API
- */
-class ApiImportReporter extends ImportReporter {
-       private $mResultArr = [];
-
-       /**
-        * @param Title $title
-        * @param Title $origTitle
-        * @param int $revisionCount
-        * @param int $successCount
-        * @param array $pageInfo
-        * @return void
-        */
-       public function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
-               // Add a result entry
-               $r = [];
-
-               if ( $title === null ) {
-                       # Invalid or non-importable title
-                       $r['title'] = $pageInfo['title'];
-                       $r['invalid'] = true;
-               } else {
-                       ApiQueryBase::addTitleInfo( $r, $title );
-                       $r['revisions'] = (int)$successCount;
-               }
-
-               $this->mResultArr[] = $r;
-
-               // Piggyback on the parent to do the logging
-               parent::reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo );
-       }
-
-       public function getData() {
-               return $this->mResultArr;
-       }
-}
diff --git a/includes/api/ApiImportReporter.php b/includes/api/ApiImportReporter.php
new file mode 100644 (file)
index 0000000..21d9d23
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Copyright © 2009 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * 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
+ */
+
+/**
+ * Import reporter for the API
+ * @ingroup API
+ */
+class ApiImportReporter extends ImportReporter {
+       private $mResultArr = [];
+
+       /**
+        * @param Title $title
+        * @param Title $origTitle
+        * @param int $revisionCount
+        * @param int $successCount
+        * @param array $pageInfo
+        * @return void
+        */
+       public function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
+               // Add a result entry
+               $r = [];
+
+               if ( $title === null ) {
+                       # Invalid or non-importable title
+                       $r['title'] = $pageInfo['title'];
+                       $r['invalid'] = true;
+               } else {
+                       ApiQueryBase::addTitleInfo( $r, $title );
+                       $r['revisions'] = (int)$successCount;
+               }
+
+               $this->mResultArr[] = $r;
+
+               // Piggyback on the parent to do the logging
+               parent::reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo );
+       }
+
+       public function getData() {
+               return $this->mResultArr;
+       }
+}