Flush cache on update

This commit is contained in:
Dmitriy Simushev 2014-11-17 14:30:15 +00:00
parent 07b25a2fc3
commit d68b0bdb0c
2 changed files with 22 additions and 1 deletions

View File

@ -94,7 +94,7 @@ class UpdateController extends AbstractController
protected function getUpdater() protected function getUpdater()
{ {
if (is_null($this->updater)) { if (is_null($this->updater)) {
$this->updater = new Updater(); $this->updater = new Updater($this->getCache());
} }
return $this->updater; return $this->updater;

View File

@ -20,6 +20,7 @@
namespace Mibew\Maintenance; namespace Mibew\Maintenance;
use Mibew\Database; use Mibew\Database;
use Stash\Interfaces\PoolInterface;
/** /**
* Encapsulates update process. * Encapsulates update process.
@ -52,6 +53,23 @@ class Updater
*/ */
protected $log = array(); protected $log = array();
/**
* An instance of cache pool.
*
* @var PoolInterface|null
*/
protected $cache = null;
/**
* Class constructor.
*
* @param PoolInterface $cache An instance of cache pool.
*/
public function __construct(PoolInterface $cache)
{
$this->cache = $cache;
}
/** /**
* Retuns list of all errors that took place during update process. * Retuns list of all errors that took place during update process.
* *
@ -153,6 +171,9 @@ class Updater
return false; return false;
} }
// Clean up the cache
$this->cache->flush();
return true; return true;
} }