fix core manager

This commit is contained in:
Nicolas Le Goff
2012-02-17 19:11:23 +01:00
parent 76d0cf41a0
commit 2347d06793
2 changed files with 11 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ class Manager
public function hasChange($name, $driver)
{
return $this->exists($name) ?
$this->registry[$name] === $driver : false;
$this->registry[$name] !== $driver : true;
}
public function save($name, $driver)

View File

@@ -190,15 +190,21 @@ class Core extends \Pimple
{
return function($cacheKey, $service)
{
$driverType = $service->getType();
$driver = $service->getService();
if(!file_exists(__DIR__ . '/../../../tmp/cache_registry.yml'))
{
touch(__DIR__ . '/../../../tmp/cache_registry.yml');
}
$file = new \SplFileObject(__DIR__ . '/../../../tmp/cache_registry.yml');
$parser = new Core\Configuration\Parser\Yaml();
$cacheManager = new \Alchemy\Phrasea\Cache\Manager($file, $parser);
$driverType = $service->getType();
$driver = $service->getService();
if (!$cacheManager->hasChange($cacheKey, $driverType))
if ($cacheManager->hasChange($cacheKey, $driverType))
{
$driver->deleteAll();
$cacheManager->save($cacheKey, $driverType);