https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102072

Revision: 102072
Author:   aaron
Date:     2011-11-04 23:33:53 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
* Added some Title type hinting
* Used 'self' in some class construction instances

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/FileRepo.php
    trunk/phase3/includes/filerepo/ForeignAPIFile.php
    trunk/phase3/includes/filerepo/LocalFile.php
    trunk/phase3/includes/filerepo/LocalRepo.php

Modified: trunk/phase3/includes/filerepo/FileRepo.php
===================================================================
--- trunk/phase3/includes/filerepo/FileRepo.php 2011-11-04 23:32:46 UTC (rev 
102071)
+++ trunk/phase3/includes/filerepo/FileRepo.php 2011-11-04 23:33:53 UTC (rev 
102072)
@@ -249,7 +249,7 @@
         * Get the name of an image from its title object
         * @param $title Title
         */
-       function getNameFromTitle( $title ) {
+       function getNameFromTitle( Title $title ) {
                if ( $this->initialCapital != MWNamespace::isCapitalized( 
NS_FILE ) ) {
                        global $wgContLang;
                        $name = $title->getUserCaseDBKey();

Modified: trunk/phase3/includes/filerepo/ForeignAPIFile.php
===================================================================
--- trunk/phase3/includes/filerepo/ForeignAPIFile.php   2011-11-04 23:32:46 UTC 
(rev 102071)
+++ trunk/phase3/includes/filerepo/ForeignAPIFile.php   2011-11-04 23:33:53 UTC 
(rev 102072)
@@ -33,13 +33,13 @@
         * @param $repo ForeignApiRepo
         * @return ForeignAPIFile|null
         */
-       static function newFromTitle( $title, $repo ) {
+       static function newFromTitle( Title $title, $repo ) {
                $data = $repo->fetchImageQuery( array(
-                        'titles' => 'File:' . $title->getDBKey(),
-                        'iiprop' => self::getProps(),
-                        'prop' => 'imageinfo',
+                       'titles' => 'File:' . $title->getDBKey(),
+                       'iiprop' => self::getProps(),
+                       'prop'   => 'imageinfo',
                        'iimetadataversion' => 
MediaHandler::getMetadataVersion()
-                        ) );
+               ) );
 
                $info = $repo->getImageInfo( $data );
 
@@ -49,12 +49,12 @@
                                : -1;
                        if( $lastRedirect >= 0 ) {
                                $newtitle = Title::newFromText( 
$data['query']['redirects'][$lastRedirect]['to']);
-                               $img = new ForeignAPIFile( $newtitle, $repo, 
$info, true );
+                               $img = new self( $newtitle, $repo, $info, true 
);
                                if( $img ) {
                                        $img->redirectedFrom( 
$title->getDBkey() );
                                }
                        } else {
-                               $img = new ForeignAPIFile( $title, $repo, 
$info, true );
+                               $img = new self( $title, $repo, $info, true );
                        }
                        return $img;
                } else {

Modified: trunk/phase3/includes/filerepo/LocalFile.php
===================================================================
--- trunk/phase3/includes/filerepo/LocalFile.php        2011-11-04 23:32:46 UTC 
(rev 102071)
+++ trunk/phase3/includes/filerepo/LocalFile.php        2011-11-04 23:33:53 UTC 
(rev 102072)
@@ -144,7 +144,7 @@
         * Do not call this except from inside a repo class.
         */
        function __construct( $title, $repo ) {
-               if ( !is_object( $title ) ) {
+               if ( !is_object( $title ) ) { // LocalFile requires a title 
object
                        throw new MWException( __CLASS__ . ' constructor given 
bogus title.' );
                }
 

Modified: trunk/phase3/includes/filerepo/LocalRepo.php
===================================================================
--- trunk/phase3/includes/filerepo/LocalRepo.php        2011-11-04 23:32:46 UTC 
(rev 102071)
+++ trunk/phase3/includes/filerepo/LocalRepo.php        2011-11-04 23:33:53 UTC 
(rev 102072)
@@ -258,7 +258,7 @@
         *
         * @param $title Title of page
         */
-       function invalidateImageRedirect( $title ) {
+       function invalidateImageRedirect( Title $title ) {
                global $wgMemc;
                $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( 
$title->getDBkey() ) );
                if ( $memcKey ) {


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

Reply via email to