r114055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114054‎ | r114055 | r114056 >
Date:15:12, 17 March 2012
Author:saper
Status:ok
Tags:
Comment:
Followup-To: r114054: More to come
Modified paths:
  • /trunk/extensions/HelpCommons/HelpCommons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/HelpCommons/HelpCommons.php
@@ -120,7 +120,7 @@
121121 $wgOut->clearHTML();
122122 }
123123
124 - $response = file_get_contents( $url . $prefix . '/api.php?format=json&action=parse&prop=text|categorieshtml&redirects&disablepp&pst&text={{:Help:' . $dbkey . '}}' );
 124+ $response = Http::get( $url . $prefix . '/api.php?format=json&action=parse&prop=text|categorieshtml&redirects&disablepp&pst&text={{:Help:' . $dbkey . '}}' );
125125 $data = json_decode( $response, /*assoc=*/ true );
126126 $text = $data['parse']['text']['*'];
127127 $text_html = str_replace( '<span class="editsection">[<a href="'.$prefix.'/', '<span class="editsection">[<a href="'.$url.$prefix.'/', $text ); // re-locate [edit] links to help wiki
@@ -183,7 +183,7 @@
184184 }
185185
186186 // check if requested page does exist
187 - $apiResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $dbkey );
 187+ $apiResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $dbkey );
188188 $apiData = unserialize( $apiResponse );
189189
190190 if ( !$apiResponse ) {
@@ -251,7 +251,7 @@
252252
253253
254254 // check if requested page does exist
255 - $apiResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $talkpage->getTitle()->getDBkey() );
 255+ $apiResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $talkpage->getTitle()->getDBkey() );
256256 $apiData = unserialize( $apiResponse );
257257
258258 if ( !$apiResponse ) {
@@ -338,7 +338,7 @@
339339
340340
341341 // check if requested page does exist
342 - $apiResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $action->getTitle()->getDBkey() );
 342+ $apiResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $action->getTitle()->getDBkey() );
343343 $apiData = unserialize( $apiResponse );
344344
345345 if ( !$apiResponse ) {
@@ -547,7 +547,7 @@
548548
549549 case 'existing':
550550 // check if requested page does exist
551 - $apiResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $title->getDBkey() );
 551+ $apiResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $title->getDBkey() );
552552 $apiData = unserialize( $apiResponse );
553553
554554 if ( !$apiResponse ) {
@@ -631,7 +631,7 @@
632632 }
633633
634634 // check if requested page does exist
635 - $apiResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $target->getDBkey() );
 635+ $apiResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $target->getDBkey() );
636636 $apiData = unserialize( $apiResponse );
637637
638638 if ( !$apiResponse ) {
@@ -698,7 +698,7 @@
699699 }
700700
701701 // check if requested page does exist
702 - $apiResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $page->getDBkey() );
 702+ $apiResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $page->getDBkey() );
703703 $apiData = unserialize( $apiResponse );
704704
705705 if ( !$apiResponse ) {
@@ -762,7 +762,7 @@
763763 }
764764
765765 // check if requested page does exist
766 - $apiPageResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $talk->getDBkey() );
 766+ $apiPageResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help:' . $talk->getDBkey() );
767767 $apiPageData = unserialize( $apiPageResponse );
768768
769769 if ( !$apiPageResponse ) {
@@ -778,7 +778,7 @@
779779 }
780780
781781 // check if requested talkpage does exist
782 - $apiTalkResponse = file_get_contents( $url . $prefix . '/api.php?format=php&action=query&titles=Help_talk:' . $talk->getDBkey() );
 782+ $apiTalkResponse = Http::get( $url . $prefix . '/api.php?format=php&action=query&titles=Help_talk:' . $talk->getDBkey() );
783783 $apiTalkData = unserialize( $apiTalkResponse );
784784
785785 if ( !$apiTalkResponse ) {

Sign-offs

UserFlagDate
Nikerabbitinspected07:29, 19 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r114054Use Http::get instead of file_get_contents to send proper User-Agent. Otherwi...liangent14:26, 17 March 2012

Status & tagging log