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
54
55
56
57
58
59
|
<?php if ( '' == $backupMode ) { $backupMode = pb_backupbuddy::$options['backup_mode']; // Use user-defined setting. } if ( ! isset( $triggerTitle ) || ( '' == $triggerTitle ) ) { $triggerTitle = 'manual'; }
if ( is_array( $generic_type_or_profile_id_or_array ) ) { // is a profile array $profileArray = $generic_type_or_profile_id_or_array; } else { $profile = $generic_type_or_profile_id_or_array; if ( 'db' == $profile ) { // db profile is always index 1. $profile = '1'; } elseif ( 'full' == $profile ) { // full profile is always index 2. $profile = '2'; }
if ( is_numeric( $profile ) ) { if ( isset( pb_backupbuddy::$options['profiles'][ $profile ] ) ) { $profileArray = pb_backupbuddy::$options['profiles'][ $profile ]; } else { return 'Error #2332904: Invalid profile ID `' . htmlentities( $profile ) . '`. Profile with this number was not found. Try deactivating then reactivating the plugin. If this fails please reset the plugin Settings back to Defaults from the Settings page.'; } } else { return 'Error #85489548955. Invalid profile ID not numeric: `' . htmlentities( $profile ) . '`.'; } }
if ( '' == $triggerTitle ) { $triggerTitle = 'BB API'; }
$profileArray['backup_mode'] = $backupMode; // Force modern mode when running under API. 1=classic (single page load), 2=modern (cron)
if ( '' == $backupSerial ) { $backupSerial = pb_backupbuddy::random_string( 10 ); }
require_once( pb_backupbuddy::plugin_path() . '/classes/backup.php' ); pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
// Run the backup! if ( pb_backupbuddy::$classes['backup']->start_backup_process( $profileArray, // Profile array. 'manual', // Backup trigger. manual, scheduled array(), // pre-backup array of steps. array(), // post-backup array of steps. $triggerTitle, // friendly title of schedule that ran this (if applicable). $backupSerial, // if passed then this serial is used for the backup insteasd of generating one. array() // Multisite export only: array of plugins to export. ) !== true ) { return 'Error #435832: Backup failed. See BackupBuddy log for details.'; }
return true;
|