Index: trunk/phase3/includes/BagOStuff.php |
— | — | @@ -565,6 +565,52 @@ |
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
| 569 | + * Wrapper for XCache object caching functions; identical interface |
| 570 | + * to the APC wrapper |
| 571 | + */ |
| 572 | +class XCacheBagOStuff extends APCBagOStuff { |
| 573 | + |
| 574 | + /** |
| 575 | + * Get a value from the XCache object cache |
| 576 | + * |
| 577 | + * @param string $key Cache key |
| 578 | + * @return mixed |
| 579 | + */ |
| 580 | + public function get( $key ) { |
| 581 | + $val = xcache_get( $key ); |
| 582 | + if( is_string( $val ) ) |
| 583 | + $val = unserialize( $val ); |
| 584 | + return $val; |
| 585 | + } |
| 586 | + |
| 587 | + /** |
| 588 | + * Store a value in the XCache object cache |
| 589 | + * |
| 590 | + * @param string $key Cache key |
| 591 | + * @param mixed $value Object to store |
| 592 | + * @param int $expire Expiration time |
| 593 | + * @return bool |
| 594 | + */ |
| 595 | + public function set( $key, $value, $expire = 0 ) { |
| 596 | + xcache_set( $key, serialize( $value ), $expire ); |
| 597 | + return true; |
| 598 | + } |
| 599 | + |
| 600 | + /** |
| 601 | + * Remove a value from the XCache object cache |
| 602 | + * |
| 603 | + * @param string $key Cache key |
| 604 | + * @param int $time Not used in this implementation |
| 605 | + * @return bool |
| 606 | + */ |
| 607 | + public function delete( $key, $time = 0 ) { |
| 608 | + xcache_unset( $key ); |
| 609 | + return true; |
| 610 | + } |
| 611 | + |
| 612 | +} |
| 613 | + |
| 614 | +/** |
569 | 615 | * @todo document |
570 | 616 | */ |
571 | 617 | class DBABagOStuff extends BagOStuff { |
Index: trunk/phase3/includes/ObjectCache.php |
— | — | @@ -70,6 +70,8 @@ |
71 | 71 | $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff; |
72 | 72 | } elseif ( function_exists( 'apc_fetch') ) { |
73 | 73 | $wgCaches[CACHE_ACCEL] = new APCBagOStuff; |
| 74 | + } elseif( function_exists( 'xcache_get' ) ) { |
| 75 | + $wgCaches[CACHE_ACCEL] = new XCacheBagOStuff(); |
74 | 76 | } elseif ( function_exists( 'mmcache_get' ) ) { |
75 | 77 | $wgCaches[CACHE_ACCEL] = new TurckBagOStuff; |
76 | 78 | } else { |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | 'TurckBagOStuff' => 'includes/BagOStuff.php', |
24 | 24 | 'APCBagOStuff' => 'includes/BagOStuff.php', |
25 | 25 | 'eAccelBagOStuff' => 'includes/BagOStuff.php', |
| 26 | + 'XCacheBagOStuff' => 'includes/BagOStuff.php', |
26 | 27 | 'DBABagOStuff' => 'includes/BagOStuff.php', |
27 | 28 | 'Block' => 'includes/Block.php', |
28 | 29 | 'HTMLFileCache' => 'includes/HTMLFileCache.php', |
Index: trunk/phase3/config/index.php |
— | — | @@ -450,6 +450,10 @@ |
451 | 451 | print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n"; |
452 | 452 | } |
453 | 453 | |
| 454 | +$conf->xcache = function_exists( 'xcache_get' ); |
| 455 | +if( $conf->xcache ) |
| 456 | + print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>"; |
| 457 | + |
454 | 458 | $conf->apc = function_exists('apc_fetch'); |
455 | 459 | if ($conf->apc ) { |
456 | 460 | print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>"; |
— | — | @@ -461,10 +465,11 @@ |
462 | 466 | print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n"; |
463 | 467 | } |
464 | 468 | |
465 | | -if( !$conf->turck && !$conf->eaccel && !$conf->apc ) { |
| 469 | +if( !( $conf->turck || $conf->eaccel || $conf->apc || $conf->xcache ) ) { |
466 | 470 | echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>, |
467 | | - <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>, or |
468 | | - <a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' ); |
| 471 | + <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>, |
| 472 | + <a href="http://www.php.net/apc">APC</a> or <a href="http://trac.lighttpd.net/xcache/">XCache</a>. |
| 473 | + Object caching functions cannot be used.</li>' ); |
469 | 474 | } |
470 | 475 | |
471 | 476 | $conf->diff3 = false; |
— | — | @@ -1128,8 +1133,7 @@ |
1129 | 1134 | <p class="config-desc"> |
1130 | 1135 | An admin can lock/delete pages, block users from editing, and do other maintenance tasks.<br /> |
1131 | 1136 | A new account will be added only when creating a new wiki database. |
1132 | | - </p> |
1133 | | - <p class="config-desc"> |
| 1137 | + <br /><br /> |
1134 | 1138 | The password cannot be the same as the username. |
1135 | 1139 | </p> |
1136 | 1140 | |
— | — | @@ -1144,6 +1148,11 @@ |
1145 | 1149 | aField( $conf, "Shm", "Turck MMCache", "radio", "turck" ); |
1146 | 1150 | echo "</li>"; |
1147 | 1151 | } |
| 1152 | + if( $conf->xcache ) { |
| 1153 | + echo( '<li>' ); |
| 1154 | + aField( $conf, 'Shm', 'XCache', 'radio', 'xcache' ); |
| 1155 | + echo( '</li>' ); |
| 1156 | + } |
1148 | 1157 | if ( $conf->apc ) { |
1149 | 1158 | echo "<li>"; |
1150 | 1159 | aField( $conf, "Shm", "APC", "radio", "apc" ); |
— | — | @@ -1160,10 +1169,11 @@ |
1161 | 1170 | <div style="clear:left"><?php aField( $conf, "MCServers", "Memcached servers:", "text" ) ?></div> |
1162 | 1171 | </div> |
1163 | 1172 | <p class="config-desc"> |
1164 | | - Using a shared memory system such as Turck MMCache, APC, eAccelerator, or Memcached |
1165 | | - will speed up MediaWiki significantly. Memcached is the best solution but needs to be |
1166 | | - installed. Specify the server addresses and ports in a comma-separated list. Only |
1167 | | - use Turck shared memory if the wiki will be running on a single Apache server. |
| 1173 | + An object caching system such as memcached will provide a significant performance boost, |
| 1174 | + but needs to be installed. Provide the server addresses and ports in a comma-separated list. |
| 1175 | + <br /><br /> |
| 1176 | + MediaWiki can also detect and support eAccelerator, Turck MMCache, APC, and XCache, but |
| 1177 | + these should not be used if the wiki will be running on multiple application servers. |
1168 | 1178 | </p> |
1169 | 1179 | </div> |
1170 | 1180 | |
— | — | @@ -1395,6 +1405,7 @@ |
1396 | 1406 | $mcservers = var_export( $conf->MCServerArray, true ); |
1397 | 1407 | break; |
1398 | 1408 | case 'turck': |
| 1409 | + case 'xcache': |
1399 | 1410 | case 'apc': |
1400 | 1411 | case 'eaccel': |
1401 | 1412 | $cacheType = 'CACHE_ACCEL'; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | * (bug 8760) Allow wiki links in "protectexpiry" message |
71 | 71 | * (bug 5908) Add "DEFAULTSORTKEY" and "DEFAULTCATEGORYSORT" aliases for |
72 | 72 | "DEFAULTSORT" magic word |
| 73 | +* (bug 10181) Support the XCache object caching mechanism |
73 | 74 | |
74 | 75 | == Bugfixes since 1.10 == |
75 | 76 | |