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: 15 years ago
Size: 1,448 bytes
 

Contents

Class file image Download
<?php
/**
 @desc periodic job calling script, using as_nightjobs.php using example
 @author Alexander Selifonov <[email protected]> <[email protected]>
 @link http://www.selifan.ru
 last modified : 26.01.2009
**/
require_once(as_dbutils.php');
require_once(as_nightjobs.php'
);

# connect to MySQL db !
$as_dbengine->Connect('localhost','user','password','mydb');
# Your MySQL host, login, password and database name.

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

$job->SetEmailParameters('[email protected]'); # 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');
$job->SetTablesList($tblist);
# 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

$job->SiteSizeParameters('.','sitestats',100);
# 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 !

?>