Skip to content

Commit

Permalink
Improved the clear-caches/cp-resources error
Browse files Browse the repository at this point in the history
Resolves #7286
  • Loading branch information
brandonkelly committed Dec 22, 2020
1 parent 9f390f7 commit 5dbcd71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes for Craft CMS 3.x

### Changed
- Improved the error message that is output when running the `clear-caches/cp-resources` command, if the `@webroot` alias isn’t explicitly set. ([#7286](https://github.com/craftcms/cms/issues/7286))

## 3.5.17.1 - 2020-12-17

### Fixed
Expand Down
4 changes: 3 additions & 1 deletion src/utilities/ClearCaches.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ public static function cacheOptions(): array
$request->isWebrootAliasSetDynamically &&
strpos($basePath, '@webroot') === 0
) {
throw new \Exception('Unable to clear control panel resources because the location isn\'t known for console commands.');
throw new \Exception("Unable to clear control panel resources because the location isn't known for console commands.\n" .
"Explicitly set the @webroot alias in config/general.php to avoid this error.\n" .
'See https://craftcms.com/docs/3.x/config/#aliases for more info.');
}

FileHelper::clearDirectory(Craft::getAlias($basePath), [
Expand Down

0 comments on commit 5dbcd71

Please sign in to comment.