Hello,
today i found time to test the plugin.
I don't know what's wrong, but it won't work!
When the plugin is active, the cronjob (id 15 - daily clean up) didn't end correct.
Attachment 156708
Is the plugin inactive, evrything is fine with the cornjob:
Attachment 156709
This is the code i use fpr my testboard:
- forum-id = 4 => delete threads after 365 days
- forum-id = 10 => move threads with the prefix "Delete" after 100 days to forum-id = 12
- my User-ID = 1
- my Username = Chris
PHP Code:
global $vbulletin, $db;
require_once(DIR . '/includes/functions_databuild.php');
$deleted = false;
$curtime = TIMENOW;
$physicaldel = false;
$del_user = $fetch_userinfo(1);
$delinfo = array(
'userid' => $del_user['1'],
'username' => $del_user['Chris'],
'reason' => 'Thema alt entfernt via cron.',
'keepattachments' => false
);
$countposts = $vbulletin->forumcache[4]['options'] & $vbulletin->bf_misc_forumoptions['countposts'];
$query = "SELECT thread.* FROM " . TABLE_PREFIX . "thread AS thread WHERE lastpost <= " . $curtime - 365*86400 . " AND forumid = 4";
$threads_delete = $vbulletin->db->query_read($query);
$mthread =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
while ($thread_delete = $vbulletin->db->fetch_array($threads_delete))
{
if (!$deleted)
{
$deleted = true;
}
$mthread->set_existing($thread_delete);
$mthread->delete($countposts, $physicaldel, $delinfo, false);
}
unset($mthread);
if ($deleted)
{
build_forum_counters(4);
}
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "thread
SET forumid = 12
WHERE forumid = 10
AND lastpost <= " . $curtime - 100*86400 . "
AND prefixid = 'Delete'
");
build_forum_counters(10);
build_forum_counters(12);
kr Chris