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

Change subject: Use getIcon utility method from Translate
......................................................................


Use getIcon utility method from Translate

Change-Id: I7182b9ca3bc138f99e3e7f23779210825e6a4f0d
Depends: I24fb73e31ab9433bb6046014e5e6937910a8f8e4
---
M MainPage/ProjectHandler.php
M MainPage/specials/SpecialTwnMainPage.php
2 files changed, 1 insertion(+), 30 deletions(-)

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



diff --git a/MainPage/ProjectHandler.php b/MainPage/ProjectHandler.php
index b5c3163..413f71d 100644
--- a/MainPage/ProjectHandler.php
+++ b/MainPage/ProjectHandler.php
@@ -55,33 +55,4 @@
                } );
        }
 
-       // @todo FIXME: This is duplicate code Translate - 
ApiQueryMessageGroup. We can avoid
-       // duplication if we make getIcon of that API public static.
-       public static function getIcon( MessageGroup $g, $size ) {
-               global $wgServer;
-               $icon = $g->getIcon();
-               if ( substr( $icon, 0, 7 ) !== 'wiki://' ) {
-                       return null;
-               }
-
-               $formats = array();
-
-               $filename = substr( $icon, 7 );
-               $file = wfFindFile( $filename );
-               if ( !$file ) {
-                       return '';
-               }
-
-               if ( $file->isVectorized() ) {
-                       $formats['vector'] = $file->getUrl();
-               }
-
-               $formats['raster'] = $wgServer . $file->createThumb( $size, 
$size );
-
-               foreach ( $formats as $key => &$url ) {
-                       $url = wfExpandUrl( $url, PROTO_RELATIVE );
-               }
-
-               return $formats;
-       }
 }
diff --git a/MainPage/specials/SpecialTwnMainPage.php 
b/MainPage/specials/SpecialTwnMainPage.php
index 7074a8b..e6c3be3 100644
--- a/MainPage/specials/SpecialTwnMainPage.php
+++ b/MainPage/specials/SpecialTwnMainPage.php
@@ -98,7 +98,7 @@
                ProjectHandler::sortByPriority( $projects, 
$this->getLanguage()->getCode() );
 
                foreach ( $projects as $group ) {
-                       $urls = ProjectHandler::getIcon( $group, 100 );
+                       $urls = TranslateUtils::getIcon( $group, 100 );
                        if ( isset( $urls['vector'] ) ) {
                                $url = $urls['vector'];
                        } elseif ( isset( $urls['raster'] ) ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7182b9ca3bc138f99e3e7f23779210825e6a4f0d
Gerrit-PatchSet: 2
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to