From 40360da454f3c4192874659d69bacba36db2ee22 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Wed, 20 Sep 2017 14:41:45 +0000 Subject: [PATCH] N.1052 After a setup or MTP, the datamodel is not taken into account... until the web server gets restarted or the APC cache (user data) gets reset. SVN:trunk[4922] --- core/apc-compat.php | 25 ++++++++++++++++++++++++- core/metamodel.class.php | 11 +---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/core/apc-compat.php b/core/apc-compat.php index 4af4c2fa5..00f8ff991 100644 --- a/core/apc-compat.php +++ b/core/apc-compat.php @@ -1,5 +1,5 @@ getNumberOfParameters() != 2) + { + // Beware: APCu behaves slightly differently from APC !! + // Worse: the compatibility layer integrated into APC differs from apcu-bc (testing the number of parameters is a must) + // In CLI mode (PHP > 7) apc_cache_info returns null and outputs an error message. + $aCacheUserData = @apc_cache_info(); + } + else + { + $aCacheUserData = @apc_cache_info('user'); + } + return $aCacheUserData; +} \ No newline at end of file diff --git a/core/metamodel.class.php b/core/metamodel.class.php index eb0978e4c..75b1a3934 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -5226,21 +5226,12 @@ abstract class MetaModel public static function GetCacheEntries($sEnvironment = null) { - if (!function_exists('apc_cache_info')) return array(); if (is_null($sEnvironment)) { $sEnvironment = MetaModel::GetEnvironmentId(); } $aEntries = array(); - if (extension_loaded('apcu')) - { - // Beware: APCu behaves slightly differently from APC !! - $aCacheUserData = @apc_cache_info(); - } - else - { - $aCacheUserData = @apc_cache_info('user'); - } + $aCacheUserData = apc_cache_info_compat(); if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list'])) { $sPrefix = 'itop-'.$sEnvironment.'-';