Improve workaround for keeping config file format BC
This commit is contained in:
parent
e4f95190c3
commit
b1305beb0f
2 changed files with 8 additions and 10 deletions
|
@ -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(
|
$this->_configuration['model']['class'] = str_replace(
|
||||||
'zerobin_', 'privatebin_',
|
'zerobin_', 'privatebin_',
|
||||||
$this->_configuration['model']['class']
|
$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
|
// ensure a valid expire default key is set
|
||||||
if (!array_key_exists($this->_configuration['expire']['default'], $this->_configuration['expire_options']))
|
if (!array_key_exists($this->_configuration['expire']['default'], $this->_configuration['expire_options']))
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,18 +80,10 @@ class model
|
||||||
*/
|
*/
|
||||||
private function _getStore()
|
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)
|
if ($this->_store === null)
|
||||||
{
|
{
|
||||||
$this->_store = forward_static_call(
|
$this->_store = forward_static_call(
|
||||||
array($callable, 'getInstance'),
|
array($this->_conf->getKey('class', 'model'), 'getInstance'),
|
||||||
$this->_conf->getSection('model_options')
|
$this->_conf->getSection('model_options')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue