Exemple #1
0
            echo ' ' . __('To jump right in using the defaults just hit "Add Destination" below.', 'it-l10n-backupbuddy');
        } else {
            echo '<div style="text-align: center;">' . $account_details . '</div>';
        }
        if ($mode == 'add') {
            // Check to see if user already has a Stash with this username set up for this site. No need for multiple same account Stashes.
            foreach ((array) pb_backupbuddy::$options['remote_destinations'] as $destination) {
                if (isset($destination['itxapi_username']) && strtolower($destination['itxapi_username']) == strtolower($itxapi_username)) {
                    echo '<br><br>';
                    pb_backupbuddy::alert('Note: You already have a Stash destination set up under the provided iThemes account username.  It is unnecessary to create multiple Stash destinations that go to the same user account as they are effectively the same destination and a duplicate.');
                    break;
                }
            }
        }
        echo '<br><br>';
        echo pb_backupbuddy_destination_stash::get_quota_bar($account_info);
        echo '<div style="text-align: center;">';
        echo '
		<b>Upgrade to more space:</b> &nbsp;
		<a href="http://ithemes.com/member/cart.php?action=add&id=290" target="_blank" style="text-decoration: none; font-weight: 300;">+ 5GB</a>, &nbsp;
		<a href="http://ithemes.com/member/cart.php?action=add&id=290" target="_blank" style="text-decoration: none; font-weight: 600; font-size: 1.1em;">+ 10GB</a>, &nbsp;
		<a href="http://ithemes.com/member/cart.php?action=add&id=290" target="_blank" style="text-decoration: none; font-weight: 800; font-size: 1.2em;">+ 25GB</a>
		&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
		<a href="http://ithemes.com/member/panel/stash.php" target="_blank" style="text-decoration: none;"><b>Manage Files & Account</b></a>
		';
        echo '<br><br></div>';
        echo '<!-- STASH DETAILS: ' . print_r($account_info, true) . ' -->';
    }
    // end if NOT in save mode.
    // Form settings.
    $settings_form->add_setting(array('type' => 'text', 'name' => 'title', 'title' => __('Destination name', 'it-l10n-backupbuddy'), 'tip' => __('Name of the new destination to create. This is for your convenience only.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]', 'default' => $default_name));
 public static function test($settings)
 {
     $remote_path = self::get_remote_path($settings['directory']);
     // Has leading and trailng slashes.
     $manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
     if (!is_array($manage_data['credentials'])) {
         // Credentials were somehow faulty. User changed password after prior page? Unlikely but you never know...
         $error_msg = 'Error #8484383c: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?';
         pb_backupbuddy::status('error', $error_msg);
         return $error_msg;
     }
     // Try sending a file.
     $send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
     // 3rd param true forces clearing of any current uploads.
     if (false === $send_response) {
         $send_response = 'Error sending test file to Stash.';
     } else {
         $send_response = 'Success.';
     }
     // S3 object for managing files.
     $credentials = pb_backupbuddy_destination_stash::get_manage_data($settings);
     $s3_manage = new AmazonS3($manage_data['credentials']);
     if ($settings['ssl'] == 0) {
         @$s3_manage->disable_ssl(true);
     }
     // Delete sent file.
     $delete_response = 'Success.';
     $delete_response = $s3_manage->delete_object($manage_data['bucket'], $manage_data['subkey'] . $remote_path . 'remote-send-test.php');
     if (!$delete_response->isOK()) {
         $delete_response = 'Unable to delete test Stash file `remote-send-test.php`. Details: `' . print_r($response, true) . '`.';
         pb_backupbuddy::status('details', $delete_response);
     } else {
         $delete_response = 'Success.';
     }
     // Load destination fileoptions.
     pb_backupbuddy::status('details', 'About to load fileoptions data.');
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
     $fileoptions =& $fileoptions_obj->options;
     if ('Success.' != $send_response || 'Success.' != $delete_response) {
         $fileoptions['status'] = 'failure';
         $fileoptions_obj->save();
         unset($fileoptions_obj);
         return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
     } else {
         $fileoptions['status'] = 'success';
         $fileoptions['finish_time'] = time();
     }
     $fileoptions_obj->save();
     unset($fileoptions_obj);
     return true;
 }
Exemple #3
0
 public function remote_send()
 {
     if (defined('PB_DEMO_MODE')) {
         die('Access denied in demo mode.');
     }
     $success_output = false;
     // Set to true onece a leading 1 has been sent to the javascript to indicate success.
     $destination_id = pb_backupbuddy::_POST('destination_id');
     if (pb_backupbuddy::_POST('file') != 'importbuddy.php') {
         $backup_file = pb_backupbuddy::$options['backup_directory'] . pb_backupbuddy::_POST('file');
     } else {
         $backup_file = '';
     }
     if (pb_backupbuddy::_POST('send_importbuddy') == '1') {
         $send_importbuddy = true;
         pb_backupbuddy::status('details', 'Cron send to be scheduled with importbuddy sending.');
     } else {
         $send_importbuddy = false;
         pb_backupbuddy::status('details', 'Cron send to be scheduled WITHOUT importbuddy sending.');
     }
     // For Stash we will check the quota prior to initiating send.
     if (pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash') {
         // Pass off to destination handler.
         require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
         $send_result = pb_backupbuddy_destinations::get_info('stash');
         // Used to kick the Stash destination into life.
         $stash_quota = pb_backupbuddy_destination_stash::get_quota(pb_backupbuddy::$options['remote_destinations'][$destination_id], true);
         //print_r( $stash_quota );
         if ($backup_file != '') {
             $backup_file_size = filesize($backup_file);
         } else {
             $backip_file_size = 50000;
         }
         if ($backup_file_size + $stash_quota['quota_used'] > $stash_quota['quota_total']) {
             echo "You do not have enough Stash storage space to send this file. Please upgrade your Stash storage or delete files to make space.\n\n";
             echo 'Attempting to send file of size ' . pb_backupbuddy::$format->file_size($backup_file_size) . ' but you only have ' . $stash_quota['quota_available_nice'] . ' available. ';
             echo 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
             die;
         } else {
             if (isset($stash_quota['quota_warning']) && $stash_quota['quota_warning'] != '') {
                 echo '1Warning: ' . $stash_quota['quota_warning'] . "\n\n";
                 $success_output = true;
             }
         }
     }
     wp_schedule_single_event(time(), pb_backupbuddy::cron_tag('remote_send'), array($destination_id, $backup_file, pb_backupbuddy::_POST('trigger'), $send_importbuddy));
     spawn_cron(time() + 150);
     // Adds > 60 seconds to get around once per minute cron running limit.
     update_option('_transient_doing_cron', 0);
     // Prevent cron-blocking for next item.
     // SEE cron.php remote_send() for sending function that we pass to via the cron above.
     if ($success_output === false) {
         echo 1;
     }
     die;
 }
Exemple #4
0
 public static function test($settings)
 {
     $remote_path = self::get_remote_path($settings['directory']);
     // Has leading and trailng slashes.
     // Try sending a file.
     $test_result = self::send($settings, dirname(__FILE__) . '/icon.png', true);
     // 3rd param true forces clearing of any current uploads.
     // S3 object for managing files.
     $manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
     $s3_manage = new AmazonS3($manage_data['credentials']);
     if ($settings['ssl'] == 0) {
         @$s3_manage->disable_ssl(true);
     }
     // Delete sent file.
     $response = $s3_manage->delete_object($manage_data['bucket'], $manage_data['subkey'] . $remote_path . 'icon.png');
     if (!$response->isOK()) {
         pb_backupbuddy::status('details', 'Unable to delete test Stash file `' . $buname . '`. Details: `' . print_r($response, true) . '`.');
     }
     delete_transient('pb_backupbuddy_stashquota_' . $settings['itxapi_username']);
     // Delete quota transient since it probably has changed now.
     return $test_result;
 }
Exemple #5
0
 public static function send_remote_destination($destination_id, $file, $trigger = '', $send_importbuddy = false, $delete_after = false, $identifier = '', $destination_settings = '')
 {
     if (defined('PB_DEMO_MODE')) {
         return false;
     }
     if (!file_exists($file)) {
         pb_backupbuddy::status('error', 'Error #8583489734: Unable to send file `' . $file . '` to remote destination as it no longer exists. It may have been deleted or permissions are invalid.');
         return false;
     }
     $migrationkey_transient_time = 60 * 60 * 24;
     if ('' == $file) {
         $backup_file_size = 50000;
         // not sure why anything current would be sending importbuddy but NOT sending a backup but just in case...
     } else {
         $backup_file_size = filesize($file);
     }
     // Generate remote send ID for reference and add it as a new logging serial for better recording details.
     if ('' == $identifier) {
         $identifier = pb_backupbuddy::random_string(12);
     }
     // Set migration key for later determining last initiated migration.
     if ('migration' == $trigger) {
         set_transient('pb_backupbuddy_migrationkey', $identifier, $migrationkey_transient_time);
     }
     pb_backupbuddy::status('details', 'Sending file `' . $file . '` to remote destination `' . $destination_id . '` with ID `' . $identifier . '` triggered by `' . $trigger . '`.');
     //pb_backupbuddy::status( 'details', 'About to create initial fileoptions data.' );
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     pb_backupbuddy::status('details', 'Fileoptions instance #35.');
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $identifier . '.txt', $read_only = false, $ignore_lock = true, $create_file = true);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034 A. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     //pb_backupbuddy::status( 'details', 'Fileoptions data loaded.' );
     $fileoptions =& $fileoptions_obj->options;
     // Set reference.
     // Record some statistics.
     $fileoptions = array_merge(self::get_remote_send_defaults(), array('destination' => $destination_id, 'file' => $file, 'file_size' => $backup_file_size, 'trigger' => $trigger, 'send_importbuddy' => $send_importbuddy, 'start_time' => time(), 'finish_time' => 0, 'status' => 'running', 'write_speed' => 0));
     pb_backupbuddy::save();
     // Destination settings were not passed so get them based on the destination ID provided.
     if (!is_array($destination_settings)) {
         $destination_settings =& pb_backupbuddy::$options['remote_destinations'][$destination_id];
     }
     // For Stash we will check the quota prior to initiating send.
     if (pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash') {
         // Pass off to destination handler.
         require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
         $send_result = pb_backupbuddy_destinations::get_info('stash');
         // Used to kick the Stash destination into life.
         $stash_quota = pb_backupbuddy_destination_stash::get_quota(pb_backupbuddy::$options['remote_destinations'][$destination_id], true);
         if ($file != '') {
             $backup_file_size = filesize($file);
         } else {
             $backup_file_size = 50000;
         }
         if ($backup_file_size + $stash_quota['quota_used'] > $stash_quota['quota_total']) {
             $message = '';
             $message .= "You do not have enough Stash storage space to send this file. Please upgrade your Stash storage at http://ithemes.com/member/panel/stash.php or delete files to make space.\n\n";
             $message .= 'Attempting to send file of size ' . pb_backupbuddy::$format->file_size($backup_file_size) . ' but you only have ' . $stash_quota['quota_available_nice'] . ' available. ';
             $message .= 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
             pb_backupbuddy::status('error', $message);
             backupbuddy_core::mail_error($message);
             $fileoptions['status'] = 'Failure. Insufficient destination space.';
             $fileoptions_obj->save();
             return false;
         } else {
             if (isset($stash_quota['quota_warning']) && $stash_quota['quota_warning'] != '') {
                 // We log warning of usage but dont send error email.
                 $message = '';
                 $message .= 'WARNING: ' . $stash_quota['quota_warning'] . "\n\nPlease upgrade your Stash storage at http://ithemes.com/member/panel/stash.php or delete files to make space.\n\n";
                 $message .= 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
                 pb_backupbuddy::status('details', $message);
                 //backupbuddy_core::mail_error( $message );
             }
         }
     }
     // end if stash.
     /*
     if ( $send_importbuddy === true ) {
     	pb_backupbuddy::status( 'details', 'Generating temporary importbuddy.php file for remote send.' );
     	pb_backupbuddy::anti_directory_browsing( backupbuddy_core::getTempDirectory(), $die = false );
     	$importbuddy_temp = backupbuddy_core::getTempDirectory() . 'importbuddy.php'; // Full path & filename to temporary importbuddy
     	self::importbuddy( $importbuddy_temp ); // Create temporary importbuddy.
     	pb_backupbuddy::status( 'details', 'Generated temporary importbuddy.' );
     	$files[] = $importbuddy_temp; // Add importbuddy file to the list of files to send.
     	$send_importbuddy = true; // Track to delete after finished.
     } else {
     	pb_backupbuddy::status( 'details', 'Not sending importbuddy.' );
     }
     */
     // Clear fileoptions so other stuff can access it if needed.
     $fileoptions_obj->save();
     $fileoptions_obj->unlock();
     unset($fileoptions_obj);
     // Pass off to destination handler.
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     pb_backupbuddy::status('details', 'Calling destination send() function.');
     $send_result = pb_backupbuddy_destinations::send($destination_settings, $file, $identifier, $delete_after);
     pb_backupbuddy::status('details', 'Finished destination send() function.');
     self::kick_db();
     // Kick the database to make sure it didn't go away, preventing options saving.
     // Reload fileoptions.
     pb_backupbuddy::status('details', 'About to load fileoptions data for saving send status.');
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     pb_backupbuddy::status('details', 'Fileoptions instance #34.');
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $identifier . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034 G. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded for ID `' . $identifier . '`.');
     $fileoptions =& $fileoptions_obj->options;
     // Set reference.
     // Update stats.
     $fileoptions[$identifier]['finish_time'] = microtime(true);
     if ($send_result === true) {
         // succeeded.
         $fileoptions['status'] = 'success';
         $fileoptions['finish_time'] = microtime(true);
         pb_backupbuddy::status('details', 'Remote send SUCCESS.');
     } elseif ($send_result === false) {
         // failed.
         $fileoptions['status'] = 'failure';
         pb_backupbuddy::status('details', 'Remote send FAILURE.');
     } elseif (is_array($send_result)) {
         // Array so multipart.
         $fileoptions['status'] = 'multipart';
         $fileoptions['finish_time'] = 0;
         $fileoptions['_multipart_id'] = $send_result[0];
         $fileoptions['_multipart_status'] = $send_result[1];
         pb_backupbuddy::status('details', 'Multipart send in progress.');
     } else {
         pb_backupbuddy::status('error', 'Error #5485785576463. Invalid status send result: `' . $send_result . '`.');
     }
     $fileoptions_obj->save();
     // If we sent importbuddy then delete the local copy to clean up.
     if ($send_importbuddy !== false) {
         @unlink($importbuddy_temp);
         // Delete temporary importbuddy.
     }
     // As of v5.0: Post-send deletion now handled within destinations/bootstrap.php send() to support chunked sends.
     return $send_result;
 }
