r109625 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109624‎ | r109625 | r109626 >
Date:16:12, 20 January 2012
Author:demon
Status:ok (Comments)
Tags:
Comment:
Greatly simplify http request from r108696
Modified paths:
  • /trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php
@@ -398,21 +398,14 @@
399399 $foreignOptions = $wgMemc->get( $memcKey );
400400
401401 if ( !$foreignOptions ) {
402 - $options = array();
403 - $options['method'] = 'GET';
404402 $url = 'http://en.wikipedia.org/w/api.php?action=query&prop=revisions&&rvlimit=1&rvprop=content&format=json&titles=MediaWiki:' . $pageName;
405 - $req = ( class_exists( 'MWHttpRequest' ) ) ? MWHttpRequest::factory( $url, $options ) : HttpRequest::factory( $url, $options );
 403+ $ret = Http::get( $url );
406404
407 - $status = $req->execute();
408 -
409 - if ( !$status->isOK() ) {
410 - $error = $req->getContent();
 405+ if ( !$ret ) {
411406 wfProfileOut( __METHOD__ );
412407 return array( $key, $rev );
413408 }
414409
415 - $ret = $req->getContent();
416 -
417410 $jsonData = FormatJson::decode( $ret, true );
418411
419412 if ( isset( $jsonData['query']['pages'] ) ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108696load options directly from a foreign wikipreilly23:31, 11 January 2012

Comments

#Comment by Siebrand (talk | contribs)   10:57, 22 January 2012

There's a double && in $ URL. Is that okay?

Status & tagging log