From: Siebrand Mazeland Date: Sat, 18 Aug 2012 14:51:00 +0000 (+0200) Subject: Replace some deprecated method calls. X-Git-Tag: 1.31.0-rc.0~22678 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%22id_auteur=%24connect_id_auteur%22%29%20.%20%22?a=commitdiff_plain;h=3d97704;p=lhc%2Fweb%2Fwiklou.git Replace some deprecated method calls. Change-Id: Id4beca7b6821139fcc319c5694917e68668835ee --- diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 1c5e777481..16eba66f87 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -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 ); diff --git a/includes/upload/UploadFromUrl.php b/includes/upload/UploadFromUrl.php index c11d7192a4..fdd2b1ae0b 100644 --- a/includes/upload/UploadFromUrl.php +++ b/includes/upload/UploadFromUrl.php @@ -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; } diff --git a/maintenance/importSiteScripts.php b/maintenance/importSiteScripts.php index 65ac65afd8..b4a1bacf7f 100644 --- a/maintenance/importSiteScripts.php +++ b/maintenance/importSiteScripts.php @@ -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 ); diff --git a/tests/jasmine/spec_makers/makeJqueryMsgSpec.php b/tests/jasmine/spec_makers/makeJqueryMsgSpec.php index 1ac8dcba56..9d75be4ec6 100644 --- a/tests/jasmine/spec_makers/makeJqueryMsgSpec.php +++ b/tests/jasmine/spec_makers/makeJqueryMsgSpec.php @@ -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 diff --git a/tests/phpunit/includes/ArticleTablesTest.php b/tests/phpunit/includes/ArticleTablesTest.php index 02571b55c9..17cee6e808 100644 --- a/tests/phpunit/includes/ArticleTablesTest.php +++ b/tests/phpunit/includes/ArticleTablesTest.php @@ -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' ); diff --git a/thumb.php b/thumb.php index 58a8194d00..5fc4446248 100644 --- 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; }