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

Change subject: Use mExtensionData instead of undeclared class property
......................................................................


Use mExtensionData instead of undeclared class property

Change-Id: I155e37fda412cd467da7b34c52b34661c7c20224
---
M PageImages.body.php
M tests/phpunit/PageImagesTest.php
2 files changed, 11 insertions(+), 11 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/PageImages.body.php b/PageImages.body.php
index 3ec8264..cfe7f19 100644
--- a/PageImages.body.php
+++ b/PageImages.body.php
@@ -89,10 +89,6 @@
                        }
                }
 
-               $out = $parser->getOutput();
-               if ( !isset( $out->pageImages ) ) {
-                       $out->pageImages = array();
-               }
                if ( is_array( $handlerParams ) ) {
                        $myParams = $handlerParams;
                        self::calcWidth( $myParams, $file );
@@ -103,7 +99,11 @@
                $myParams['filename'] = $file->getTitle()->getDBkey();
                $myParams['fullwidth'] = $file->getWidth();
                $myParams['fullheight'] = $file->getHeight();
-               $out->pageImages[] = $myParams;
+
+               $out = $parser->getOutput();
+               $pageImages = $out->getExtensionData( 'pageImages' ) ?: array();
+               $pageImages[] = $myParams;
+               $out->setExtensionData( 'pageImages', $pageImages );
        }
 
        /**
@@ -144,11 +144,11 @@
         * @return bool
         */
        public static function onLinksUpdate( LinksUpdate $linksUpdate ) {
-               if ( !isset( $linksUpdate->getParserOutput()->pageImages ) ) {
+               $images = $linksUpdate->getParserOutput()->getExtensionData( 
'pageImages' );
+               if ( $images === null ) {
                        return true;
                }
 
-               $images = $linksUpdate->getParserOutput()->pageImages;
                $scores = array();
                $counter = 0;
                foreach ( $images as $image ) {
diff --git a/tests/phpunit/PageImagesTest.php b/tests/phpunit/PageImagesTest.php
index 46e074b..e2b8df6 100644
--- a/tests/phpunit/PageImagesTest.php
+++ b/tests/phpunit/PageImagesTest.php
@@ -4,7 +4,7 @@
 
 use MediaWikiTestCase;
 use PageImages;
-use stdClass;
+use ParserOutput;
 use Title;
 
 /**
@@ -35,10 +35,10 @@
        }
 
        public function testOnLinksUpdate() {
-               $parserOutput = new stdClass();
-               $parserOutput->pageImages = array(
+               $parserOutput = new ParserOutput();
+               $parserOutput->setExtensionData( 'pageImages', array(
                        array( 'filename' => 'A.jpg', 'fullwidth' => 100, 
'fullheight' => 50 ),
-               );
+               ) );
 
                $linksUpdate = $this->getMockBuilder( 'LinksUpdate' )
                        ->disableOriginalConstructor()

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I155e37fda412cd467da7b34c52b34661c7c20224
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PageImages
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to