fixed 'cacheTimestamp' for config changes
This commit is contained in:
committed by
Yuri Kuznetsov
parent
a8adbcf9cf
commit
5e149fdd05
@@ -43,8 +43,6 @@ class Settings extends \Espo\Core\Controllers\Base
|
||||
throw new Error('Cannot save settings');
|
||||
}
|
||||
|
||||
$this->getContainer()->get('dataManager')->updateCacheTimestamp();
|
||||
|
||||
return $this->getConfig()->getData($this->getUser()->isAdmin());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +121,7 @@ class DataManager
|
||||
*/
|
||||
public function updateCacheTimestamp()
|
||||
{
|
||||
$config = $this->getContainer()->get('config');
|
||||
|
||||
return $config->set('cacheTimestamp', time());
|
||||
return $this->getContainer()->get('config')->updateCacheTimestamp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ class Config
|
||||
|
||||
protected $configPath = 'data/config.php';
|
||||
|
||||
private $cacheTimestamp = 'cacheTimestamp';
|
||||
|
||||
/**
|
||||
* Array of admin items
|
||||
*
|
||||
@@ -121,6 +123,10 @@ class Config
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($values[$this->cacheTimestamp])) {
|
||||
$values = array_merge($this->updateCacheTimestamp(true), $values);
|
||||
}
|
||||
|
||||
$result = $this->getFileManager()->mergeContentsPHP($this->configPath, $values, true);
|
||||
$this->loadConfig(true);
|
||||
|
||||
@@ -192,6 +198,25 @@ class Config
|
||||
return $this->setArray($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update cache timestamp
|
||||
*
|
||||
* @param $onlyValue - If need to return just timestamp array
|
||||
* @return bool | array
|
||||
*/
|
||||
public function updateCacheTimestamp($onlyValue = false)
|
||||
{
|
||||
$timestamp = array(
|
||||
$this->cacheTimestamp => time(),
|
||||
);
|
||||
|
||||
if ($onlyValue) {
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
return $this->set($timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get admin items
|
||||
*
|
||||
|
||||
@@ -144,7 +144,7 @@ return array (
|
||||
10 => 'cron',
|
||||
),
|
||||
'isInstalled' => true,
|
||||
'cacheTimestamp' => 1399456816,
|
||||
'cacheTimestamp' => 1400160414,
|
||||
'testOption' => 'Another Wrong Value',
|
||||
'testOption2' => 'Test2',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user