Skip to content

Commit

Permalink
When files were changed, the cache was storing each copy instead of o…
Browse files Browse the repository at this point in the history
…verwritting (ref #530)
  • Loading branch information
gsherwood committed May 19, 2015
1 parent f71345d commit 9b2cb43
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/Files/LocalFile.php
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ function reloadContent()


/**
*
*
*
* @return void
*/
@@ -92,9 +92,9 @@ public function process()
return parent::process();
}

$hash = $this->path.'.'.md5_file($this->path);
$cache = Cache::get($hash);
if ($cache !== false) {
$hash = md5_file($this->path);
$cache = Cache::get($this->path);
if ($cache !== false && $cache['hash'] === $hash) {
// We can't filter metrics, so just load all of them.
$this->metrics = $cache['metrics'];

@@ -120,15 +120,16 @@ public function process()
parent::process();

$cache = array(
'errors' => $this->errors,
'warnings' => $this->warnings,
'metrics' => $this->metrics,
'hash' => $hash,
'errors' => $this->errors,
'warnings' => $this->warnings,
'metrics' => $this->metrics,
'errorCount' => $this->errorCount,
'warningCount' => $this->warningCount,
'fixableCount' => $this->fixableCount,
'fixableCount' => $this->fixableCount,
);

Cache::set($hash, $cache);
Cache::set($this->path, $cache);

// During caching, we don't filter out errors in any way, so
// we need to do that manually now by replaying them.
@@ -141,9 +142,9 @@ public function process()

private function replayErrors($errors, $warnings)
{
$this->errors = array();
$this->warnigns = array();
$this->errorCount = 0;
$this->errors = array();
$this->warnigns = array();
$this->errorCount = 0;
$this->warningCount = 0;
$this->fixableCount = 0;

0 comments on commit 9b2cb43

Please sign in to comment.