if (isset(pb_backupbuddy::$options['remote_destinations'][pb_backupbuddy::_GET('destination_id')])) { $destinationID = pb_backupbuddy::_GET('destination_id'); if (!isset(pb_backupbuddy::$options['remote_destinations'][$destinationID])) { die('Error #9828332: Destination not found.'); } $settings =& pb_backupbuddy::$options['remote_destinations'][$destinationID]; $settings = pb_backupbuddy_destination_s32::_formatSettings($settings); } // Handle deletion. if (pb_backupbuddy::_POST('bulk_action') == 'delete_backup') { pb_backupbuddy::verify_nonce(); $deleteFiles = array(); foreach ((array) pb_backupbuddy::_POST('items') as $item) { $deleteFiles[] = $item; } $response = pb_backupbuddy_destination_s32::deleteFiles($settings, $deleteFiles); if (true === $response) { pb_backupbuddy::alert('Deleted ' . implode(', ', $deleteFiles) . '.'); } else { pb_backupbuddy::alert('Failed to delete one or more files. Details: `' . $response . '`.'); } echo '<br>'; } // end deletion. // Handle copying files to local if (pb_backupbuddy::_GET('cpy_file') != '') { pb_backupbuddy::alert('The remote file is now being copied to your local backups. If the backup gets marked as bad during copying, please wait a bit then click the `Refresh` icon to rescan after the transfer is complete.'); echo '<br>'; pb_backupbuddy::status('details', 'Scheduling Cron for creating S3 copy.'); backupbuddy_core::schedule_single_event(time(), 'process_remote_copy', array('s32', pb_backupbuddy::_GET('cpy_file'), $settings)); spawn_cron(time() + 150);
public static function deleteFiles($settings, $files = array()) { $settings = self::_init($settings); if (!is_array($files)) { $file = array($files); } $remote_path = self::get_remote_path(); // Has leading and trailng slashes. $additionalParams = array(); $manage_data = self::stashAPI($settings, 'manage', $additionalParams); if (!is_array($manage_data)) { $error = 'Error #47349723: Unable to initiate file deletion for file(s) `' . implode(', ', $files) . '`. Details: `' . $manage_data . '`.'; self::_error($error); return $error; } $settings['bucket'] = $manage_data['bucket']; $settings['credentials'] = $manage_data['credentials']; foreach ($files as &$file) { $file = $manage_data['subkey'] . $remote_path . $file; } print_r($files); return pb_backupbuddy_destination_s32::deleteFiles($settings, $files); }
public static function deleteFiles($settings, $files) { $settings = self::_formatSettings($settings); $remote_path = self::get_remote_path(); // Has leading and trailng slashes. $additionalParams = array(); $manage_data = self::stashAPI($settings, 'manage', $additionalParams); $settings['bucket'] = $manage_data['bucket']; $settings['credentials'] = $manage_data['credentials']; foreach ($files as &$file) { $file = $manage_data['subkey'] . $remote_path . $file; } echo '<br>Delete: ' . $file . '<br>'; print_r($files); return pb_backupbuddy_destination_s32::deleteFiles($settings, $files); }