craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

clear-caches/all deletes not cache-related files #3710

Closed Saboteur777 closed 5 years ago

Saboteur777 commented 5 years ago

Description

When craft clear-caches/all is run, files not related to cache are deleted. Example:

saboteur@Luke:~/www/webmenedzserhu_craft$ git status 
On branch staging
Your branch is up to date with 'origin/staging'.

nothing to commit, working tree clean
saboteur@Luke:~/www/webmenedzserhu_craft$ docker exec webmenedzserhu_craft_web php craft clear-caches/all
Clearing cache: Data caches
Clearing cache: Asset caches
Clearing cache: Compiled templates
Clearing cache: Control Panel resources
Clearing cache: Temp files
Clearing cache: Asset transform index
Clearing cache: Asset indexing data
Clearing cache: Template caches
Clearing cache: SEOmatic frontend template caches
Clearing cache: SEOmatic metadata caches
Clearing cache: SEOmatic sitemap caches
Clearing cache: Imager image transform cache
Clearing cache: Imager remote images cache
saboteur@Luke:~/www/webmenedzserhu_craft$ git status 
On branch staging
Your branch is up to date with 'origin/staging'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    web/assets/dist/css/fonts.min.css
        deleted:    web/assets/dist/css/main.min.css
        deleted:    web/assets/dist/favicons/android-chrome-192x192.png
        deleted:    web/assets/dist/favicons/android-chrome-512x512.png
        deleted:    web/assets/dist/favicons/apple-touch-icon.png
        deleted:    web/assets/dist/favicons/browserconfig.xml
        deleted:    web/assets/dist/favicons/favicon-16x16.png
        deleted:    web/assets/dist/favicons/favicon-32x32.png
        deleted:    web/assets/dist/favicons/favicon.ico
        deleted:    web/assets/dist/favicons/manifest.json
        deleted:    web/assets/dist/favicons/mstile-150x150.png
        deleted:    web/assets/dist/favicons/safari-pinned-tab.svg
        deleted:    web/assets/dist/fonts/FontAwesome.otf
        deleted:    web/assets/dist/fonts/Simple-Line-Icons.eot
        deleted:    web/assets/dist/fonts/Simple-Line-Icons.svg
        deleted:    web/assets/dist/fonts/Simple-Line-Icons.ttf
        deleted:    web/assets/dist/fonts/Simple-Line-Icons.woff
        deleted:    web/assets/dist/fonts/Simple-Line-Icons.woff2
        deleted:    web/assets/dist/fonts/fontawesome-webfont.eot
        deleted:    web/assets/dist/fonts/fontawesome-webfont.svg
        deleted:    web/assets/dist/fonts/fontawesome-webfont.ttf
        deleted:    web/assets/dist/fonts/fontawesome-webfont.woff
        deleted:    web/assets/dist/fonts/fontawesome-webfont.woff2
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-italic.eot
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-italic.svg
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-italic.ttf
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-italic.woff
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-italic.woff2
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-light.eot
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-light.svg
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-light.ttf
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-light.woff
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-light.woff2
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-regular.eot
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-regular.svg
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-regular.ttf
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-regular.woff
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-regular.woff2
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-semibold.eot
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-semibold.svg
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-semibold.ttf
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-semibold.woff
        deleted:    web/assets/dist/fonts/hinted-subset-raleway-semibold.woff2
        deleted:    web/assets/dist/fonts/slick.eot
        deleted:    web/assets/dist/fonts/slick.svg
        deleted:    web/assets/dist/fonts/slick.ttf
        deleted:    web/assets/dist/fonts/slick.woff
        deleted:    web/assets/dist/images/ajax-loader.gif
        deleted:    web/assets/dist/images/check.svg
        deleted:    web/assets/dist/images/cookie.svg
        deleted:    web/assets/dist/images/header_bg.jpg
        deleted:    web/assets/dist/images/header_bg_small.jpg
        deleted:    web/assets/dist/images/laptop.svg
        deleted:    web/assets/dist/images/loader.svg
        deleted:    web/assets/dist/images/map.svg
        deleted:    web/assets/dist/images/portfolio_bg.jpg
        deleted:    web/assets/dist/images/portfolio_bg_small.jpg
        deleted:    web/assets/dist/images/rocket.svg
        deleted:    web/assets/dist/images/webmngr-logo-gradient.svg
        deleted:    web/assets/dist/images/webmngr-logo.svg
        deleted:    web/assets/dist/js/early.js
        deleted:    web/assets/dist/js/highlight.js
        deleted:    web/assets/dist/js/init.js
        deleted:    web/assets/dist/js/scripts.js

no changes added to commit (use "git add" and/or "git commit -a")

Steps to reproduce

  1. Place a custom file in web/assets/dist folder
  2. Run clear-caches/all
  3. Check if the file exists there

Additional info

brandonkelly commented 5 years ago

That command is a CLI version of the Clear Caches utility in the Control Panel. It will delete all the same things as that.

Saboteur777 commented 5 years ago

Then the bug is in the Clear Caches utility: those files should not be deleted, as they are placed there by my build pipeline.

brandonkelly commented 5 years ago

Sorry, I see which files you’re referring to. This is a duplicate of #3637, which was fixed in Craft 3.1.1.

Saboteur777 commented 5 years ago

Ok, thanks, glad you are aware of it. :slightly_smiling_face: