From cc5534d180625b3d34f7039c0b95b034f3674a20 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 2 Jan 2010 21:16:59 -1000 Subject: First version of Memcache plugin --- lib/cache.php | 2 +- lib/common.php | 12 ++++++++++++ lib/default.php | 7 ++----- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/cache.php b/lib/cache.php index 63f582861..23657bbf3 100644 --- a/lib/cache.php +++ b/lib/cache.php @@ -78,7 +78,7 @@ class Cache static function key($extra) { - $base_key = common_config('memcached', 'base'); + $base_key = common_config('cache', 'base'); if (empty($base_key)) { $base_key = common_keyize(common_config('site', 'name')); diff --git a/lib/common.php b/lib/common.php index 7fa1910af..b0e5c4390 100644 --- a/lib/common.php +++ b/lib/common.php @@ -210,6 +210,18 @@ if ($_db_name != 'statusnet' && !array_key_exists('ini_'.$_db_name, $config['db' $config['db']['ini_'.$_db_name] = INSTALLDIR.'/classes/statusnet.ini'; } +// Backwards compatibility + +if (array_key_exists('memcached', $config)) { + if ($config['memcached']['enabled']) { + addPlugin('Memcache', array('servers' => $config['memcached']['server'])); + } + + if (!empty($config['memcached']['base'])) { + $config['cache']['base'] = $config['memcached']['base']; + } +} + function __autoload($cls) { if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) { diff --git a/lib/default.php b/lib/default.php index 8a70ed3fa..eea11eb2b 100644 --- a/lib/default.php +++ b/lib/default.php @@ -147,11 +147,8 @@ $default = array('enabled' => true, 'consumer_key' => null, 'consumer_secret' => null), - 'memcached' => - array('enabled' => false, - 'server' => 'localhost', - 'base' => null, - 'port' => 11211), + 'cache' => + array('base' => null), 'ping' => array('notify' => array()), 'inboxes' => -- cgit v1.2.3-54-g00ecf