jenkins-bot has submitted this change and it was merged.

Change subject: Rename 'source' property to 'original'
......................................................................


Rename 'source' property to 'original'

There's already a 'source' that points to the thumbnail URL
source and thus two 'sources' are confusing. Call it 'original'
intead, and move it to inside the 'thumbnail' dict so it is
clear what it is an original of

Bug: T94928
Change-Id: I3298e9ab511226c17010dc018f6e7d5f0a0babe5
(cherry picked from commit e1786ece26e39a0e52de91ea8ef854254e5a99dc)
---
M ApiQueryPageImages.php
1 file changed, 12 insertions(+), 5 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ApiQueryPageImages.php b/ApiQueryPageImages.php
index e451346..a629f6e 100644
--- a/ApiQueryPageImages.php
+++ b/ApiQueryPageImages.php
@@ -89,7 +89,7 @@
         */
        protected function setResultValues( $prop, $pageId, $fileName, $size ) {
                $vals = array();
-               if ( isset( $prop['thumbnail'] ) || isset( $prop['source'] ) ) {
+               if ( isset( $prop['thumbnail'] ) || isset( $prop['original'] ) 
) {
                        $file = wfFindFile( $fileName );
 
                        if ( isset( $prop['thumbnail'] ) ) {
@@ -108,8 +108,15 @@
                                }
                        }
 
-                       if ( isset( $prop['source'] ) ) {
-                               $vals['source'] = wfExpandUrl( $file->getUrl(), 
PROTO_CURRENT );
+                       if ( isset( $prop['original'] ) ) {
+                               $original_url = wfExpandUrl( $file->getUrl(), 
PROTO_CURRENT );
+                               if ( isset( $vals['thumbnail'] ) ) {
+                                       $vals['thumbnail']['original'] = 
$original_url;
+                               } else {
+                                       $vals['thumbnail'] = array(
+                                               'original' => $original_url,
+                                       );
+                               }
                        }
                }
 
@@ -130,7 +137,7 @@
        public function getAllowedParams() {
                return array(
                        'prop' => array(
-                               ApiBase::PARAM_TYPE => array( 'thumbnail', 
'name', 'source' ),
+                               ApiBase::PARAM_TYPE => array( 'thumbnail', 
'name', 'original' ),
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_DFLT => 'thumbnail|name',
                        ),
@@ -161,7 +168,7 @@
                        'prop' => array( 'What information to return',
                                ' thumbnail - URL and dimensions of image 
associated with page, if any',
                                ' name - image title',
-                               ' source - URL to the image original',
+                               ' original - URL to the image original',
                        ),
                        'thumbsize' => 'Maximum thumbnail dimension',
                        'limit' => 'Properties of how many pages to return',

-- 
To view, visit https://gerrit.wikimedia.org/r/202066
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3298e9ab511226c17010dc018f6e7d5f0a0babe5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageImages
Gerrit-Branch: wmf/1.25wmf24
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to