Topic: Cron Job Newbie (using Hsphere)
I'm hoping to have older posts permanently deleted so as not to bloat the DB. Having read a few other posts would this be the correct way?
1. (server uses Hsphere) http://www.woria.com/cron/addtab/
setup cron tab in Hsphere that points to cron_maintenance.php
Do I keep cron_maintenance.php in tools folder and point to it or does cron_maintenance.php need to be moved to server root or jobberbase root?
2. cron_maintenance.php should look like this to delete jobs older than 50 days:
<?php
require_once 'config.php';
require_once '_includes/class.Maintenance.php';
$janitor = new Maintenance();
// delete temporary posts older than 1 day
$janitor->DeleteTemporaryJobs();
$janitor->DeactivateOldJobs();
?>
and class.Maintenance.php would look like this:
class Maintenance
{
function __construct()
{ }
// delete temporary posts older than 1 days
public function DeleteTemporaryJobs()
{
global $db;
$sql = 'DELETE FROM jobs WHERE DATEDIFF(NOW(), created_on) > 0 AND is_temp = 1 AND is_active = 0';
$db->Execute($sql);
}
public function DeactivateOldJobs()
{
global $db;
$sql = 'DELETE FROM jobs WHERE DATEDIFF(NOW(), created_on) > 50';
$db->Execute($sql);
}
?>
would this be correct?
How do you know if it works? would the cron job email reveal that?