Robust
Well-known member
Hey,
So I'm making a rebuilding task to rebuild quite a bit of data.
First, however, I need to reset data.
I have (sometimes multiple) columns in xf_post, xf_user and xf_thread.
If I'm rebuilding data of course I'm going to be generating new 'cached' data from the actual table with the data. So I'm going to need to reset the existing data in those 3 tables which is more 'quickhand' data.
The easiest way (and best way, probably) to do it would be if I could run a pre_execute task which is ran only once before the execute task is ran. Then I could just do:
Pretty generic and I'd imagine it'd be done relatively quickly. Then I can start rebuilding data and repopulating those fields of information for the data.
If I put this at the top of an execute, as far as I know, it'd be ran in every batch. So if an array is returned in a batch (not a boolean false) it would run the deferred task again until a false value is returned, I believe. So this query would keep getting re-ran and that's just pointless.
Sadly though, I don't think a pre execute function/ability exists. So what can I do to do this?
So I'm making a rebuilding task to rebuild quite a bit of data.
First, however, I need to reset data.
I have (sometimes multiple) columns in xf_post, xf_user and xf_thread.
If I'm rebuilding data of course I'm going to be generating new 'cached' data from the actual table with the data. So I'm going to need to reset the existing data in those 3 tables which is more 'quickhand' data.
The easiest way (and best way, probably) to do it would be if I could run a pre_execute task which is ran only once before the execute task is ran. Then I could just do:
Code:
$db->query('
UPDATE xf_post
SET field = 0
');
$db->query('
UPDATE xf_thread
SET field =0
');
$db->query('
UPDATE xf_user
SET field = 0
');
Pretty generic and I'd imagine it'd be done relatively quickly. Then I can start rebuilding data and repopulating those fields of information for the data.
If I put this at the top of an execute, as far as I know, it'd be ran in every batch. So if an array is returned in a batch (not a boolean false) it would run the deferred task again until a false value is returned, I believe. So this query would keep getting re-ran and that's just pointless.
Sadly though, I don't think a pre execute function/ability exists. So what can I do to do this?