Replace some deprecated method calls.
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Sat, 18 Aug 2012 14:51:00 +0000 (16:51 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 19 Aug 2012 21:27:43 +0000 (23:27 +0200)
Change-Id: Id4beca7b6821139fcc319c5694917e68668835ee

includes/FeedUtils.php
includes/upload/UploadFromUrl.php
maintenance/importSiteScripts.php
tests/jasmine/spec_makers/makeJqueryMsgSpec.php
tests/phpunit/includes/ArticleTablesTest.php
thumb.php

index 1c5e777..16eba66 100644 (file)
@@ -85,7 +85,7 @@ class FeedUtils {
                        $row->rc_last_oldid, $row->rc_this_oldid,
                        $timestamp,
                        ($row->rc_deleted & Revision::DELETED_COMMENT)
-                               ? wfMsgHtml('rev-deleted-comment') 
+                               ? wfMessage('rev-deleted-comment')->escaped()
                                : $row->rc_comment,
                        $actiontext 
                );
index c11d719..fdd2b1a 100644 (file)
@@ -70,13 +70,14 @@ class UploadFromUrl extends UploadBase {
                if ( !count( $wgCopyUploadsDomains ) ) {
                        return true;
                }
-               $parsedUrl = wfParseUrl( $url );
-               if ( !$parsedUrl ) {
+               $uri = new Uri( $url );
+               $parsedDomain = $uri->getHost();
+               if ( $parsedDomain === null ) {
                        return false;
                }
                $valid = false;
                foreach( $wgCopyUploadsDomains as $domain ) {
-                       if ( $parsedUrl['host'] === $domain ) {
+                       if ( $parsedDomain === $domain ) {
                                $valid = true;
                                break;
                        }
index 65ac65a..b4a1bac 100644 (file)
@@ -56,9 +56,12 @@ class ImportSiteScripts extends Maintenance {
                        }
 
                        $this->output( "Importing $page\n" );
-                       $url = wfAppendQuery( $baseUrl, array(
+                       $uri = new Uri( $baseUrl );
+                       $uri->extendQuery( array(
                                'action' => 'raw',
                                'title' => "MediaWiki:{$page}" ) );
+                       $url = $uri->toString();
+
                        $text = Http::get( $url );
 
                        $wikiPage = WikiPage::factory( $title );
@@ -79,7 +82,9 @@ class ImportSiteScripts extends Maintenance {
                $pages = array();
 
                do {
-                       $url = wfAppendQuery( $baseUrl, $data );
+                       $uri = new Uri( $baseUrl );
+                       $uri->extendQuery( $data );
+                       $url = $uri->toString();
                        $strResult = Http::get( $url );
                        //$result = FormatJson::decode( $strResult ); // Still broken
                        $result = unserialize( $strResult );
index 1ac8dcb..9d75be4 100644 (file)
@@ -57,10 +57,11 @@ class MakeLanguageSpec extends Maintenance {
                        foreach ( self::$keyToTestArgs as $key => $testArgs ) {
                                foreach ($testArgs as $args) {
                                        // get the raw template, without any transformations
-                                       $template = wfMsgGetKey( $key, /* useDb */ true, $languageCode, /* transform */ false );
+                                       $template = wfMessage( $key )->inLanguage( $languageCode )->plain();
 
                                        // get the magic-parsed version with args
                                        $wfMsgExtArgs = array_merge( array( $key, $wfMsgExtOptions ), $args );
+                                       // @todo FIXME: Use Message class.
                                        $result = call_user_func_array( 'wfMsgExt', $wfMsgExtArgs ); 
 
                                        // record the template, args, language, and expected result
index 02571b5..17cee6e 100644 (file)
@@ -17,14 +17,14 @@ class ArticleTablesTest extends MediaWikiLangTestCase {
 
                $wgLang = Language::factory( 'fr' );
                $status = $page->doEdit( '{{:{{int:history}}}}', 'Test code for bug 14404', 0, false, $user );
-               $templates1 = $page->getUsedTemplates();
+               $templates1 = $title->getTemplateLinksFrom();
 
                $wgLang = Language::factory( 'de' );
                $page->mPreparedEdit = false; // In order to force the rerendering of the same wikitext
 
                // We need an edit, a purge is not enough to regenerate the tables
                $status = $page->doEdit( '{{:{{int:history}}}}', 'Test code for bug 14404', EDIT_UPDATE, false, $user );
-               $templates2 = $page->getUsedTemplates();
+               $templates2 = $title->getTemplateLinksFrom();
 
                $this->assertEquals( $templates1, $templates2 );
                $this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
index 58a8194..5fc4446 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -71,10 +71,9 @@ function wfThumbHandle404() {
        }
        # Just get the URI path (REDIRECT_URL/REQUEST_URI is either a full URL or a path)
        if ( substr( $uriPath, 0, 1 ) !== '/' ) {
-               $bits = wfParseUrl( $uriPath );
-               if ( $bits && isset( $bits['path'] ) ) {
-                       $uriPath = $bits['path'];
-               } else {
+               $uri = new Uri( $uriPath );
+               $uriPath = $uri->getPath();
+               if ( $uriPath === null ) {
                        wfThumbError( 404, 'The source file for the specified thumbnail does not exist.' );
                        return;
                }