PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/upload/includes/cron/jobs/site_backup.php

http://torrentpier2.googlecode.com/
PHP | 33 lines | 25 code | 8 blank | 0 comment | 5 complexity | 60a554c03e1b7ee959957d9ddb90045e MD5 | raw file
 1<?php
 2
 3if (!defined('BB_ROOT')) die(basename(__FILE__));
 4
 5$exec_output = array();
 6$exec_return_status = 0;
 7
 8if ($bb_cfg['site_backup_shell_cmd'])
 9{
10	exec($bb_cfg['site_backup_shell_cmd'], $exec_output, $exec_return_status);
11	$cron_runtime_log = join(LOG_LF, $exec_output) . LOG_LF;
12}
13
14if ($exec_return_status && !$bb_cfg['emailer_disabled'] && $bb_cfg['tech_admin_email'])
15{
16	require_once(INC_DIR .'emailer.class.php');
17	$emailer = new emailer($bb_cfg['smtp_delivery']);
18
19	$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
20	$emailer->replyto($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
21
22	$emailer->use_template('blank');
23	$emailer->email_address($bb_cfg['tech_admin_email']);
24	$emailer->set_subject("Site Backup failed [{$bb_cfg['server_name']}]");
25
26	$emailer->assign_vars(array(
27		'MESSAGE' => $cron_runtime_log,
28	));
29	$emailer->send();
30	$emailer->reset();
31}
32
33sleep(10);