/var/www/(Del)hsihk.com/wp-content/plugins/backupbuddy/classes/api/_addSchedule.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
if ( ! is_numeric$first_run ) ) {
    
backupbuddy_api::$lastError 'Error #238983: First run time must be numeric.';
    return 
false;
}

if ( ! 
is_array$remote_destinations ) ) {
    
$remote_destinations = array();
}

if ( ! (bool) 
$delete_after ) {
    
$delete_after false;
}

if ( ! (bool) 
$enabled ) {
    
$enabled false;
}

if ( ! isset( 
pb_backupbuddy::$options['profiles'][ $profile ] ) ) {
    
backupbuddy_api::$lastError 'Error #378646: Invalid profile ID.';
    return 
false;
}



$schedule pb_backupbuddy::settings'schedule_defaults' );
$schedule['title'] = $title;
$schedule['profile'] = (int)$profile;
$schedule['interval'] = $interval;
$schedule['first_run'] = $first_run;
$schedule['remote_destinations'] = implode'|'$remote_destinations );
if ( 
true == $delete_after ) {
    
$schedule['delete_after'] = '1';
} else {
    
$schedule['delete_after'] = '0';
}
if ( 
false == $enabled ) {
    
$schedule['on_off'] = '0';
} else {
    
$schedule['on_off'] = '1';
}

$next_index pb_backupbuddy::$options['next_schedule_index']; // v2.1.3: $next_index = end( array_keys( pb_backupbuddy::$options['schedules'] ) ) + 1;
pb_backupbuddy::$options['next_schedule_index']++; // This change will be saved in savesettings function below.
pb_backupbuddy::$options['schedules'][$next_index] = $schedule;

$result backupbuddy_core::schedule_event$schedule['first_run'], $schedule['interval'], 'pb_backupbuddy-cron_scheduled_backup', array( $next_index ) );
if ( 
$result === false ) {
    return 
'Error scheduling event with WordPress. Your schedule may not work properly. Please try again. Error #3488439b. Check your BackupBuddy error log for details.';
} else {
    
pb_backupbuddy::save();
    return 
true;
}