From b1305beb0f00b1779aa90ae80ac07463d0172eb1 Mon Sep 17 00:00:00 2001 From: Sobak Date: Fri, 22 Jul 2016 15:31:42 +0200 Subject: [PATCH] Improve workaround for keeping config file format BC --- lib/configuration.php | 8 +++++++- lib/model.php | 10 +--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/configuration.php b/lib/configuration.php index 05ccd173..8c6c342d 100644 --- a/lib/configuration.php +++ b/lib/configuration.php @@ -196,12 +196,18 @@ class configuration } } - // support for old config file format, before the fork was renamed + // support for old config file format, before the fork was renamed and PSR-4 introduced $this->_configuration['model']['class'] = str_replace( 'zerobin_', 'privatebin_', $this->_configuration['model']['class'] ); + $this->_configuration['model']['class'] = str_replace( + array('privatebin_data', 'privatebin_db'), + array('PrivateBin\\data\\data', 'PrivateBin\\data\\db'), + $this->_configuration['model']['class'] + ); + // ensure a valid expire default key is set if (!array_key_exists($this->_configuration['expire']['default'], $this->_configuration['expire_options'])) { diff --git a/lib/model.php b/lib/model.php index 96ae75f3..9fbf968e 100644 --- a/lib/model.php +++ b/lib/model.php @@ -80,18 +80,10 @@ class model */ private function _getStore() { - // FIXME - // Workaround so that config value don't need to be changed - $callable = str_replace( - array('privatebin_data', 'privatebin_db'), - array('PrivateBin\\data\\data', 'PrivateBin\\data\\db'), - $this->_conf->getKey('class', 'model') - ); - if ($this->_store === null) { $this->_store = forward_static_call( - array($callable, 'getInstance'), + array($this->_conf->getKey('class', 'model'), 'getInstance'), $this->_conf->getSection('model_options') ); }