PHP Classes

File: job_sample.php

Recommend this page to a friend!
  Classes of Alexander Selifonov   Periodic site maintenance   job_sample.php   Download  
File: job_sample.php
Role: Example script
Content type: text/plain
Description: using sample
Class: Periodic site maintenance
Perform several site maintenance tasks
Author: By
Last change: fix
Date: 13 years ago
Size: 1,448 bytes


Class file image Download
 @desc periodic job calling script, using as_nightjobs.php using example
 @author Alexander Selifonov <> <>
 last modified : 26.01.2009

# connect to MySQL db !
# Your MySQL host, login, password and database name.

$job = new CNightJobs('my demo site');

$job->SetEmailParameters(''); # where to send report

# $job->AddTableToShrink('user_activity_log,'event_date');
# here is some table that need to be cleaned from obsolete records
# multiple callable (if there's more than one table to shrink)

$tblist = array('depts','employees','salary','sales');
# all tables to manage (optimize and place to backup)

if(date('w')==0) {
# make backups once a week (on sunday) even if this script called daily
$job->SetBackupParameters('backups/', 5,null, 'mybckp-');
# data backups saved in backups folder, 5 days file rotation, bckp file named "mybckp-YYYY-MM-DD"

$job->SetUserFunction('MyJobs'); # MyJobs is a function with Your specific operations

# Root Document folder is '.',
# site 'size growth history' saved into table 'sitestats',
# my tariff plan space limit is 100 MB

$job->Exec(); # Let's Go !