From 5d16ab965464c28c410999fd6283044ce2ff1b57 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Tue, 15 Nov 2016 10:47:24 +0000 Subject: [PATCH] (retrofit from trunk): APCu comptability layer. Retrofit after validation. SVN:2.3[4476] --- core/apc-compat.php | 69 ++++++++++++++++++++++++++++++++++++++++ core/metamodel.class.php | 1 + 2 files changed, 70 insertions(+) create mode 100644 core/apc-compat.php diff --git a/core/apc-compat.php b/core/apc-compat.php new file mode 100644 index 0000000000..4af4c2fa53 --- /dev/null +++ b/core/apc-compat.php @@ -0,0 +1,69 @@ + + +// Emulate the API of APC, over APCU +// Note: for PHP < 7, this compatibility used to be provided by APCU itself (if compiled with some options) +// for PHP 7+, it can be provided by the mean of apcu_bc, which is not so simple to install +// The current emulation aims at skipping this complexity +if (!function_exists('apc_store') && function_exists('apcu_store')) +{ + function apc_add($key, $var, $ttl = 0) + { + return apcu_add($key, $var, $ttl); + } + function apc_cache_info($cache_type = '', $limited = false) + { + return apcu_cache_info($limited); + } + function apc_cas($key, $old, $new) + { + return apcu_cas($key, $old, $new); + } + function apc_clear_cache($cache_type = '') + { + return apcu_clear_cache(); + } + function apc_dec($key, $step = 1, &$success = null) + { + apcu_dec($key, $step, $success); + } + function apc_delete($key) + { + return apcu_delete($key); + } + function apc_exists($keys) + { + return apcu_exists($keys); + } + function apc_fetch($key) + { + return apcu_fetch($key); + } + function apc_inc($key, $step = 1, &$success = null) + { + apcu_inc($key, $step, $success); + } + function apc_sma_info($limited = false) + { + return apcu_sma_info($limited); + } + function apc_store($key, $var, $ttl = 0) + { + return apcu_store($key, $var, $ttl); + } +} diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 37dc27a2b5..ce7e6cc60b 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -22,6 +22,7 @@ require_once(APPROOT.'core/querymodifier.class.inc.php'); require_once(APPROOT.'core/metamodelmodifier.inc.php'); require_once(APPROOT.'core/computing.inc.php'); require_once(APPROOT.'core/relationgraph.class.inc.php'); +require_once(APPROOT.'core/apc-compat.php'); /** * Metamodel