$conf->turck = function_exists( 'mmcache_get' );
if ( $conf->turck ) {
print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
-} else {
- print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> not installed, " .
+}
+$conf->eaccel = function_exists( 'eaccelerator_get' );
+if ( $conf->eaccel ) {
+ $conf->turck = 'eaccelerator';
+ print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
+}
+if (!$conf->turck && !$conf->eaccel) {
+ print "<li>Neither <a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> nor <a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> are installed, " .
"can't use object caching functions</li>\n";
}
echo "</li>";
}
?>
+ <?php
+ if ( $conf->eaccel ) {
+ echo "<li>";
+ aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
+ echo "</li>";
+ }
+ ?>
<li><?php aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?></li>
<li><?php aField( $conf, "MCServers", "Memcached servers", "" ) ?></li>
</ul>
</dd>
<dt>
- Using a shared memory system such as Turck MMCache or Memcached will speed
+ Using a shared memory system such as Turck MMCache, eAccelerator, or Memcached will speed
up MediaWiki significantly. Memcached is the best solution but needs to be
installed. Specify the server addresses and ports in a comma-separted list. Only
use Turck shared memory if the wiki will be running on a single Apache server.
$mcservers = var_export( $conf->MCServerArray, true );
break;
case 'turck':
+ case 'eaccel':
$memcached = 'false';
$mcservers = 'array()';
$turck = '';
\$wgUseMemCached = $memcached;
\$wgMemCachedServers = $mcservers;
{$turck}\$wgUseTurckShm = function_exists( 'mmcache_get' ) && php_sapi_name() == 'apache';
+{$turck}\$wgUseEAccelShm = function_exists( 'eaccelerator_get' ) && php_sapi_name() == 'apache';
## To enable image uploads, make sure the 'images' directory
## is writable, then uncomment this:
* Turck MMCache shared memory
* You can use this for persistent caching where your wiki runs on a single
* server. Enabled by default if Turck is installed. Mutually exclusive with
- * memcached, memcached is used if both are specified.
+ * memcached and eAccelerator, the preference order priorities being memcached first,
+ * Turck MMCache second, and eAccelerator third.
*
* @global bool $wgUseTurckShm Enable or disabled Turck MMCache
*/
$wgUseTurckShm = false;
+/**
+ * eAccelerator shared memory
+ * You can use this for persistent caching where your wiki runs on a single
+ * server. Enabled by default if eAccelerator is installed. Mutually exclusive with
+ * memcached and Turck MMCache, the preference order being memcached first,
+ * Turck MMCache second, and eAccelerator third.
+ *
+ * Most of the code to support this is directly copied from the Turck code.
+ *
+ * @global bool $wgUseEAccelShm Enable or disabled eAccelerator
+ */
+$wgUseEAccelShm = false;
+
# Language settings
#
return true;
}
}
+
+/**
+ * This is a wrapper for eAccelerator's shared memory functions.
+ *
+ * This is basically identical to the Turck MMCache version,
+ * mostly because eAccelerator is based on Turck MMCache.
+ *
+ * @package MediaWiki
+ */
+class eAccelBagOStuff extends BagOStuff {
+ function get($key) {
+ $val = eaccelerator_get( $key );
+ if ( is_string( $val ) ) {
+ $val = unserialize( $val );
+ }
+ return $val;
+ }
+
+ function set($key, $value, $exptime=0) {
+ eaccelerator_put( $key, serialize( $value ), $exptime );
+ return true;
+ }
+
+ function delete($key, $time=0) {
+ eaccelerator_rm( $key );
+ return true;
+ }
+
+ function lock($key, $waitTimeout = 0 ) {
+ eaccelerator_lock( $key );
+ return true;
+ }
+
+ function unlock($key) {
+ eaccelerator_unlock( $key );
+ return true;
+ }
+}
?>
require_once( 'ObjectCache.php' );
$wgMemc = new TurckBagOStuff;
$messageMemc = &$wgMemc;
+} elseif ( $wgUseEAccelShm ) {
+ # eAccelerator shared memory
+ #
+ require_once( 'ObjectCache.php' );
+ $wgMemc = new eAccelBagOStuff;
+ $messageMemc = &$wgMemc;
} else {
/**
* No shared memory