Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

craft clear-caches/cp-resources erases my entire web/assets directory (yikes!) #3637

Closed
jaytavares opened this issue Jan 15, 2019 · 4 comments

Comments

@jaytavares
Copy link

jaytavares commented Jan 15, 2019

Description

I added craft clear-caches/all to my deploy script and discovered that all my site assets got wiped out. After some investigation, I discovered that the offending command is craft clear-caches/cp-resources. I can clear the Control Panel resources from the Utilities admin menu without issue; however, if I run the CLI command to clear the Control Panel resources, my web/assets folder is completely emptied.

Steps to reproduce

  1. Using a throw away copy of a craft site with the below versions...
  2. Review contents of web/assets directory - verify contents exist
  3. Run craft clear-caches/all or craft clear-caches/cp-resources
  4. Look at contents of web/assets directory - note that all contents are now gone

Additional info

  • Craft version: Craft Pro 3.1.0
  • PHP version: 7.0.2
  • Database driver & version: MySQL 5.7.10
  • Plugins & versions:

GeoMate - v1.0.2
Imager - v2.1.4 <-- all contents of my web/assets folder came from this plugin--could it be the cause?
Redactor - 2.1.7
Smart Map - 3.2.1
Videos - 2.0.4

@jaytavares jaytavares changed the title craft clear-caches/cp-resources erases my entire web/assets directory (!) craft clear-caches/cp-resources erases my entire web/assets directory (yikes!) Jan 15, 2019
@brandonkelly
Copy link
Member

Thanks for reporting this. Believe it's because your resourceBasePath config setting is set to something that begins with @webroot and Craft wasn’t sure how to resolve that for console requests.

@jaytavares
Copy link
Author

Thanks Brandon. I think you are right. I don't set my resourceBasePath anywhere in my code, but I do see that it seems to default to @webroot/cpresources in craftcms/cms/src/config/GeneralConfig.php.

@brandonkelly
Copy link
Member

Right, and Craft can be a little unpredictable when resolving @webroot for console requests. So as of the next release it will just not even try to clear CP resource files if that setting begins with @webroot.

@jaytavares
Copy link
Author

jaytavares commented Jan 17, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants