fix filename for CiviCRM 5.76+
Upgrading to CiviCRM 5.76 causes an error on REST API calls. Partial backtrace follows.
The error is proceeded by a warning that Log_file::$_filename
is undefined. Presumably this is tied to the upgrade to PEAR/log 1.14.4.
Instead, we use the method for retrieving the filename used in CRM_Core_Error
for the core logs.
PHP Warning: Undefined property: Log_file::$_filename in /var/www/mysite.org/web/wp-content/civicrm-custom/extensions/apirestlog/CRM/ApiRestLog/Guard.php on line 41
PHP Fatal error: Uncaught ValueError: Path cannot be empty in /var/www/mysite.org/web/wp-content/civicrm-custom/extensions/apirestlog/vendor/bandwidth-throttle/token-bucket/classes/storage/FileStorage.php:59
Stack trace:
#0 /var/www/mysite.org/web/wp-content/civicrm-custom/extensions/apirestlog/vendor/bandwidth-throttle/token-bucket/classes/storage/FileStorage.php(59): fopen('', 'c+')
#1 /var/www/mysite.org/web/wp-content/civicrm-custom/extensions/apirestlog/vendor/bandwidth-throttle/token-bucket/classes/storage/FileStorage.php(49): bandwidthThrottle\\tokenBucket\\storage\\FileStorage->open()
#2 /var/www/mysite.org/web/wp-content/civicrm-custom/extensions/apirestlog/CRM/ApiRestLog/Guard.php(41): bandwidthThrottle\\tokenBucket\\storage\\FileStorage->__construct(NULL)
#3 /var/www/mysite.org/web/wp-content/civicrm-custom/extensions/apirestlog/CRM/ApiRestLog/Guard.php(62): CRM_ApiRestLog_Guard->__construct()
#4 /var/www/mhc.megaphonetech.c...'