Skip to content

Commit

Permalink
Fixed #2720
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 11, 2018
1 parent 53695af commit 4266f83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed a bug where the Clear Caches utility was not deleting template caches. ([#2720](https://github.com/craftcms/cms/issues/2720))

## 3.0.2 - 2018-04-10

### Added
Expand Down
18 changes: 9 additions & 9 deletions src/services/TemplateCaches.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,15 @@ public function deleteCachesByElementType(string $elementType): bool
return false;
}

$this->_deletedCachesByElementType[$elementType] = true;

$cacheIds = (new Query())
->select(['cacheId'])
->from([self::$_templateCacheQueriesTable])
->where(['type' => $elementType])
->column();

return $this->deleteCacheById($cacheIds);
$success = $this->deleteCacheById($cacheIds);
$this->_deletedCachesByElementType[$elementType] = true;
return $success;
}

/**
Expand Down Expand Up @@ -586,15 +586,15 @@ public function deleteExpiredCaches(): bool
return false;
}

$this->_deletedExpiredCaches = true;

$cacheIds = (new Query())
->select(['id'])
->from([self::$_templateCachesTable])
->where(['<=', 'expiryDate', Db::prepareDateForDb(new \DateTime())])
->column();

return $this->deleteCacheById($cacheIds);
$success = $this->deleteCacheById($cacheIds);
$this->_deletedExpiredCaches = true;
return $success;
}

/**
Expand Down Expand Up @@ -634,14 +634,14 @@ public function deleteAllCaches(): bool
return false;
}

$this->_deletedAllCaches = true;

$cacheIds = (new Query())
->select(['id'])
->from([self::$_templateCachesTable])
->column();

return $this->deleteCacheById($cacheIds);
$success = $this->deleteCacheById($cacheIds);
$this->_deletedAllCaches = true;
return $success;
}

// Private Methods
Expand Down

0 comments on commit 4266f83

Please # to comment.