XF 2.0 "Rebuild attachment thumbnails" using cli

karnaf

Member
I want to rebuild the attachments but because I have many the browser tool dies with a timeout.
How do run the same thing using the cli without a timeout to make sure it finishes correctly?
 
Realistically that shouldn't happen.

We run it in batches of 100, but the batch can only take a maximum of 8 seconds (by default).

What timeout is it hitting? Maximum execution time in PHP? If so, what is that set at? It usually defaults to 30 seconds. You might want to consider raising it to 60.

There's no way currently to run this one via the CLI.
 
Should be fine as long as the maximum execution time is reasonable. 10 seconds is rather unusual as it defaults to 30. I think you'll be ok with 60.
 
Change it to the default of 90 seconds.

Also you need to make sure it's actually changing. Verify by doing this:

From the Admin control panel click the PHP version link:

Then check the max_execution_time setting. The local value is the important one.
 
As Chris D already pointed out, it normally should not be a problem to rebuild thumbs via browser.

Though, rebuilding a large amount (say serveral 10 or 100K) thumbnails via browser is painfully sloooow as there is a significant overhead for strating each (tiny) batch.

Those who want and can use CLI might want to try the attached Add-on.

The commands als xf-rebuild:kirby-xfmg-album-thumbnails and xf-rebuild:kirby-xfmg-media-thumbnails.
Keep in mind that the command must be executed as the same user that runs XF via webserver (if you are using the default filesystem adapter, might be less important if using other adapters).
(To be 100% precise, it might be possible to use another user but those wo have setup ACLs will know that they are doing ;))

This is a really simple Add-on and I don't think there is anything that could significantly go wrong, but anyway:
No guarantees whatsoever, use at your own risk and take a backup!
 

Attachments

Last edited:
As Chris D already pointed out, it normally should not be a problem to rebuild thumbs via browser.

Though, rebuilding a large amount (say serveral 10 or 100K) thumbnails via browser is painfully sloooow as there is a significant overhead for strating each (tiny) batch.

Those who want and can use CLI might want to try the attached Add-on.

The commands als xf-rebuild:kirby-xfmg-album-thumbnails and xf-rebuild:kirby-xfmg-media-thumbnails.
Keep in mind that the command must be executed as the same user that runs XF via webserver (if you are using the default filesystem adapter, might be less important if using other adapters).
(To be 100% precise, it might be possible to use another user but those wo have setup ACLs will know that they are doing ;))

This is a really simple Add-on and I don't think there is anything that could significantly go wrong, but anyway:
No guarantees whatsoever, use at your own risk and take a backup!
Hi Kirby,

Is it compatible with XF 2.3?
 
Back
Top Bottom