Index: trunk/phase3/includes/CacheManager.php |
— | — | @@ -6,6 +6,11 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** |
| 10 | + * We need the title class |
| 11 | + */ |
| 12 | +require_once( 'Title.php' ); |
| 13 | + |
| 14 | +/** |
10 | 15 | * Handles talking to the file cache, putting stuff in and taking it back out. |
11 | 16 | * Mostly called from Article.php, also from DatabaseFunctions.php for the |
12 | 17 | * emergency abort/fallback to cache. |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -57,6 +57,7 @@ |
58 | 58 | require_once( 'User.php' ); |
59 | 59 | require_once( 'Skin.php' ); |
60 | 60 | require_once( 'OutputPage.php' ); |
| 61 | +require_once( 'Title.php' ); |
61 | 62 | require_once( 'MagicWord.php' ); |
62 | 63 | require_once( 'Block.php' ); |
63 | 64 | require_once( 'MessageCache.php' ); |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -8,6 +8,9 @@ |
9 | 9 | /** */ |
10 | 10 | require_once( 'normal/UtfNormal.php' ); |
11 | 11 | |
| 12 | +$wgTitleInterwikiCache = array(); |
| 13 | +$wgTitleCache = array(); |
| 14 | + |
12 | 15 | define ( 'GAID_FOR_UPDATE', 1 ); |
13 | 16 | |
14 | 17 | # Title::newFromTitle maintains a cache to avoid |
— | — | @@ -26,13 +29,6 @@ |
27 | 30 | */ |
28 | 31 | class Title { |
29 | 32 | /** |
30 | | - * Static cache variables |
31 | | - */ |
32 | | - static private $titleCache=array(); |
33 | | - static private $interwikiCache=array(); |
34 | | - |
35 | | - |
36 | | - /** |
37 | 33 | * All member variables should be considered private |
38 | 34 | * Please use the accessor functions |
39 | 35 | */ |
— | — | @@ -109,6 +105,7 @@ |
110 | 106 | * @access public |
111 | 107 | */ |
112 | 108 | function newFromText( $text, $defaultNamespace = NS_MAIN ) { |
| 109 | + global $wgTitleCache; |
113 | 110 | $fname = 'Title::newFromText'; |
114 | 111 | |
115 | 112 | if( is_object( $text ) ) { |
— | — | @@ -123,8 +120,8 @@ |
124 | 121 | * |
125 | 122 | * In theory these are value objects and won't get changed... |
126 | 123 | */ |
127 | | - if( $defaultNamespace == NS_MAIN && isset( Title::$titleCache[$text] ) ) { |
128 | | - return Title::$titleCache[$text]; |
| 124 | + if( $defaultNamespace == NS_MAIN && isset( $wgTitleCache[$text] ) ) { |
| 125 | + return $wgTitleCache[$text]; |
129 | 126 | } |
130 | 127 | |
131 | 128 | /** |
— | — | @@ -141,11 +138,11 @@ |
142 | 139 | if( $defaultNamespace == NS_MAIN ) { |
143 | 140 | if( $cachedcount >= MW_TITLECACHE_MAX ) { |
144 | 141 | # Avoid memory leaks on mass operations... |
145 | | - Title::$titleCache = array(); |
| 142 | + $wgTitleCache = array(); |
146 | 143 | $cachedcount=0; |
147 | 144 | } |
148 | 145 | $cachedcount++; |
149 | | - Title::$titleCache[$text] =& $t; |
| 146 | + $wgTitleCache[$text] =& $t; |
150 | 147 | } |
151 | 148 | return $t; |
152 | 149 | } else { |
— | — | @@ -377,15 +374,15 @@ |
378 | 375 | * @access public |
379 | 376 | */ |
380 | 377 | function getInterwikiLink( $key ) { |
381 | | - global $wgMemc, $wgDBname, $wgInterwikiExpiry; |
| 378 | + global $wgMemc, $wgDBname, $wgInterwikiExpiry, $wgTitleInterwikiCache; |
382 | 379 | global $wgInterwikiCache; |
383 | 380 | $fname = 'Title::getInterwikiLink'; |
384 | 381 | |
385 | 382 | $key = strtolower( $key ); |
386 | 383 | |
387 | 384 | $k = $wgDBname.':interwiki:'.$key; |
388 | | - if( array_key_exists( $k, Title::$interwikiCache ) ) { |
389 | | - return Title::$interwikiCache[$k]->iw_url; |
| 385 | + if( array_key_exists( $k, $wgTitleInterwikiCache ) ) { |
| 386 | + return $wgTitleInterwikiCache[$k]->iw_url; |
390 | 387 | } |
391 | 388 | |
392 | 389 | if ($wgInterwikiCache) { |
— | — | @@ -395,7 +392,7 @@ |
396 | 393 | $s = $wgMemc->get( $k ); |
397 | 394 | # Ignore old keys with no iw_local |
398 | 395 | if( $s && isset( $s->iw_local ) && isset($s->iw_trans)) { |
399 | | - Title::$interwikiCache[$k] = $s; |
| 396 | + $wgTitleInterwikiCache[$k] = $s; |
400 | 397 | return $s->iw_url; |
401 | 398 | } |
402 | 399 | |
— | — | @@ -416,7 +413,7 @@ |
417 | 414 | $s->iw_trans = 0; |
418 | 415 | } |
419 | 416 | $wgMemc->set( $k, $s, $wgInterwikiExpiry ); |
420 | | - Title::$interwikiCache[$k] = $s; |
| 417 | + $wgTitleInterwikiCache[$k] = $s; |
421 | 418 | |
422 | 419 | return $s->iw_url; |
423 | 420 | } |
— | — | @@ -431,6 +428,7 @@ |
432 | 429 | */ |
433 | 430 | function getInterwikiCached( $key ) { |
434 | 431 | global $wgDBname, $wgInterwikiCache, $wgInterwikiScopes, $wgInterwikiFallbackSite; |
| 432 | + global $wgTitleInterwikiCache; |
435 | 433 | static $db, $site; |
436 | 434 | |
437 | 435 | if (!$db) |
— | — | @@ -461,7 +459,7 @@ |
462 | 460 | $s->iw_url=$url; |
463 | 461 | $s->iw_local=(int)$local; |
464 | 462 | } |
465 | | - Title::$interwikiCache[$wgDBname.':interwiki:'.$key] = $s; |
| 463 | + $wgTitleInterwikiCache[$wgDBname.':interwiki:'.$key] = $s; |
466 | 464 | return $s->iw_url; |
467 | 465 | } |
468 | 466 | /** |
— | — | @@ -473,13 +471,13 @@ |
474 | 472 | * @access public |
475 | 473 | */ |
476 | 474 | function isLocal() { |
477 | | - global $wgDBname; |
| 475 | + global $wgTitleInterwikiCache, $wgDBname; |
478 | 476 | |
479 | 477 | if ( $this->mInterwiki != '' ) { |
480 | 478 | # Make sure key is loaded into cache |
481 | 479 | $this->getInterwikiLink( $this->mInterwiki ); |
482 | 480 | $k = $wgDBname.':interwiki:' . $this->mInterwiki; |
483 | | - return (bool)(Title::$interwikiCache[$k]->iw_local); |
| 481 | + return (bool)($wgTitleInterwikiCache[$k]->iw_local); |
484 | 482 | } else { |
485 | 483 | return true; |
486 | 484 | } |
— | — | @@ -493,14 +491,14 @@ |
494 | 492 | * @access public |
495 | 493 | */ |
496 | 494 | function isTrans() { |
497 | | - global $wgDBname; |
| 495 | + global $wgTitleInterwikiCache, $wgDBname; |
498 | 496 | |
499 | 497 | if ($this->mInterwiki == '') |
500 | 498 | return false; |
501 | 499 | # Make sure key is loaded into cache |
502 | 500 | $this->getInterwikiLink( $this->mInterwiki ); |
503 | 501 | $k = $wgDBname.':interwiki:' . $this->mInterwiki; |
504 | | - return (bool)(Title::$interwikiCache[$k]->iw_trans); |
| 502 | + return (bool)($wgTitleInterwikiCache[$k]->iw_trans); |
505 | 503 | } |
506 | 504 | |
507 | 505 | /** |
Index: trunk/phase3/trackback.php |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | require_once('./LocalSettings.php'); |
22 | 22 | require_once('includes/Setup.php'); |
23 | 23 | |
| 24 | +require_once('Title.php'); |
24 | 25 | require_once('DatabaseFunctions.php'); |
25 | 26 | |
26 | 27 | /** |