Cms: Unable to clear Control Panel resources using ./craft clear-caches/all

Created on 5 Feb 2019  路  2Comments  路  Source: craftcms/cms

Description

I'm trying to use the ./craft clear-caches/all CLI command.

Everything is working fine, except that I always get this error:

Error clearing cache Control Panel resources: Unable to clear Control Panel resources because the location isn't known for console commands.

My configuration returns these values:

  • Craft::$app->getConfig()->getGeneral()->resourceBasePath -> @webroot/cpresources
  • Craft::getAlias('@webroot') -> return correct value (using /htdocs as root folder)

I tried on another Craft 3.1 website, and got the same error. So perhaps it is a bug.

Steps to reproduce

  1. Use the ./craft clear-caches/all command

Additional info

  • Craft version: 3.1.8
  • PHP version: 7.1.8
  • Database driver & version: PostgreSQL 9.6.9

Most helpful comment

As of the next release, the clear-caches console command will clear CP resources if the @webroot was custom-defined by the aliases config setting as well.

'aliases' => [
    '@webroot' => dirname(__DIR__) . '/web',
],

All 2 comments

That鈥檚 because @webroot is only reliable on web requests. To fix, update your resourceBasePath config setting to a real path:

'resourceBasePath' => dirname(__DIR__) . '/web/cpresources';

As of the next release, the clear-caches console command will clear CP resources if the @webroot was custom-defined by the aliases config setting as well.

'aliases' => [
    '@webroot' => dirname(__DIR__) . '/web',
],
Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelhue picture michaelhue  路  3Comments

leigeber picture leigeber  路  3Comments

RitterKnightCreative picture RitterKnightCreative  路  3Comments

richhayler picture richhayler  路  3Comments

lukebailey picture lukebailey  路  3Comments