예제 #1
0
}
$remotePath = 'wp-content/uploads/backupbuddy_temp/SERIAL/';
// Handle deletion.
if (pb_backupbuddy::_POST('bulk_action') == 'delete_backup') {
    pb_backupbuddy::verify_nonce();
    $deleteFiles = array();
    foreach ((array) pb_backupbuddy::_POST('items') as $file) {
        $file = base64_decode($file);
        if (FALSE !== strstr($file, '?')) {
            $file = substr($file, 0, strpos($file, '?'));
        }
        $deleteFiles[] = $file;
    }
    $deleteSettings = $settings;
    $deleteSettings['directory'] = $remotePath;
    $response = pb_backupbuddy_destination_live::deleteFiles($deleteSettings, $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 download link
if (pb_backupbuddy::_GET('downloadlink_file') != '') {
    $downloadSettings = $settings;
    $downloadSettings['directory'] = $remotePath;
    $link = pb_backupbuddy_destination_live::getFileURL($downloadSettings, base64_decode(pb_backupbuddy::_GET('downloadlink_file')));
    pb_backupbuddy::alert('You may download this backup (' . base64_decode(pb_backupbuddy::_GET('downloadlink_file')) . ') with <a href="' . $link . '">this link</a>. The link is valid for one hour.');
    echo '<br>';
예제 #2
0
 private static function _process_internal_delete_queue($destination_settings, &$deleteQueue, &$filesDeleted)
 {
     // Return true on empty queue.
     if (count($deleteQueue) <= 0) {
         return true;
     }
     pb_backupbuddy::status('details', 'Processing internal deletion queue on `' . count($deleteQueue) . '` files.');
     if (true !== ($delete_result = pb_backupbuddy_destination_live::deleteFiles($destination_settings, $deleteQueue))) {
         pb_backupbuddy::status('error', 'Error #8239833: Unable to delete remote file(s) `' . implode('; ', $deleteQueue) . '`');
         return false;
     } elseif (true === $delete_result) {
         // Remove each deleted file from catalog and update stats.
         foreach ($deleteQueue as $signatureFile) {
             // Remove file from catalog and update state stats. IMPORTANT: DO NOT SAVE CATALOG UNTIL QUEUE PROCESSED.
             unset(self::$_catalog[$signatureFile]);
         }
         // Calculate some local stats on what just happened for log.
         $deleted_count = count($deleteQueue);
         $remaining = self::$_state['stats']['files_pending_delete'] - $deleted_count;
         if ($remaining < 0) {
             $remaining = 0;
         }
         $last_deleted = end($deleteQueue);
         // Move array pointer to end of queue.
         // Update state stats.
         self::$_state['stats']['files_pending_delete'] = self::$_state['stats']['files_pending_delete'] - $deleted_count;
         if (self::$_state['stats']['files_pending_delete'] < 0) {
             self::$_state['stats']['files_pending_delete'] = 0;
         }
         // Clear $deleteQueue reference.
         $deleteQueue = array();
         // Clear out queue.
         // Update $filesDeleted reference.
         $filesDeleted += $deleted_count;
         pb_backupbuddy::status('details', 'Deleted `' . $deleted_count . '` remote files (' . $remaining . ' remain). Last file deleted in current queue: `' . $last_deleted . '`.');
         return true;
     }
 }