Exemple #6
0
 function process_remote_copy($destination_type, $file, $settings)
 {
     pb_backupbuddy::status('details', 'Copying remote `' . $destination_type . '` file `' . $file . '` down to local.');
     pb_backupbuddy::set_greedy_script_limits();
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     // Determine destination filename.
     $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('details', 'Filename of resulting local copy: `' . $destination_file . '`.');
     if ($destination_type == 'stash2') {
         require_once ABSPATH . 'wp-admin/includes/file.php';
         pb_backupbuddy::status('details', 'About to begin downloading from URL.');
         $download = download_url($url);
         pb_backupbuddy::status('details', 'Download process complete.');
         if (is_wp_error($download)) {
             $error = 'Error #832989323: Unable to download file `' . $file . '` from URL: `' . $url . '`. Details: `' . $download->get_error_message() . '`.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         } else {
             if (false === copy($download, $destination_file)) {
                 $error = 'Error #3329383: Unable to copy file from `' . $download . '` to `' . $destination_file . '`.';
                 pb_backupbuddy::status('error', $error);
                 pb_backupbuddy::alert($error);
                 @unlink($download);
                 return false;
             } else {
                 pb_backupbuddy::status('details', 'File saved to `' . $destination_file . '`.');
                 @unlink($download);
                 return true;
             }
         }
     }
     // end stash2.
     if ($destination_type == 'stash') {
         $itxapi_username = $settings['itxapi_username'];
         $itxapi_password = $settings['itxapi_password'];
         // Load required files.
         pb_backupbuddy::status('details', 'Load Stash files.');
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/init.php';
         require_once dirname(dirname(__FILE__)) . '/destinations/_s3lib/aws-sdk/sdk.class.php';
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php';
         // Talk with the Stash API to get access to do things.
         pb_backupbuddy::status('details', 'Authenticating Stash for remote copy to local.');
         $stash = new ITXAPI_Helper(pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, $itxapi_username, $itxapi_password);
         $manage_url = $stash->get_manage_url();
         $request = new RequestCore($manage_url);
         $response = $request->send_request(true);
         // Validate response.
         if (!$response->isOK()) {
             $error = 'Request for management credentials failed.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (!($manage_data = json_decode($response->body, true))) {
             $error = 'Did not get valid JSON response.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (isset($manage_data['error'])) {
             $error = 'Error: ' . implode(' - ', $manage_data['error']);
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         // Connect to S3.
         pb_backupbuddy::status('details', 'Instantiating S3 object.');
         $s3 = new AmazonS3($manage_data['credentials']);
         pb_backupbuddy::status('details', 'About to get Stash object `' . $file . '`...');
         try {
             $response = $s3->get_object($manage_data['bucket'], $manage_data['subkey'] . pb_backupbuddy_destination_stash::get_remote_path() . $file, array('fileDownload' => $destination_file));
         } catch (Exception $e) {
             pb_backupbuddy::status('error', 'Error #5443984: ' . $e->getMessage());
             error_log('err:' . $e->getMessage());
             return false;
         }
         if ($response->isOK()) {
             pb_backupbuddy::status('details', 'Stash copy to local success.');
             return true;
         } else {
             pb_backupbuddy::status('error', 'Error #894597845. Stash copy to local FAILURE. Details: `' . print_r($response, true) . '`.');
             return false;
         }
     } elseif ($destination_type == 'gdrive') {
         die('Not implemented here.');
         require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/init.php';
         $settings = array_merge(pb_backupbuddy_destination_gdrive::$default_settings, $settings);
         if (true === pb_backupbuddy_destination_gdrive::getFile($settings, $file, $destination_file)) {
             // success
             pb_backupbuddy::status('details', 'Google Drive copy to local success.');
             return true;
         } else {
             // fail
             pb_backupbuddy::status('details', 'Error #2332903. Google Drive copy to local FAILURE.');
             return false;
         }
     } elseif ($destination_type == 's3') {
         require_once pb_backupbuddy::plugin_path() . '/destinations/s3/init.php';
         if (true === pb_backupbuddy_destination_s3::download_file($settings, $file, $destination_file)) {
             // success
             pb_backupbuddy::status('details', 'S3 copy to local success.');
             return true;
         } else {
             // fail
             pb_backupbuddy::status('details', 'Error #85448774. S3 copy to local FAILURE.');
             return false;
         }
     } else {
         pb_backupbuddy::status('error', 'Error #859485. Unknown destination type for remote copy `' . $destination_type . '`.');
         return false;
     }
 }
    $delete_after = true;
    pb_backupbuddy::status('details', 'Remote send set to delete after successful send.');
} else {
    $delete_after = false;
    pb_backupbuddy::status('details', 'Remote send NOT set to delete after successful send.');
}
if (!isset(pb_backupbuddy::$options['remote_destinations'][$destination_id])) {
    die('Error #833383: Invalid destination ID `' . htmlentities($destination_id) . '`.');
}
// For Stash we will check the quota prior to initiating send.
if (pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash') {
    // Pass off to destination handler.
    require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
    $send_result = pb_backupbuddy_destinations::get_info('stash');
    // Used to kick the Stash destination into life.
    $stash_quota = pb_backupbuddy_destination_stash::get_quota(pb_backupbuddy::$options['remote_destinations'][$destination_id], true);
    if (isset($stash_quota['error'])) {
        echo ' Error accessing Stash account. Send aborted. Details: `' . implode(' - ', $stash_quota['error']) . '`.';
        die;
    }
    if ($backup_file != '') {
        $backup_file_size = filesize($backup_file);
    } else {
        $backup_file_size = 50000;
    }
    if ($backup_file_size + $stash_quota['quota_used'] > $stash_quota['quota_total']) {
        echo "You do not have enough Stash storage space to send this file. Please upgrade your Stash storage or delete files to make space.\n\n";
        echo 'Attempting to send file of size ' . pb_backupbuddy::$format->file_size($backup_file_size) . ' but you only have ' . $stash_quota['quota_available_nice'] . ' available. ';
        echo 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
        die;
    } else {
Exemple #8
0
 public function remote_send()
 {
     $success_output = false;
     // Set to true onece a leading 1 has been sent to the javascript to indicate success.
     $destination_id = pb_backupbuddy::_POST('destination_id');
     if (pb_backupbuddy::_POST('file') != 'importbuddy.php') {
         $backup_file = backupbuddy_core::getBackupDirectory() . pb_backupbuddy::_POST('file');
         if (!file_exists($backup_file)) {
             // Error if file to send did not exist!
             $error_message = 'Unable to find file `' . $backup_file . '` to send. File does not appear to exist. You can try again in a moment or turn on full error logging and try again to log for support.';
             pb_backupbuddy::status('error', $error_message);
             pb_backupbuddy::alert($error_message, true);
             die;
         }
     } else {
         $backup_file = '';
     }
     // Send ImportBuddy along-side?
     if (pb_backupbuddy::_POST('send_importbuddy') == '1') {
         $send_importbuddy = true;
         pb_backupbuddy::status('details', 'Cron send to be scheduled with importbuddy sending.');
     } else {
         $send_importbuddy = false;
         pb_backupbuddy::status('details', 'Cron send to be scheduled WITHOUT importbuddy sending.');
     }
     // Delete local copy after send completes?
     if (pb_backupbuddy::_POST('delete_after') == 'true') {
         $delete_after = true;
         pb_backupbuddy::status('details', 'Remote send set to delete after successful send.');
     } else {
         $delete_after = false;
         pb_backupbuddy::status('details', 'Remote send NOT set to delete after successful send.');
     }
     // For Stash we will check the quota prior to initiating send.
     if (pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash') {
         // Pass off to destination handler.
         require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
         $send_result = pb_backupbuddy_destinations::get_info('stash');
         // Used to kick the Stash destination into life.
         $stash_quota = pb_backupbuddy_destination_stash::get_quota(pb_backupbuddy::$options['remote_destinations'][$destination_id], true);
         if (isset($stash_quota['error'])) {
             echo ' Error accessing Stash account. Send aborted. Details: `' . implode(' - ', $stash_quota['error']) . '`.';
             die;
         }
         if ($backup_file != '') {
             $backup_file_size = filesize($backup_file);
         } else {
             $backup_file_size = 50000;
         }
         if ($backup_file_size + $stash_quota['quota_used'] > $stash_quota['quota_total']) {
             echo "You do not have enough Stash storage space to send this file. Please upgrade your Stash storage or delete files to make space.\n\n";
             echo 'Attempting to send file of size ' . pb_backupbuddy::$format->file_size($backup_file_size) . ' but you only have ' . $stash_quota['quota_available_nice'] . ' available. ';
             echo 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
             die;
         } else {
             if (isset($stash_quota['quota_warning']) && $stash_quota['quota_warning'] != '') {
                 echo '1Warning: ' . $stash_quota['quota_warning'] . "\n\n";
                 $success_output = true;
             }
         }
     }
     // end if Stash.
     pb_backupbuddy::status('details', 'Scheduling cron to send to this remote destination...');
     $schedule_result = backupbuddy_core::schedule_single_event(time(), pb_backupbuddy::cron_tag('remote_send'), array($destination_id, $backup_file, pb_backupbuddy::_POST('trigger'), $send_importbuddy, $delete_after));
     if ($schedule_result === FALSE) {
         $error = 'Error scheduling file transfer. Please check your BackupBuddy error log for details. A plugin may have prevented scheduling or the database rejected it.';
         pb_backupbuddy::status('error', $error);
         echo $error;
     } else {
         pb_backupbuddy::status('details', 'Cron to send to remote destination scheduled.');
     }
     spawn_cron(time() + 150);
     // Adds > 60 seconds to get around once per minute cron running limit.
     update_option('_transient_doing_cron', 0);
     // Prevent cron-blocking for next item.
     // SEE cron.php remote_send() for sending function that we pass to via the cron above.
     if ($success_output === false) {
         echo 1;
     }
     die;
 }
Exemple #9
0
 function send_remote_destination($destination_id, $file, $trigger = '', $send_importbuddy = false)
 {
     pb_backupbuddy::status('details', 'Sending file `' . $file . '` to remote destination `' . $destination_id . '` triggered by `' . $trigger . '`.');
     if (defined('PB_DEMO_MODE')) {
         return false;
     }
     // Record some statistics.
     $identifier = pb_backupbuddy::random_string(12);
     pb_backupbuddy::$options['remote_sends'][$identifier] = array('destination' => $destination_id, 'file' => $file, 'file_size' => filesize($file), 'trigger' => $trigger, 'send_importbuddy' => $send_importbuddy, 'start_time' => time(), 'finish_time' => 0, 'status' => 'timeout');
     pb_backupbuddy::save();
     // Prepare variables to pass to remote destination handler.
     $files = array($file);
     $destination_settings =& pb_backupbuddy::$options['remote_destinations'][$destination_id];
     // For Stash we will check the quota prior to initiating send.
     if (pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash') {
         // Pass off to destination handler.
         require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
         $send_result = pb_backupbuddy_destinations::get_info('stash');
         // Used to kick the Stash destination into life.
         $stash_quota = pb_backupbuddy_destination_stash::get_quota(pb_backupbuddy::$options['remote_destinations'][$destination_id], true);
         if ($file != '') {
             $backup_file_size = filesize($file);
         } else {
             $backip_file_size = 50000;
         }
         if ($backup_file_size + $stash_quota['quota_used'] > $stash_quota['quota_total']) {
             $message = '';
             $message .= "You do not have enough Stash storage space to send this file. Please upgrade your Stash storage at http://ithemes.com/member/stash.php or delete files to make space.\n\n";
             $message .= 'Attempting to send file of size ' . pb_backupbuddy::$format->file_size($backup_file_size) . ' but you only have ' . $stash_quota['quota_available_nice'] . ' available. ';
             $message .= 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
             pb_backupbuddy::status('error', $message);
             pb_backupbuddy::$classes['core']->mail_error($message);
             pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'Failure. Insufficient destination space.';
             pb_backupbuddy::save();
             return false;
         } else {
             if (isset($stash_quota['quota_warning']) && $stash_quota['quota_warning'] != '') {
                 // We log warning of usage but dont send error email.
                 $message = '';
                 $message .= 'WARNING: ' . $stash_quota['quota_warning'] . "\n\nPlease upgrade your Stash storage at http://ithemes.com/member/stash.php or delete files to make space.\n\n";
                 $message .= 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
                 pb_backupbuddy::status('details', $message);
                 //pb_backupbuddy::$classes['core']->mail_error( $message );
             }
         }
     }
     if ($send_importbuddy === true) {
         pb_backupbuddy::status('details', 'Generating temporary importbuddy.php file for remote send.');
         $importbuddy_temp = pb_backupbuddy::$options['temp_directory'] . 'importbuddy.php';
         // Full path & filename to temporary importbuddy
         $this->importbuddy($importbuddy_temp);
         // Create temporary importbuddy.
         pb_backupbuddy::status('details', 'Generated temporary importbuddy.');
         $files[] = $importbuddy_temp;
         // Add importbuddy file to the list of files to send.
         $send_importbuddy = true;
         // Track to delete after finished.
     } else {
         pb_backupbuddy::status('details', 'Not sending importbuddy.');
     }
     // Pass off to destination handler.
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     $send_result = pb_backupbuddy_destinations::send($destination_settings, $files);
     $this->kick_db();
     // Kick the database to make sure it didn't go away, preventing options saving.
     // Update stats.
     pb_backupbuddy::$options['remote_sends'][$identifier]['finish_time'] = time();
     if ($send_result === true) {
         // succeeded.
         pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'success';
         pb_backupbuddy::status('details', 'Remote send SUCCESS.');
     } elseif ($send_result === false) {
         // failed.
         pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'failure';
         pb_backupbuddy::status('details', 'Remote send FAILURE.');
     } elseif (is_array($send_result)) {
         // Array so multipart.
         pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'multipart';
         pb_backupbuddy::$options['remote_sends'][$identifier]['finish_time'] = 0;
         pb_backupbuddy::$options['remote_sends'][$identifier]['_multipart_id'] = $send_result[0];
         pb_backupbuddy::$options['remote_sends'][$identifier]['_multipart_status'] = $send_result[1];
         pb_backupbuddy::status('details', 'Multipart send in progress.');
     } else {
         pb_backupbuddy::status('error', 'Error #5485785576463. Invalid status send result: `' . $send_result . '`.');
     }
     pb_backupbuddy::save();
     // If we sent importbuddy then delete the local copy to clean up.
     if ($send_importbuddy !== false) {
         @unlink($importbuddy_temp);
         // Delete temporary importbuddy.
     }
     return $send_result;
 }
Exemple #10
0
 function send_remote_destination($destination_id, $file, $trigger = '', $send_importbuddy = false, $delete_after = false)
 {
     if (defined('PB_DEMO_MODE')) {
         return false;
     }
     if ('' == $file) {
         $backup_file_size = 50000;
         // not sure why anything current would be sending importbuddy but NOT sending a backup but just in case...
     } else {
         $backup_file_size = filesize($file);
     }
     pb_backupbuddy::status('details', 'Sending file `' . $file . '` (size: `' . $backup_file_size . '`) to remote destination `' . $destination_id . '` triggered by `' . $trigger . '`.');
     // Record some statistics.
     $identifier = pb_backupbuddy::random_string(12);
     pb_backupbuddy::$options['remote_sends'][$identifier] = array('destination' => $destination_id, 'file' => $file, 'file_size' => $backup_file_size, 'trigger' => $trigger, 'send_importbuddy' => $send_importbuddy, 'start_time' => time(), 'finish_time' => 0, 'status' => 'timeout');
     pb_backupbuddy::save();
     // Prepare variables to pass to remote destination handler.
     if ('' == $file) {
         // No file to send (blank string file typically happens when just sending importbuddy).
         $files = array();
     } else {
         $files = array($file);
     }
     $destination_settings =& pb_backupbuddy::$options['remote_destinations'][$destination_id];
     // For Stash we will check the quota prior to initiating send.
     if (pb_backupbuddy::$options['remote_destinations'][$destination_id]['type'] == 'stash') {
         // Pass off to destination handler.
         require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
         $send_result = pb_backupbuddy_destinations::get_info('stash');
         // Used to kick the Stash destination into life.
         $stash_quota = pb_backupbuddy_destination_stash::get_quota(pb_backupbuddy::$options['remote_destinations'][$destination_id], true);
         if ($file != '') {
             $backup_file_size = filesize($file);
         } else {
             $backup_file_size = 50000;
         }
         if ($backup_file_size + $stash_quota['quota_used'] > $stash_quota['quota_total']) {
             $message = '';
             $message .= "You do not have enough Stash storage space to send this file. Please upgrade your Stash storage at http://ithemes.com/member/stash.php or delete files to make space.\n\n";
             $message .= 'Attempting to send file of size ' . pb_backupbuddy::$format->file_size($backup_file_size) . ' but you only have ' . $stash_quota['quota_available_nice'] . ' available. ';
             $message .= 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
             pb_backupbuddy::status('error', $message);
             pb_backupbuddy::$classes['core']->mail_error($message);
             pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'Failure. Insufficient destination space.';
             pb_backupbuddy::save();
             return false;
         } else {
             if (isset($stash_quota['quota_warning']) && $stash_quota['quota_warning'] != '') {
                 // We log warning of usage but dont send error email.
                 $message = '';
                 $message .= 'WARNING: ' . $stash_quota['quota_warning'] . "\n\nPlease upgrade your Stash storage at http://ithemes.com/member/stash.php or delete files to make space.\n\n";
                 $message .= 'Currently using ' . $stash_quota['quota_used_nice'] . ' of ' . $stash_quota['quota_total_nice'] . ' (' . $stash_quota['quota_used_percent'] . '%).';
                 pb_backupbuddy::status('details', $message);
                 //pb_backupbuddy::$classes['core']->mail_error( $message );
             }
         }
     }
     if ($send_importbuddy === true) {
         pb_backupbuddy::status('details', 'Generating temporary importbuddy.php file for remote send.');
         $importbuddy_temp = pb_backupbuddy::$options['temp_directory'] . 'importbuddy.php';
         // Full path & filename to temporary importbuddy
         $this->importbuddy($importbuddy_temp);
         // Create temporary importbuddy.
         pb_backupbuddy::status('details', 'Generated temporary importbuddy.');
         $files[] = $importbuddy_temp;
         // Add importbuddy file to the list of files to send.
         $send_importbuddy = true;
         // Track to delete after finished.
     } else {
         pb_backupbuddy::status('details', 'Not sending importbuddy.');
     }
     // Pass off to destination handler.
     require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
     $send_result = pb_backupbuddy_destinations::send($destination_settings, $files);
     $this->kick_db();
     // Kick the database to make sure it didn't go away, preventing options saving.
     // Update stats.
     pb_backupbuddy::$options['remote_sends'][$identifier]['finish_time'] = time();
     if ($send_result === true) {
         // succeeded.
         pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'success';
         pb_backupbuddy::status('details', 'Remote send SUCCESS.');
     } elseif ($send_result === false) {
         // failed.
         pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'failure';
         pb_backupbuddy::status('details', 'Remote send FAILURE.');
     } elseif (is_array($send_result)) {
         // Array so multipart.
         pb_backupbuddy::$options['remote_sends'][$identifier]['status'] = 'multipart';
         pb_backupbuddy::$options['remote_sends'][$identifier]['finish_time'] = 0;
         pb_backupbuddy::$options['remote_sends'][$identifier]['_multipart_id'] = $send_result[0];
         pb_backupbuddy::$options['remote_sends'][$identifier]['_multipart_status'] = $send_result[1];
         pb_backupbuddy::status('details', 'Multipart send in progress.');
     } else {
         pb_backupbuddy::status('error', 'Error #5485785576463. Invalid status send result: `' . $send_result . '`.');
     }
     pb_backupbuddy::save();
     // If we sent importbuddy then delete the local copy to clean up.
     if ($send_importbuddy !== false) {
         @unlink($importbuddy_temp);
         // Delete temporary importbuddy.
     }
     // Handle post-send deletion on success.
     pb_backupbuddy::status('details', 'Checking if local file should be deleted after remote send based on settings.');
     if (true === $send_result) {
         // Success; only continue on bool true. false indicates failure, array chunking.
         if (true == $delete_after) {
             // Delete enabled so delete file.
             pb_backupbuddy::status('details', 'Local file should be deleted based on settings & success. Deleting local copy of file sent to destination.');
             if (file_exists($file)) {
                 $unlink_result = @unlink($file);
                 if (true !== $unlink_result) {
                     pb_backupbuddy::status('error', 'Unable to unlink local file `' . $file . '`.');
                 }
             }
             if (file_exists($file)) {
                 // File still exists.
                 pb_backupbuddy::status('details', __('Error. Unable to delete local file `' . $file . '` after send as set in settings.', 'it-l10n-backupbuddy'));
                 $this->mail_error('BackupBuddy was unable to delete local file `' . $file . '` after successful remove transfer though post-remote send deletion is enabled. You may want to delete it manually. This can be caused by permission problems or improper server configuration.');
             } else {
                 // Deleted.
                 pb_backupbuddy::status('details', __('Deleted local archive after successful remote destination send based on settings.', 'it-l10n-backupbuddy'));
                 pb_backupbuddy::status('action', 'archive_deleted');
             }
         } else {
             // Delete after disabled.
             pb_backupbuddy::status('details', 'Post-send local file deletion disabled so skipping.');
         }
     } else {
         // Send failed or not complete (chunking).
         pb_backupbuddy::status('details', 'Remote send not completed so skipping post-send deletion check.');
     }
     return $send_result;
 }
                pb_backupbuddy::alert(__('Deployments have been enabled for this site. Other sites sharing this Stash account may Push to or Pull from this site as long as your iThemes Member password is correctly provided.', 'it-l10n-backupbuddy'));
            } else {
                pb_backupbuddy::alert(__('Error #84838: Failure notifying Stash of new deployment site. See Remote Destinations page Recent Transfers listing for details.', 'it-l10n-backupbuddy'));
            }
        }
    } elseif ('disable' == pb_backupbuddy::_GET('deploy')) {
        pb_backupbuddy::$options['deployment_allowed'] = '0';
        pb_backupbuddy::save();
        pb_backupbuddy::alert(__('Deployments have been disabled for this site.', 'it-l10n-backupbuddy'));
    }
}
if (false !== $stashDestination) {
    require_once pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php';
    require_once pb_backupbuddy::plugin_path() . '/destinations/stash/init.php';
    //$stash = new ITXAPI_Helper( pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, pb_backupbuddy::$options['remote_destinations'][ $stashDestination ]['itxapi_username'], pb_backupbuddy::$options['remote_destinations'][ $stashDestination ]['itxapi_password'] );
    $manage_data = pb_backupbuddy_destination_stash::get_manage_data(pb_backupbuddy::$options['remote_destinations'][$stashDestination]);
    // Connect to S3.
    if (!is_array($manage_data['credentials'])) {
        die('Error #8484383c: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?');
    }
    $s3 = new AmazonS3($manage_data['credentials']);
    // the key, secret, token
    if (pb_backupbuddy::$options['remote_destinations'][$stashDestination]['ssl'] == '0') {
        @$s3->disable_ssl(true);
    }
    $response = $s3->list_objects($manage_data['bucket'], array('prefix' => $manage_data['subkey'] . '/deploy'));
    // list all the files in the subscriber account
    echo '<pre>';
    print_r($response);
    echo '</pre>';
    foreach ($response->body->Contents as $object) {
     // Loop through ending with the last created destination of this type.
     if ('stash' == $destination['type']) {
         if ($itxapi_username == $destination['itxapi_username']) {
             // Existing destination match.
             $destination_id = $destination_index;
         }
     }
 }
 if (!isset($destination_id)) {
     // Did not already find the same Stash destination.
     require_once pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php';
     require_once pb_backupbuddy::plugin_path() . '/destinations/stash/init.php';
     $itxapi_username = strtolower(pb_backupbuddy::_POST('stash_username'));
     $itxapi_password = ITXAPI_Helper::get_password_hash($itxapi_username, pb_backupbuddy::_POST('stash_password'));
     // Generates hash for use as password for API.
     $account_info = pb_backupbuddy_destination_stash::get_quota(array('itxapi_username' => $itxapi_username, 'itxapi_password' => $itxapi_password), true);
     if (false === $account_info) {
         // Bad credentials.
         global $pb_backupbuddy_destination_errors;
         $errors[] = 'Unable to authenticate with Stash. Check your iThemes login credentials and try again. Details: `' . implode(', ', $pb_backupbuddy_destination_errors) . '`.';
     } else {
         if (count(pb_backupbuddy::$options['remote_destinations']) > 0) {
             $nextDestKey = max(array_keys(pb_backupbuddy::$options['remote_destinations'])) + 1;
         } else {
             // no destinations yet. first index.
             $nextDestKey = 0;
         }
         pb_backupbuddy::$options['remote_destinations'][$nextDestKey] = pb_backupbuddy_destination_stash::$default_settings;
         pb_backupbuddy::$options['remote_destinations'][$nextDestKey]['itxapi_username'] = pb_backupbuddy::_POST('stash_username');
         pb_backupbuddy::$options['remote_destinations'][$nextDestKey]['itxapi_password'] = $itxapi_password;
         // Hashed password.
Exemple #13
0
 public static function send($settings = array(), $file, $send_id = '', $delete_after = false, $clear_uploads = false)
 {
     global $pb_backupbuddy_destination_errors;
     if ('1' == $settings['disabled']) {
         $pb_backupbuddy_destination_errors[] = __('Error #48933: This destination is currently disabled. Enable it under this destination\'s Advanced Settings.', 'it-l10n-backupbuddy');
         return false;
     }
     if (is_array($file)) {
         $file = $files[0];
     }
     $remote_path = self::get_remote_path();
     // Has leading and trailng slashes.
     $additionalParams = array('filename' => $remote_path . '/' . basename($file), 'size' => filesize($file), 'timezone' => get_option('timezone_string'));
     $response = self::stashAPI($settings, 'upload', $additionalParams);
     echo '<pre>';
     print_r($response);
     echo '</pre>';
     die;
     pb_backupbuddy::status('details', 'Post-send deletion: ' . $delete_after);
     global $pb_backupbuddy_destination_errors;
     if (!is_array($files)) {
         $files = array($files);
     }
     if ($clear_uploads === false) {
         // Uncomment the following line to override and always clear.
         //$clear_uploads = true;
     }
     $meta = array();
     if (isset($settings['meta'])) {
         pb_backupbuddy::status('details', 'Meta setting passed. Applying to all files in this pass.');
         $meta = $settings['meta'];
     }
     $forceRootUpload = false;
     if (isset($settings['forceRootUpload'])) {
         $forceRootUpload = $settings['forceRootUpload'];
     }
     $itxapi_username = $settings['itxapi_username'];
     $itxapi_password = $settings['itxapi_password'];
     if (true === $forceRootUpload) {
         pb_backupbuddy::status('details', 'Forcing root upload.');
         $remote_path = '/';
     } else {
         pb_backupbuddy::status('details', 'Not forcing root upload. Calculting root path.');
         $remote_path = self::get_remote_path($settings['directory']);
         // Has leading and trailng slashes.
     }
     pb_backupbuddy::status('details', 'Stash remote path set to `' . $remote_path . '`.');
     require_once dirname(__FILE__) . '/lib/class.itx_helper.php';
     require_once pb_backupbuddy::plugin_path() . '/_s3lib2/aws-autoloader.php';
     // Stash API talk.
     $stash = new ITXAPI_Helper(pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, $itxapi_username, $itxapi_password);
     $manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
     if (!is_array($manage_data['credentials'])) {
         pb_backupbuddy::status('error', 'Error #8484383b: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?');
         return false;
     }
     // Wipe all current uploads.
     /*
     if ( $clear_uploads === true ) {
     	pb_backupbuddy::status( 'details', 'Clearing any current uploads via Stash call to `abort-all`.' );
     	$abort_url = $stash->get_upload_url(null, 'abort-all');
     	$request = new RequestCore($abort_url);
     	try {
     		$response = $request->send_request( true );
     	} catch (Exception $e) {
     		$error = 'Error #237836: Unable to clear Stash quota information. Details:`' . $e->getMessage() . '`.';
     		pb_backupbuddy::status( 'error', $error );
     		echo $error;
     		return false;
     	        }
     }
     */
     delete_transient('pb_backupbuddy_stash2quota_' . $settings['itxapi_username']);
     // Delete quota transient since it probably has changed now.
     // Success if we made it this far.
     return true;
 }