From 44c32d0ab18e850e2fea81884571419f70a8908a Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Mon, 6 Jun 2016 15:20:38 +0000 Subject: [PATCH] CRM-13640: Improve hash generator for logfile. --- CRM/Core/Error.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index 7d488ee907..cc938288bc 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -646,6 +646,18 @@ class CRM_Core_Error extends PEAR_ErrorStack { return Log::singleton('file', \Civi::$statics[__CLASS__]['logger_file' . $prefix], ''); } + /** + * Generate a hash for the logfile. + * CRM-13640. + */ + protected static function generateLogFileHash($config) { + $md5inputs = array( + md5($config->dsn), + $config->dsn, + ); + return md5(var_export($md5inputs,1)); + } + /** * Generate the name of the logfile to use and store it as a static. * @@ -659,7 +671,8 @@ class CRM_Core_Error extends PEAR_ErrorStack { $prefixString = $prefix ? ($prefix . '.') : ''; - $fileName = $config->configAndLogDir . 'CiviCRM.' . $prefixString . md5($config->dsn) . '.log'; + $hash = self::generateLogFileHash($config); + $fileName = $config->configAndLogDir . 'CiviCRM.' . $prefixString . $hash . '.log'; // Roll log file monthly or if greater than 256M // note that PHP file functions have a limit of 2G and hence -- 2.25.1