laravel-medialibrary
laravel-medialibrary copied to clipboard
media-library:regenerate doesn't seem to respect --starting-from-id
media-library:regenerate doesn't seem to respect --starting-from-id
If I run artisan media-library:regenerate "App\Models\ApplicantDocument" --starting-from-id=1070 for example
It starts at ID 1 (showing 6 because I wasn't fast enough to take a screenshot).

The PHP gets killed at ID 1070 by something on the server, so I should be able to restart from where it was killed with --starting-from-id=1070 however it always seems to restart from 1.
I'd accept a PR that fixes this.
Hey @freekmurze, a question to be sure i understand correct. Is the problem here that the progress bar starts count from 1? because i can assure that —starting-from-id is respected by the command.
I'm convinced it isn't respecting that parameter here.
Having run it again over the weekend, it failed at 1070 again and no new media appeared on the disk.

That number is a progress bar count, not an id number https://github.com/spatie/laravel-medialibrary/blob/07a0cb4e629cdde6c3061b77ec2f8855db8bc2a1/src/Conversions/Commands/RegenerateCommand.php#L47 Also, it is tested https://github.com/spatie/laravel-medialibrary/blob/6a355b289f7f65033057ea154a551127f1c8ef87/tests/Conversions/Commands/RegenerateCommandTest.php#L234-L351 Your script stops because memory limit, max execution time, and others
But what about chunking? maybe it's better
The parameter —starting-from-id is indeed ment to use with an ID and not an index. The package will try to look and find the ID provided, or the first ID that's greater than the ID you provided.
Like Paola said it is indeed possible that you are running into some kind of resource limit. When working with large sets it is recommended to work with a queue.
As the paramter seems to be working as intended I will close this issue. However, if you can trace your problem back to a bug in the package, feel free to open a new issue, preferably with a failing test demostrating the bug.