From c755b66d8c0c70a69d77ef02ee45c9f33d846e6e Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 26 Sep 2016 15:54:41 +0000 Subject: [PATCH] Optimization: make it less cumbersome to have the APC user cache enabled for PHP 5.5+. Prior to this enhancement, it used to require a compilation flag (for apcu) until PHP7... then it became mandatory to install a dedicated backward compatibility module named after apcu_bc. Now, having apcu installed and enabled is ENOUGH. SVN:trunk[4415] --- core/apc-compat.php | 37 +++++++++++++++++++++++++++++++++++++ core/metamodel.class.php | 1 + 2 files changed, 38 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 000000000..cf2f40ef9 --- /dev/null +++ b/core/apc-compat.php @@ -0,0 +1,37 @@ + + +if (!function_exists('apc_store') && function_exists('apcu_store')) +{ + // 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 + function apc_store($key, $var, $ttl = 0) + { + return apcu_store($key, $var, $ttl); + } + function apc_fetch($key) + { + return apcu_fetch($key); + } + function apc_delete($key) + { + return apcu_delete($key); + } +} diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 07283abc8..34b492975 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