Code: Select all
// another cron process altered the table between script start and UPDATE query so exit
if ($db->sql_affectedrows() != 1)
{
exit;
}
Code: Select all
$lock=time()-86400*30;
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."' where topic_last_post_time<".$lock;
$db->sql_query($sql);
Code: Select all
$lock=time()-300*1;
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."' where topic_last_post_time<".$lock;
$db->sql_query($sql);
I have used this cron job for a few months now, and it works perfectly.adiz wrote:Thank you very much!
If I would like to run it for test after 5 minutes, do I need to change the code to this -
Code: Select all
$lock=time()-300*1; $sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."' where topic_last_post_time<".$lock; $db->sql_query($sql);
Code: Select all
$lock=time()-86400*30;
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."' where topic_last_post_time<".$lock." AND forum_id IN (id1, id2, id3)";
$db->sql_query($sql);
Code: Select all
$move=time()-86400*37;
$sql="update ".TOPICS_TABLE." set forum_id='".id1."' where topic_last_post_time<".$move." AND forum_id IN (id1, id2, id3)";
$db->sql_query($sql);
Code: Select all
$lock=time()-86400*30;
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."' where topic_last_post_time<".$lock." AND forum_id IN (id1, id2, id3)";
$db->sql_query($sql);
Code: Select all
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."'
Code: Select all
$sql="update ".TOPICS_TABLE." set topic_status='".1."'
Code: Select all
$move=time()-86400*37;
$sql="update ".TOPICS_TABLE." set forum_id= 'new_id' where topic_last_post_time<".$move." AND forum_id IN (id1, id2, id3)";
$db->sql_query($sql);
Code: Select all
$lock=time()-86400*30;
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."' where topic_last_post_time<".$lock." AND forum_id IN (id1, id2, id3)";
$db->sql_query($sql);
Code: Select all
$sql="update ".TOPICS_TABLE." set topic_status='".ITEM_LOCKED."'
Code: Select all
$sql="update ".TOPICS_TABLE." set topic_status='".1."'
Code: Select all
$sql="update ".TOPICS_TABLE." set topic_status = '1'