diff options
author | Jelle van der Waa <jelle@vdwaa.nl> | 2018-03-09 23:42:51 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2018-03-10 16:48:14 +0100 |
commit | ca6332de6e33be645e1abab3434237805b8f7dfa (patch) | |
tree | 19348337f6477324a297d8a4384167a0c3851d49 /web/lib/cachefuncs.inc.php | |
parent | c3bca45973c8ec351f8b41421705dec7d7a620e2 (diff) | |
download | aur-ca6332de6e33be645e1abab3434237805b8f7dfa.tar.gz aur-ca6332de6e33be645e1abab3434237805b8f7dfa.tar.xz |
Update cache code to INI style configuration
Change the defines to config_get and add one cache option and one option
to define memcache_servers. Mention the required dependency to get
memcached working in the INSTALL file.
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/cachefuncs.inc.php')
-rw-r--r-- | web/lib/cachefuncs.inc.php | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/web/lib/cachefuncs.inc.php b/web/lib/cachefuncs.inc.php index faeae5a2..881ad8f2 100644 --- a/web/lib/cachefuncs.inc.php +++ b/web/lib/cachefuncs.inc.php @@ -1,22 +1,18 @@ <?php -if (!defined('CACHE_TYPE')) { - define('CACHE_TYPE', 'NONE'); -} - # Check if APC extension is loaded, and set cache prefix if it is. -if (CACHE_TYPE == 'APC' && !defined('EXTENSION_LOADED_APC')) { +if (config_get('options', 'cache') == 'apc' && !defined('EXTENSION_LOADED_APC')) { define('EXTENSION_LOADED_APC', extension_loaded('apc')); define('CACHE_PREFIX', 'aur:'); } # Check if memcache extension is loaded, and set cache prefix if it is. -if (CACHE_TYPE == 'MEMCACHE' && !defined('EXTENSION_LOADED_MEMCACHE')) { +if (config_get('options', 'cache') == 'memcache' && !defined('EXTENSION_LOADED_MEMCACHE')) { define('EXTENSION_LOADED_MEMCACHE', extension_loaded('memcached')); define('CACHE_PREFIX', 'aur:'); global $memcache; $memcache = new Memcached(); - $mcs = defined('MEMCACHE_SERVERS') ? MEMCACHE_SERVERS : '127.0.0.1:11211'; + $mcs = config_get('options', 'memcache_servers'); foreach (explode(',', $mcs) as $elem) { $telem = trim($elem); $mcserver = explode(':', $telem); |