Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/243026
Change subject: Revert "Include foreign files in ApiQueryPageImages"
......................................................................
Revert "Include foreign files in ApiQueryPageImages"
Fatal error: Invalid operand type was used: cannot perform this operation with
arrays
This reverts commit 47137e7ee671c89667d620bc04ac7649b1d9af96.
Bug: T114417
Change-Id: I89a2bfd69775a698f3000f48ea85465e193fb095
---
M ApiQueryPageImages.php
1 file changed, 4 insertions(+), 39 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageImages
refs/changes/26/243026/1
diff --git a/ApiQueryPageImages.php b/ApiQueryPageImages.php
index 2eab4fd..a629f6e 100644
--- a/ApiQueryPageImages.php
+++ b/ApiQueryPageImages.php
@@ -8,40 +8,11 @@
parent::__construct( $query, $moduleName, 'pi' );
}
- /**
- * Gets the set of titles to get page images for.
- *
- * Note well that the set of titles comprises the set of "good" titles
- * (see {@see ApiPageSet::getGoodTitles}) union the set of "missing"
- * titles in the File namespace that might correspond to foreign files.
- * The latter are included because titles in the File namespace are
- * expected to be found with {@see wfFindFile}.
- *
- * @return array A map of page ID, which will be negative in the case
- * of missing titles in the File namespace, to Title object
- */
- private function getTitles() {
- $pageSet = $this->getPageSet();
- $titles = $pageSet->getGoodTitles();
-
- // T98791: We want foreign files to be treated like local files
- // in #execute, so include the set of missing filespace pages,
- // which were initially rejected in ApiPageSet#execute.
- $missingTitles = $pageSet->getMissingTitlesByNamespace();
- $missingFileTitles = $missingTitles[NS_FILE];
-
- // $titles is a map of ID to title object, which is ideal,
- // whereas $missingFileTitles is a map of title text to ID.
- $missingFileTitles = array_map( function ( $text ) {
- return Title::newFromText( $text, NS_FILE );
- }, array_flip( $missingFileTitles ) );
-
- $titles += $missingFileTitles;
-
- return $titles;
- }
-
public function execute() {
+ $allTitles = $this->getPageSet()->getGoodTitles();
+ if ( count( $allTitles ) == 0 ) {
+ return;
+ }
$params = $this->extractRequestParams();
$prop = array_flip( $params['prop'] );
if ( !count( $prop ) ) {
@@ -49,12 +20,6 @@
}
$size = $params['thumbsize'];
$limit = $params['limit'];
-
- $allTitles = $this->getTitles();
-
- if ( count( $allTitles ) === 0 ) {
- return;
- }
// Find the offset based on the continue param
$offset = 0;
--
To view, visit https://gerrit.wikimedia.org/r/243026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I89a2bfd69775a698f3000f48ea85465e193fb095
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageImages
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits