r94376 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94375‎ | r94376 | r94377 >
Date:20:00, 12 August 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Collection: Use wfExpandUrl() instead of prepending $wgServer everywhere. In one instance, just keep the URL relative. Also clean up global declarations, you can put more than one on the same line.
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.templates.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.body.php
@@ -944,11 +944,7 @@
945945 }
946946
947947 function renderCollection( $collection, $referrer, $writer ) {
948 - global $wgOut;
949 - global $wgContLang;
950 - global $wgServer;
951 - global $wgScriptPath;
952 - global $wgScriptExtension;
 948+ global $wgOut, $wgContLang, $wgScriptPath, $wgScriptExtension;
953949
954950 if ( !$writer ) {
955951 $writer = 'rl';
@@ -956,7 +952,7 @@
957953
958954 $response = self::mwServeCommand( 'render', array(
959955 'metabook' => $this->buildJSONCollection( $collection ),
960 - 'base_url' => $wgServer . $wgScriptPath,
 956+ 'base_url' => wfExpandUrl( $wgScriptPath ),
961957 'script_extension' => $wgScriptExtension,
962958 'template_blacklist' => wfMsgForContent( 'coll-template_blacklist_title' ),
963959 'template_exclusion_category' => wfMsgForContent( 'coll-exclusion_category_title' ),
@@ -982,19 +978,14 @@
983979 }
984980
985981 function forceRenderCollection() {
986 - global $wgOut;
987 - global $wgContLang;
988 - global $wgRequest;
989 - global $wgServer;
990 - global $wgScriptPath;
991 - global $wgScriptExtension;
 982+ global $wgOut, $wgContLang, $wgRequest, $wgScriptPath, $wgScriptExtension;
992983
993984 $collectionID = $wgRequest->getVal( 'collection_id', '' );
994985 $writer = $wgRequest->getVal( 'writer', 'rl' );
995986
996987 $response = self::mwServeCommand( 'render', array(
997988 'collection_id' => $collectionID,
998 - 'base_url' => $wgServer . $wgScriptPath,
 989+ 'base_url' => wfExpandUrl( $wgScriptPath ),
999990 'script_extension' => $wgScriptExtension,
1000991 'template_blacklist' => wfMsgForContent( 'coll-template_blacklist_title' ),
1001992 'template_exclusion_category' => wfMsgForContent( 'coll-exclusion_category_title' ),
@@ -1020,13 +1011,7 @@
10211012 }
10221013
10231014 function renderRenderingPage() {
1024 - global $wgCollectionVersion;
1025 - global $wgJsMimeType;
1026 - global $wgLang;
1027 - global $wgOut;
1028 - global $wgRequest;
1029 - global $wgScriptPath;
1030 - global $wgServer;
 1015+ global $wgCollectionVersion, $wgJsMimeType, $wgLang, $wgOut, $wgRequest, $wgScriptPath;
10311016
10321017 $response = self::mwServeCommand( 'render_status', array(
10331018 'collection_id' => $wgRequest->getVal( 'collection_id' ),
@@ -1075,7 +1060,7 @@
10761061 $wgOut->setPageTitle( wfMsg( 'coll-rendering_finished_title' ) );
10771062
10781063 $template = new CollectionFinishedTemplate();
1079 - $template->set( 'download_url', $wgServer . SkinTemplate::makeSpecialUrl( 'Book', 'bookcmd=download&' . $query ) );
 1064+ $template->set( 'download_url', wfExpandUrl( SkinTemplate::makeSpecialUrl( 'Book', 'bookcmd=download&' . $query ) ) );
10801065 $template->set( 'is_cached', $wgRequest->getVal( 'is_cached' ) );
10811066 $template->set( 'query', $query );
10821067 $template->set( 'return_to', $return_to );
@@ -1156,10 +1141,7 @@
11571142 }
11581143
11591144 function postZIP( $collection, $partner ) {
1160 - global $wgServer;
1161 - global $wgScriptPath;
1162 - global $wgScriptExtension;
1163 - global $wgOut;
 1145+ global $wgScriptPath, $wgScriptExtension, $wgOut;
11641146
11651147 if ( !isset( $this->mPODPartners[$partner] ) ) {
11661148 $wgOut->showErrorPage( 'coll-invalid_podpartner_title', 'coll-invalid_podpartner_msg' );
@@ -1168,7 +1150,7 @@
11691151
11701152 $response = self::mwServeCommand( 'zip_post', array(
11711153 'metabook' => $this->buildJSONCollection( $collection ),
1172 - 'base_url' => $wgServer . $wgScriptPath,
 1154+ 'base_url' => wfExpandUrl( $wgScriptPath ),
11731155 'script_extension' => $wgScriptExtension,
11741156 'template_blacklist' => wfMsgForContent( 'coll-template_blacklist_title' ),
11751157 'template_exclusion_category' => wfMsgForContent( 'coll-exclusion_category_title' ),
Index: trunk/extensions/Collection/Collection.templates.php
@@ -444,11 +444,10 @@
445445
446446 // needed for Ajax functions
447447 function getProposalList () {
448 - global $wgServer;
449 - global $wgScript;
 448+ global $wgScript, $wgScriptPath;
450449
451 - $mediapath = $GLOBALS['wgScriptPath'] . '/extensions/Collection/images/';
452 - $baseUrl = $wgServer . $wgScript . "/";
 450+ $mediapath = $wgScriptPath . '/extensions/Collection/images/';
 451+ $baseUrl = $wgScript . "/";
453452
454453 $prop = $this->data['proposals'];
455454 $out = '';

Follow-up revisions

RevisionCommit summaryAuthorDate
r945621.17wmf1: MFT r93711, r94346, r94369, r94376, r94404, r94502, r94509, r94511catrope20:30, 15 August 2011
r95628MFT to REL1_18 (extensions)...hashar15:32, 28 August 2011

Comments

#Comment by Catrope (talk | contribs)   20:01, 12 August 2011

This is for bug 30184

Status & tagging log