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

Add an option to limit the number of files #14

Open
VincentMarmiesse opened this issue Nov 13, 2019 · 3 comments
Open

Add an option to limit the number of files #14

VincentMarmiesse opened this issue Nov 13, 2019 · 3 comments

Comments

@VincentMarmiesse
Copy link

Hi,

It would be nice to have an option to limit the number of files the command browses. I just runned it on a Magento with 5M+ files and the NFS server is running down.

Maybe something like php bin/magento cap:clean:media --limit=XXX.

@cap340
Copy link
Owner

cap340 commented Nov 14, 2019

Hi,
I'm facing same kind of issues, include the cache folder in iteration seems not to be the best solution...
I'm working on an update without the cache (we still can flush it after using Magento admin option) in which I will add your very good idea of ​​limit option.
Thanks a lot

@cap340
Copy link
Owner

cap340 commented Nov 20, 2019

Hi,
Could you test the dev branch version ?
there is 2 options in the command line :

  • --dry-run (if you want to perform a test without deleting anything)
  • --limit=XXX (as you suggested)

You could combine both options
php bin/magento cap:clean:media --dry-run --limit=10

The slowest part of the previous command was the double media folder iteration... I also removed the database cleaner part for now (explain in the README.md)

Thanks

@gerben86
Copy link

gerben86 commented Nov 1, 2023

Wouldn't it make more sense to check for each file in the database if it actual exists on the disk and then delete it?
In that case there's no need to do the media folder iteration.

  1. So iterate through the database results
    1.A Check for each file if it exists
    1.B If it exists delete it
  2. Clean database

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

3 participants