Exemplo n.º 1
0
 function process_dropbox_copy($destination_id, $file)
 {
     pb_backupbuddy::set_greedy_script_limits();
     require_once pb_backupbuddy::plugin_path() . '/lib/dropbuddy/dropbuddy.php';
     $dropbuddy = new pb_backupbuddy_dropbuddy(pb_backupbuddy::$options['remote_destinations'][$destination_id]['token']);
     if ($dropbuddy->authenticate() !== true) {
         if (!isset(pb_backupbuddy::$classes['core'])) {
             require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
             pb_backupbuddy::$classes['core'] = new pb_backupbuddy_core();
         }
         pb_backupbuddy::$classes['core']->mail_error('Dropbox authentication failed in cron_process_dropbox_copy.');
         return false;
     }
     $destination_file = ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $file;
     if (file_exists($destination_file)) {
         $destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
     }
     pb_backupbuddy::status('error', 'About to get object (the file) from Dropbox cron.');
     file_put_contents($destination_file, $dropbuddy->get_file($file));
     pb_backupbuddy::status('error', 'Got object from Dropbox cron.');
 }
Exemplo n.º 2
0
 function process_dropbox_copy($destination_id, $file)
 {
     pb_backupbuddy::set_greedy_script_limits();
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     require_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/dropbuddy.php';
     $dropbuddy = new pb_backupbuddy_dropbuddy(pb_backupbuddy::$options['remote_destinations'][$destination_id]['token']);
     if ($dropbuddy->authenticate() !== true) {
         if (!class_exists('backupbuddy_core')) {
             require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
         }
         backupbuddy_core::mail_error('Dropbox authentication failed in cron_process_dropbox_copy.');
         return false;
     }
     $destination_file = backupbuddy_core::getBackupDirectory() . basename($file);
     if (file_exists($destination_file)) {
         $destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
     }
     pb_backupbuddy::status('error', 'About to get file `' . $file . '` from Dropbox and save to `' . $destination_file . '`.');
     file_put_contents($destination_file, $dropbuddy->get_file($file));
     pb_backupbuddy::status('error', 'Got object from Dropbox cron.');
 }