I'm just about done a plugin, but I want it to rebuild/recount the stats for posts/threads/views and such. Is it possible to do this in a plugin automatically?
To correct an old one, because i know of some recount plugins. Labrocca has one.
You can force your plugin to run the recounts. A lot of plugins do so.
Sorry, I'm not at home and don't have my notes in front of me on doing it though.
(2009-10-31, 12:40 AM)ralgith Wrote: [ -> ]You can force your plugin to run the recounts. A lot of plugins do so.
Sorry, I'm not at home and don't have my notes in front of me on doing it though.
Are you sure? I haven't seen any plugins doing it and as far as I remember, it's not possible by calling a function. I might be wrong though
Doesn't labrocca have recount plugins?
(2009-10-31, 10:24 PM)T0m Wrote: [ -> ]Doesn't labrocca have recount plugins?
I thought so, and thats what I was talking about when I said it. But I could be misremembering.
I know you can rebuild settings by calling rebuild_settings(), but now I'm not so sure about the recount.
Ok, on further looking you need to:
require_once(MYBB_ROOT."admin/modules/tools/recount_rebuild.php
Then to rebuild/recount you run one of these:
acp_recount_user_posts()
acp_rebuild_attachment_thumbnails()
acp_rebuild_forum_counters()
acp_rebuild_thread_counters()
Good luck. And no, I'm NOT 100% sure these are safe to call directly, but it looks like they are.
(2009-10-31, 11:32 PM)ralgith Wrote: [ -> ]Ok, on further looking you need to:
require_once(MYBB_ROOT."admin/modules/tools/recount_rebuild.php
Then to rebuild/recount you run one of these:
acp_recount_user_posts()
acp_rebuild_attachment_thumbnails()
acp_rebuild_forum_counters()
acp_rebuild_thread_counters()
Good luck. And no, I'm NOT 100% sure these are safe to call directly, but it looks like they are.
By requiring that file, it will output the page data as well.. So you either copy/paste the functions into your plugin or you do it from scratch.