From: Zoranzoki21 Date: Sat, 6 Apr 2019 12:24:57 +0000 (+0200) Subject: Split ApiImport.php to have one class in one file X-Git-Tag: 1.34.0-rc.0~2005^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=3f16fda078025ccf2716f0a6bf10a650244c9d89;hp=6b5f1a6cdbc84a84ee793c3826306b110e1d40b5 Split ApiImport.php to have one class in one file Change-Id: I3fbf5d271585722e95b7966ba62dd5e16fa3623f --- diff --git a/.phpcs.xml b/.phpcs.xml index 1fa84ca36b..3bccc1fec4 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -205,7 +205,6 @@ any new occurrences. --> */includes/api/ApiErrorFormatter\.php - */includes/api/ApiImport\.php */includes/compat/XMPReader\.php */includes/diff/DairikiDiff\.php */includes/filerepo/file/LocalFile\.php diff --git a/autoload.php b/autoload.php index b9b4addca0..38ad652eb0 100644 --- a/autoload.php +++ b/autoload.php @@ -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', diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 596ab75e48..b36045e1f4 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -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 index 0000000000..21d9d235dc --- /dev/null +++ b/includes/api/ApiImportReporter.php @@ -0,0 +1,60 @@ +.@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; + } +}