本文整理汇总了PHP中backupbuddy_core::add_backup_schedule方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::add_backup_schedule方法的具体用法?PHP backupbuddy_core::add_backup_schedule怎么用?PHP backupbuddy_core::add_backup_schedule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::add_backup_schedule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quickstart_form
function quickstart_form()
{
$errors = array();
$form = pb_backupbuddy::_POST();
//print_r( $form );
if ('' != $form['email'] && false !== stristr($form['email'], '@')) {
pb_backupbuddy::$options['email_notify_error'] = strip_tags($form['email']);
} else {
$errors[] = 'Invalid email address.';
}
if ('' != $form['password'] && $form['password'] == $form['password_confirm']) {
pb_backupbuddy::$options['importbuddy_pass_hash'] = md5($form['password']);
pb_backupbuddy::$options['importbuddy_pass_length'] = strlen($form['password']);
} elseif ('' == $form['password']) {
$errors[] = 'Please enter a password for restoring / migrating.';
} else {
$errors[] = 'Passwords do not match.';
}
if ('' != $form['schedule']) {
$destination_id = '';
if ('' != $form['destination_id']) {
// Dest id explicitly set.
$destination_id = $form['destination_id'];
} else {
// No explicit destination ID; deduce it.
if ('' != $form['destination']) {
foreach (pb_backupbuddy::$options['remote_destinations'] as $destination_index => $destination) {
// Loop through ending with the last created destination of this type.
if ($destination['type'] == $form['destination']) {
$destination_id = $destination_index;
}
}
}
}
function pb_backupbuddy_schedule_exist_by_title($title)
{
foreach (pb_backupbuddy::$options['schedules'] as $schedule) {
if ($schedule['title'] == $title) {
return true;
}
}
return false;
}
// STARTER
if ('starter' == $form['schedule']) {
$title = 'Weekly Database (Quick Setup - Starter)';
if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
$add_response = backupbuddy_core::add_backup_schedule($title, $profile = '1', $interval = 'weekly', $first_run = time() + get_option('gmt_offset') * 3600 + 86400, $remote_destinations = array($destination_id));
if (true !== $add_response) {
$errors[] = $add_response;
}
}
$title = 'Monthly Full (Quick Setup - Starter)';
if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
$add_response = backupbuddy_core::add_backup_schedule($title, $profile = '2', $interval = 'monthly', $first_run = time() + get_option('gmt_offset') * 3600 + 86400 + 18000, $remote_destinations = array($destination_id));
if (true !== $add_response) {
$errors[] = $add_response;
}
}
}
// BLOGGER
if ('blogger' == $form['schedule']) {
$title = 'Daily Database (Quick Setup - Blogger)';
if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
$add_response = backupbuddy_core::add_backup_schedule($title, $profile = '1', $interval = 'daily', $first_run = time() + get_option('gmt_offset') * 3600 + 86400, $remote_destinations = array($destination_id));
if (true !== $add_response) {
$errors[] = $add_response;
}
}
$title = 'Weekly Full (Quick Setup - Blogger)';
if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
$add_response = backupbuddy_core::add_backup_schedule($title, $profile = '2', $interval = 'weekly', $first_run = time() + get_option('gmt_offset') * 3600 + 86400 + 18000, $remote_destinations = array($destination_id));
if (true !== $add_response) {
$errors[] = $add_response;
}
}
}
}
// end set schedule.
if (0 == count($errors)) {
pb_backupbuddy::save();
die('Success.');
} else {
die(implode("\n", $errors));
}
}
示例2: trim
$error = true;
}
$remote_destinations = trim($submitted_schedule['data']['remote_destinations'], '|');
$remote_destinations = explode('|', $remote_destinations);
if ('1' == $submitted_schedule['data']['delete_after']) {
$delete_after = true;
} else {
$delete_after = false;
}
if ('1' == $submitted_schedule['data']['on_off']) {
$enabled = true;
} else {
$enabled = false;
}
if ($error === false) {
$add_response = backupbuddy_core::add_backup_schedule($title = $submitted_schedule['data']['title'], $profile = $submitted_schedule['data']['profile'], $interval = $submitted_schedule['data']['interval'], $first_run = pb_backupbuddy::$format->unlocalize_time(strtotime($submitted_schedule['data']['first_run'])), $remote_destinations, $delete_after, $enabled);
if (true !== $add_response) {
pb_backupbuddy::alert('Error scheduling: ' . $add_response);
} else {
// Success
pb_backupbuddy::save();
$schedule_form->clear_values();
pb_backupbuddy::alert('Added new schedule `' . htmlentities($submitted_schedule['data']['title']) . '`.');
}
}
} else {
// EDIT SCHEDULE. Form handles saving; just need to update timestamp.
$first_run = pb_backupbuddy::$format->unlocalize_time(strtotime($submitted_schedule['data']['first_run']));
if ($first_run == 0 || $first_run == 18000) {
pb_backupbuddy::alert(sprintf(__('Invalid time format. Please use the specified format / example %s', 'it-l10n-backupbuddy'), $date_format_example));
$error = true;