Index: branches/iwtransclusion/phase3/includes/Interwiki.php |
— | — | @@ -155,7 +155,11 @@ |
156 | 156 | __METHOD__ ) ); |
157 | 157 | $iw = Interwiki::loadFromArray( $row ); |
158 | 158 | if ( $iw ) { |
159 | | - $mc = array( 'iw_url' => $iw->mURL, 'iw_api' => $iw->mAPI, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans ); |
| 159 | + $mc = array( 'iw_url' => $iw->mURL, |
| 160 | + 'iw_api' => $iw->mAPI, |
| 161 | + 'iw_wikiid' => $iw->mWikiID, |
| 162 | + 'iw_local' => $iw->mLocal, |
| 163 | + 'iw_trans' => $iw->mTrans ); |
160 | 164 | $wgMemc->add( $key, $mc, $wgInterwikiExpiry ); |
161 | 165 | return $iw; |
162 | 166 | } |
— | — | @@ -257,7 +261,6 @@ |
258 | 262 | return wfEmptyMsg( $key, $msg ) ? '' : $msg; |
259 | 263 | } |
260 | 264 | |
261 | | - |
262 | 265 | |
263 | 266 | /** |
264 | 267 | * Transclude an interwiki link. |
— | — | @@ -337,13 +340,13 @@ |
338 | 341 | |
339 | 342 | $key = wfMemcKey( 'iwtransclustiontext', 'textid', $wikiID, $fullTitle ); |
340 | 343 | $text = $wgMemc->get( $key ); |
341 | | - if( is_array ( $text ) |
342 | | - && isset ( $text['missing'] ) |
343 | | - && $text['missing'] === true ){ |
344 | | - return false; |
345 | | - } else if ( $text ) { |
346 | | - return $text; |
347 | | - } |
| 344 | + if( is_array ( $text ) && |
| 345 | + isset ( $text['missing'] ) && |
| 346 | + $text['missing'] === true ) { |
| 347 | + return false; |
| 348 | + } else if ( $text ) { |
| 349 | + return $text; |
| 350 | + } |
348 | 351 | |
349 | 352 | $url = wfAppendQuery( |
350 | 353 | $transAPI, |
— | — | @@ -358,17 +361,16 @@ |
359 | 362 | $get = Http::get( $url ); |
360 | 363 | $content = FormatJson::decode( $get, true ); |
361 | 364 | |
362 | | - if ( isset ( $content['query'] ) |
363 | | - && isset ( $content['query']['pages'] ) ) { |
364 | | - $page = array_pop( $content['query']['pages'] ); |
365 | | - if ( $page |
366 | | - && isset( $page['revisions'][0]['*'] ) ) { |
367 | | - $text = $page['revisions'][0]['*']; |
368 | | - $wgMemc->set( $key, $text, $wgTranscludeCacheExpiry ); |
369 | | - return $text; |
370 | | - } else { |
371 | | - $wgMemc->set( $key, array ( 'missing' => true ), $wgTranscludeCacheExpiry ); |
372 | | - } |
| 365 | + if ( isset ( $content['query'] ) && |
| 366 | + isset ( $content['query']['pages'] ) ) { |
| 367 | + $page = array_pop( $content['query']['pages'] ); |
| 368 | + if ( $page && isset( $page['revisions'][0]['*'] ) ) { |
| 369 | + $text = $page['revisions'][0]['*']; |
| 370 | + $wgMemc->set( $key, $text, $wgTranscludeCacheExpiry ); |
| 371 | + return $text; |
| 372 | + } else { |
| 373 | + $wgMemc->set( $key, array ( 'missing' => true ), $wgTranscludeCacheExpiry ); |
| 374 | + } |
373 | 375 | } |
374 | 376 | return false; |
375 | 377 | } |
— | — | @@ -403,8 +405,8 @@ |
404 | 406 | $get = Http::get( $url ); |
405 | 407 | $content = FormatJson::decode( $get, true ); |
406 | 408 | |
407 | | - if ( isset ( $content['query'] ) |
408 | | - && isset ( $content['query']['pages'] ) ) { |
| 409 | + if ( isset ( $content['query'] ) && |
| 410 | + isset ( $content['query']['pages'] ) ) { |
409 | 411 | foreach( $content['query']['pages'] as $page ) { |
410 | 412 | $key = wfMemcKey( 'iwtransclustiontext', 'textid', $wikiID, $page['title'] ); |
411 | 413 | if ( isset ( $page['revisions'][0]['*'] ) ) { |
— | — | @@ -414,7 +416,7 @@ |
415 | 417 | } |
416 | 418 | $wgMemc->set( $key, $text, $wgTranscludeCacheExpiry ); |
417 | 419 | } |
418 | | - } |
| 420 | + } |
419 | 421 | } |
420 | 422 | } |
421 | 423 | } |
Index: branches/iwtransclusion/phase3/includes/Revision.php |
— | — | @@ -906,7 +906,7 @@ |
907 | 907 | global $wgRevisionCacheExpiry, $wgMemc; |
908 | 908 | $textId = $this->getTextId(); |
909 | 909 | if( isset( $this->mWikiID ) ) { |
910 | | - $key = wfForeignMemcKey( $this->mWikiID, 'revisiontext', 'textid', $textId ); |
| 910 | + $key = wfForeignMemcKey( $this->mWikiID, null, 'revisiontext', 'textid', $textId ); |
911 | 911 | } else { |
912 | 912 | $key = wfMemcKey( 'revisiontext', 'textid', $textId ); |
913 | 913 | } |