CREATE TABLE wartung (
wartungs_id int(10) unsigned NOT NULL auto_increment,
wartungsdate datetime NOT NULL default '0000-00-00 00:00:00',
wartungsintervall int(10) NOT NULL,
aktiv tinyint(1) NOT NULL default '0',
logwartung tinyint(1) NOT NULL default '0',
wartungsfunkion varchar(250) NOT NULL,
beschreibung varchar(250) NOT NULL,
PRIMARY KEY (wartungs_id)
) ENGINE=MyISAM;
INSERT INTO wartung VALUES (1, '2011-07-16 13:03:25', 86400, 1, 1, 'cron/daywartung.php', 'Taegliche Wartung');
INSERT INTO wartung VALUES (2, '2011-07-15 21:59:29', 600, 1, 1, 'cron/emailinfo.php', 'E-Mailinfos senden');
INSERT INTO wartung VALUES (3, '2011-07-17 12:15:29', 7200, 1, 1, 'cron/statistik.php', 'Statistik update');
// Beispielcode
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// Wartungsaufgaben erledigen
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
function run_wartung() {
global $pfad;
$wartung = mysql_fetch_array("SELECT wartungs_id, wartungsdate, wartungsintervall, logwartung, wartungsfunkion
FROM wartung WHERE NOW() > wartungsdate
AND aktiv = 1
ORDER BY wartungsdate LIMIT 1");
$menge = mysql_num_rows($row);
if($menge == 1 && file_exists($pfad.'/'.$wartung['wartungsfunkion'])) {
include_once($pfad.'/'.$wartung['wartungsfunkion']);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //