Gavin B.
05-29-2005, 10:00 PM
This vB cron allows you to define a certain period of time for threads to be automatically locked.
Copy-paste the following into a new PHP file, and upload to ./includes/cron/YOURFILENAME.php
Enter the adminCP and go to scheduled tasks, click "add new scheduled task"
Setup when you want the script to run, and add the filename into the 'filename' field.
<?php
error_reporting(E_ALL & ~E_NOTICE);
// start editing
// forum ID's to monitor - put a comma between each one
DEFINE('FORUM_IDS', '15,59,14');
// time span to go back to.
// eg for months use; 6 MONTH or 9 MONTH
// years; 1 YEAR or 2 YEAR
// days; 5 DAY or 29 DAY
DEFINE('TIME_SPAN', '6 MONTH');
// stop editing here
if (!is_object($DB_site))
{
exit;
}
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET open=0 WHERE forumid IN(". FORUM_IDS .") AND FROM_UNIXTIME(dateline) < DATE_SUB(CURDATE(),INTERVAL ". TIME_SPAN .")");
log_cron_action('Old Threads Locked', $nextitem);
?>
Copy-paste the following into a new PHP file, and upload to ./includes/cron/YOURFILENAME.php
Enter the adminCP and go to scheduled tasks, click "add new scheduled task"
Setup when you want the script to run, and add the filename into the 'filename' field.
<?php
error_reporting(E_ALL & ~E_NOTICE);
// start editing
// forum ID's to monitor - put a comma between each one
DEFINE('FORUM_IDS', '15,59,14');
// time span to go back to.
// eg for months use; 6 MONTH or 9 MONTH
// years; 1 YEAR or 2 YEAR
// days; 5 DAY or 29 DAY
DEFINE('TIME_SPAN', '6 MONTH');
// stop editing here
if (!is_object($DB_site))
{
exit;
}
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET open=0 WHERE forumid IN(". FORUM_IDS .") AND FROM_UNIXTIME(dateline) < DATE_SUB(CURDATE(),INTERVAL ". TIME_SPAN .")");
log_cron_action('Old Threads Locked', $nextitem);
?>