fixed 'cacheTimestamp' for config changes

This commit is contained in:
Taras Machyshyn
2014-05-15 16:31:12 +03:00
committed by Yuri Kuznetsov
parent a8adbcf9cf
commit 5e149fdd05
4 changed files with 27 additions and 6 deletions
@@ -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());
}
}
+1 -3
View File
@@ -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();
}
+25
View File
@@ -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
*
+1 -1
View File
@@ -144,7 +144,7 @@ return array (
10 => 'cron',
),
'isInstalled' => true,
'cacheTimestamp' => 1399456816,
'cacheTimestamp' => 1400160414,
'testOption' => 'Another Wrong Value',
'testOption2' => 'Test2',
);