当前位置: 首页>>代码示例>>PHP>>正文


PHP pb_backupbuddy::save方法代码示例

本文整理汇总了PHP中pb_backupbuddy::save方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy::save方法的具体用法?PHP pb_backupbuddy::save怎么用?PHP pb_backupbuddy::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pb_backupbuddy的用法示例。


在下文中一共展示了pb_backupbuddy::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     return array('api' => '0', 'status' => 'ok', 'message' => 'Destination added.');
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:7,代码来源:backupbuddy-add-destination.php

示例2: parse_options

/**
 *	parse_options()
 *
 *	Parses various submitted options and settings from step 1.
 *
 *	@return		null
 */
function parse_options()
{
    if (isset($_POST['siteurl'])) {
        pb_backupbuddy::$options['siteurl'] = $_POST['siteurl'];
    }
    if (isset($_POST['custom_home'])) {
        pb_backupbuddy::$options['home'] = $_POST['home'];
    } else {
        pb_backupbuddy::$options['home'] = $_POST['siteurl'];
    }
    // Multisite domain.
    if (isset($_POST['domain'])) {
        pb_backupbuddy::$options['domain'] = $_POST['domain'];
    }
    if (isset($_POST['db_server'])) {
        pb_backupbuddy::$options['db_server'] = $_POST['db_server'];
    }
    if (isset($_POST['db_user'])) {
        pb_backupbuddy::$options['db_user'] = $_POST['db_user'];
    }
    if (isset($_POST['db_password'])) {
        pb_backupbuddy::$options['db_password'] = $_POST['db_password'];
    }
    if (isset($_POST['db_name'])) {
        pb_backupbuddy::$options['db_name'] = $_POST['db_name'];
    }
    if (isset($_POST['db_prefix'])) {
        pb_backupbuddy::$options['db_prefix'] = $_POST['db_prefix'];
    }
    if (!preg_match('/^[a-z0-9_]+$/i', $_POST['db_prefix'])) {
        pb_backupbuddy::alert('ERROR: Invalid characters in database prefix. Please use your browser\'s back button to correct the error. Prefixes should only contain letters (xyz), numbers (123), and underscores (_).', true);
        die;
    }
    pb_backupbuddy::save();
}
开发者ID:sonnetmedia,项目名称:otherpress.com,代码行数:42,代码来源:4.php

示例3: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     $highest_destination_index = end(array_keys(pb_backupbuddy::$options['remote_destinations']));
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination added.', 'destination_id' => $highest_destination_index);
 }
开发者ID:jcwproductions,项目名称:jcwproductions-blog,代码行数:8,代码来源:backupbuddy-add-destination.php

示例4: get_authorize_url

 function get_authorize_url()
 {
     $oauth = new Dropbox_OAuth_PEAR($this->_key, $this->_secret);
     $this->_token['request'] = $oauth->getRequestToken();
     pb_backupbuddy::save();
     //echo 'authorizeurltoken:<pre>';
     //print_r( $this->_token );
     //echo '</pre>';
     return str_replace('api.', 'www.', $oauth->getAuthorizeUrl());
 }
开发者ID:mariakhair,项目名称:bootstrap,代码行数:10,代码来源:dropbuddy.php

示例5: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if (!isset(pb_backupbuddy::$options['remote_destinations'][$arguments['id']])) {
         return array('api' => '1', 'status' => 'error', 'message' => 'Error #847383: Invalid destination ID. Not found.');
     }
     unset(pb_backupbuddy::$options['remote_destinations'][$arguments['id']]);
     pb_backupbuddy::save();
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination deleted.', 'destination_id' => $arguments['id']);
 }
开发者ID:Coop920,项目名称:Sterling-Wellness,代码行数:10,代码来源:backupbuddy-delete-destination.php

示例6: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     $newDestination = array();
     $newDestination['title'] = $arguments['settings']['title'];
     $newDestination['type'] = $arguments['settings']['type'];
     backupbuddy_core::addNotification('destination_created', 'Remote destination created', 'A new remote destination "' . $newDestination['title'] . '" has been created.', $newDestination);
     $highest_destination_index = end(array_keys(pb_backupbuddy::$options['remote_destinations']));
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination added.', 'destination_id' => $highest_destination_index);
 }
开发者ID:Coop920,项目名称:Sterling-Wellness,代码行数:12,代码来源:backupbuddy-add-destination.php

示例7: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if ('' == $arguments['id'] || !is_numeric($arguments['id'])) {
         return array('api' => '1', 'status' => 'error', 'message' => 'Missing destination ID setting or not numeric.');
     }
     if (!isset(pb_backupbuddy::$options['remote_destinations'][$arguments['id']])) {
         return array('api' => '1', 'status' => 'error', 'message' => 'Invalid destination ID. Not found.');
     }
     // Merge passed settings over current ones.
     pb_backupbuddy::$options['remote_destinations'][$arguments['id']] = array_merge(pb_backupbuddy::$options['remote_destinations'][$arguments['id']], $arguments['settings']);
     pb_backupbuddy::save();
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination updated.', 'destination_id' => $arguments['id']);
 }
开发者ID:elephantcode,项目名称:elephantcode,代码行数:14,代码来源:backupbuddy-edit-destination.php

示例8: _verb_renderImportBuddy

 private static function _verb_renderImportBuddy()
 {
     $backupFile = pb_backupbuddy::_POST('backupFile');
     $password = md5(md5(pb_backupbuddy::_POST('backupbuddy_api_key')));
     // Store this serial in settings to cleanup any temp db tables in the future with this serial with periodic cleanup.
     $backupSerial = backupbuddy_core::get_serial_from_file($backupFile);
     pb_backupbuddy::$options['rollback_cleanups'][$backupSerial] = time();
     pb_backupbuddy::save();
     $importFileSerial = backupbuddy_core::deploymentImportBuddy($password, backupbuddy_core::getBackupDirectory() . $backupFile);
     if (is_array($importFileSerial)) {
         die(json_encode(array('success' => false, 'error' => $importFileSerial[1])));
     } else {
         die(json_encode(array('success' => true, 'importFileSerial' => $importFileSerial)));
     }
 }
开发者ID:JDjimenezdelgado,项目名称:old-mmexperience,代码行数:15,代码来源:remote_api.php

示例9: savesettings

/**
 *	savesettings()
 *	
 *	Saves a form into the _options array.
 *	
 *	Use savepoint to set the root array key path. Accepts variable depth, dividing array keys with pound signs.
 *	Ex:	$_POST['savepoint'] value something like array_key_name#subkey
 *		<input type="hidden" name="savepoint" value="files#exclusions" /> to set the root to be $this->_options['files']['exclusions']
 *	
 *	All inputs with the name beginning with pound will act as the array keys to be set in the _options with the associated posted value.
 *	Ex:	$_POST['#key_name'] or $_POST['#key_name#subarray_key_name'] value is the array value to set.
 *		<input type="text" name="#name" /> will save to $this->_options['name']
 *		<input type="text" name="#group#17#name" /> will save to $this->_options['groups'][17]['name']
 *
 *	$savepoint_root		string		Override the savepoint. Same format as the form savepoint.
 */
function savesettings($savepoint_root = '')
{
    //check_admin_referer( 'backupbuddy-nonce' );
    foreach ($_POST as $post_index => $post_value) {
        $_POST[$post_index] = strip_tags_deep($post_value);
        // Do not use just strip_tags as it breaks array post vars.
    }
    if (!empty($savepoint_root)) {
        // Override savepoint.
        $_POST['savepoint'] = $savepoint_root;
    }
    if (!empty($_POST['savepoint'])) {
        $savepoint_root = stripslashes($_POST['savepoint']) . '#';
    } else {
        $savepoint_root = '';
    }
    $posted = stripslashes_deep($_POST);
    // Unescape all the stuff WordPress escaped. Sigh @ WordPress for being like PHP magic quotes.
    foreach ($posted as $index => $item) {
        if (substr($index, 0, 1) == '#') {
            $savepoint_subsection =& pb_backupbuddy::$options;
            $savepoint_levels = explode('#', $savepoint_root . substr($index, 1));
            foreach ($savepoint_levels as $savepoint_level) {
                $savepoint_subsection =& $savepoint_subsection[$savepoint_level];
            }
            $savepoint_subsection = $item;
        }
    }
    pb_backupbuddy::save();
}
开发者ID:verbazend,项目名称:AWFA,代码行数:46,代码来源:_destination_picker.php

示例10: quickstart_form

 function quickstart_form()
 {
     $errors = array();
     $form = pb_backupbuddy::_POST();
     //print_r( $form );
     if ('' != $form['email'] && false !== stristr($form['email'], '@')) {
         pb_backupbuddy::$options['email_notify_error'] = strip_tags($form['email']);
     } else {
         $errors[] = 'Invalid email address.';
     }
     if ('' != $form['password'] && $form['password'] == $form['password_confirm']) {
         pb_backupbuddy::$options['importbuddy_pass_hash'] = md5($form['password']);
         pb_backupbuddy::$options['importbuddy_pass_length'] = strlen($form['password']);
     } elseif ('' == $form['password']) {
         $errors[] = 'Please enter a password for restoring / migrating.';
     } else {
         $errors[] = 'Passwords do not match.';
     }
     if ('' != $form['schedule']) {
         $destination_id = '';
         if ('' != $form['destination_id']) {
             // Dest id explicitly set.
             $destination_id = $form['destination_id'];
         } else {
             // No explicit destination ID; deduce it.
             if ('' != $form['destination']) {
                 foreach (pb_backupbuddy::$options['remote_destinations'] as $destination_index => $destination) {
                     // Loop through ending with the last created destination of this type.
                     if ($destination['type'] == $form['destination']) {
                         $destination_id = $destination_index;
                     }
                 }
             }
         }
         function pb_backupbuddy_schedule_exist_by_title($title)
         {
             foreach (pb_backupbuddy::$options['schedules'] as $schedule) {
                 if ($schedule['title'] == $title) {
                     return true;
                 }
             }
             return false;
         }
         // STARTER
         if ('starter' == $form['schedule']) {
             $title = 'Weekly Database (Quick Setup - Starter)';
             if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
                 $add_response = backupbuddy_core::add_backup_schedule($title, $profile = '1', $interval = 'weekly', $first_run = time() + get_option('gmt_offset') * 3600 + 86400, $remote_destinations = array($destination_id));
                 if (true !== $add_response) {
                     $errors[] = $add_response;
                 }
             }
             $title = 'Monthly Full (Quick Setup - Starter)';
             if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
                 $add_response = backupbuddy_core::add_backup_schedule($title, $profile = '2', $interval = 'monthly', $first_run = time() + get_option('gmt_offset') * 3600 + 86400 + 18000, $remote_destinations = array($destination_id));
                 if (true !== $add_response) {
                     $errors[] = $add_response;
                 }
             }
         }
         // BLOGGER
         if ('blogger' == $form['schedule']) {
             $title = 'Daily Database (Quick Setup - Blogger)';
             if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
                 $add_response = backupbuddy_core::add_backup_schedule($title, $profile = '1', $interval = 'daily', $first_run = time() + get_option('gmt_offset') * 3600 + 86400, $remote_destinations = array($destination_id));
                 if (true !== $add_response) {
                     $errors[] = $add_response;
                 }
             }
             $title = 'Weekly Full (Quick Setup - Blogger)';
             if (false === pb_backupbuddy_schedule_exist_by_title($title)) {
                 $add_response = backupbuddy_core::add_backup_schedule($title, $profile = '2', $interval = 'weekly', $first_run = time() + get_option('gmt_offset') * 3600 + 86400 + 18000, $remote_destinations = array($destination_id));
                 if (true !== $add_response) {
                     $errors[] = $add_response;
                 }
             }
         }
     }
     // end set schedule.
     if (0 == count($errors)) {
         pb_backupbuddy::save();
         die('Success.');
     } else {
         die(implode("\n", $errors));
     }
 }
开发者ID:serker72,项目名称:T3S,代码行数:86,代码来源:ajax.php

示例11: reset_defaults

 public static function reset_defaults()
 {
     if (isset(pb_backupbuddy::$_settings['default_options'])) {
         pb_backupbuddy::$options = pb_backupbuddy::$_settings['default_options'];
         pb_backupbuddy::save();
         return true;
     } else {
         return false;
     }
 }
开发者ID:jimlongo56,项目名称:bhouse,代码行数:10,代码来源:_pluginbuddy.php

示例12: deploy_pull_renderImportBuddy

 public function deploy_pull_renderImportBuddy($state)
 {
     if (!file_exists($state['pullLocalArchiveFile'])) {
         pb_backupbuddy::status('error', 'Error #32783732: Backup file `' . $state['pullLocalArchiveFile'] . '` not found.');
         return false;
     }
     $backupSerial = backupbuddy_core::get_serial_from_file($state['pullLocalArchiveFile']);
     $importbuddyPassword = md5(md5($state['destination']['key_public']));
     $siteurl = site_url();
     $additionalStateInfo = array();
     $importFileSerial = backupbuddy_core::deploymentImportBuddy($importbuddyPassword, $state['pullLocalArchiveFile'], $additionalStateInfo);
     if (is_array($importFileSerial)) {
         // Could not generate importbuddy file.
         return false;
     }
     // Store this serial in settings to cleanup any temp db tables in the future with this serial with periodic cleanup.
     pb_backupbuddy::$options['rollback_cleanups'][$backupSerial] = time();
     pb_backupbuddy::save();
     // Create undo file.
     $undoFile = 'backupbuddy_deploy_undo-' . $backupSerial . '.php';
     if (false === copy(pb_backupbuddy::plugin_path() . '/classes/_rollback_undo.php', ABSPATH . $undoFile)) {
         $error = 'Error #3289447: Unable to write undo file `' . ABSPATH . $undoFile . '`. Check permissions on directory.';
         pb_backupbuddy::status('error', $error);
         return false;
     }
     // Start pulling importbuddy log.
     $importbuddyURLRoot = $siteurl . '/importbuddy-' . $importFileSerial . '.php';
     $importbuddyLogURL = $importbuddyURLRoot . '?ajax=getDeployLog&v=' . $importbuddyPassword . '&deploy=true';
     //$state['destination']['siteurl'] . '/importbuddy/'?ajax=2&v=' . $importbuddyPassword . '&deploy=true; //status-' . $response['importFileSerial'] . '.txt';
     $importbuddyURL = $importbuddyURLRoot . '?ajax=2&v=' . $importbuddyPassword . '&deploy=true&direction=pull&file=' . basename($state['pullLocalArchiveFile']);
     pb_backupbuddy::status('details', 'Load importbuddy at `' . $importbuddyURLRoot . '` with verifier `' . $importbuddyPassword . '`.');
     pb_backupbuddy::status('loadImportBuddy', json_encode(array('url' => $importbuddyURL, 'logurl' => $importbuddyLogURL)));
     // Calculate undo URL.
     $undoDeployURL = $siteurl . '/backupbuddy_deploy_undo-' . $this->_backup['serial'] . '.php';
     pb_backupbuddy::status('details', 'To undo deployment of database contents go to the URL: ' . $undoDeployURL);
     pb_backupbuddy::status('undoDeployURL', $undoDeployURL);
     // Pull importbuddy log instead of remote backup log. Nothing else is going to be done on remote server.
     $this->_backup_options->options['deployment_log'] = $importbuddyLogURL;
     $this->_backup_options->save();
     // Next step.
     pb_backupbuddy::status('details', 'Inserting deploy step to run importbuddy steps on remote server.');
     $newStep = array('function' => 'deploy_runningImportBuddy', 'args' => array($state), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0);
     $this->insert_next_step($newStep);
     return true;
 }
开发者ID:jcwproductions,项目名称:jcwproductions-blog,代码行数:45,代码来源:backup.php

示例13: verify_directories

 public static function verify_directories($skipTempGeneration = false)
 {
     $success = true;
     // Update backup directory if unable to write to the defined one.
     if (!@is_writable(backupbuddy_core::getBackupDirectory())) {
         pb_backupbuddy::status('details', 'Backup directory invalid. Updating from `' . backupbuddy_core::getBackupDirectory() . '` to default.');
         pb_backupbuddy::$options['backup_directory'] = '';
         // Reset to default (blank).
         pb_backupbuddy::save();
     }
     $response = pb_backupbuddy::anti_directory_browsing(backupbuddy_core::getBackupDirectory(), $die = false);
     if (false === $response) {
         $success = false;
     }
     // Update log directory if unable to write to the defined one.
     if (!@is_writable(backupbuddy_core::getLogDirectory())) {
         pb_backupbuddy::status('details', 'Log directory invalid. Updating from `' . backupbuddy_core::getLogDirectory() . '` to default.');
         pb_backupbuddy::$options['log_directory'] = '';
         // Reset to default (blank).
         pb_backupbuddy::save();
     }
     pb_backupbuddy::anti_directory_browsing(backupbuddy_core::getLogDirectory(), $die = false);
     if (false === $response) {
         $success = false;
     }
     // Update temp directory if unable to write to the defined one.
     if (true !== $skipTempGeneration) {
         if (!@is_writable(backupbuddy_core::getTempDirectory())) {
             pb_backupbuddy::status('details', 'Temporary directory invalid. Updating from `' . backupbuddy_core::getTempDirectory() . '` to default.');
             pb_backupbuddy::$options['temp_directory'] = '';
             pb_backupbuddy::save();
         }
         pb_backupbuddy::anti_directory_browsing(backupbuddy_core::getTempDirectory(), $die = false);
         if (false === $response) {
             $success = false;
         }
     }
     // If temp directory exists (should only be transient but just in case it is hanging around) make sure it's secured. BB will try to delete this directory but if it can't it will at least be checked to be secure.
     if (file_exists(backupbuddy_core::getTempDirectory())) {
         pb_backupbuddy::anti_directory_browsing(backupbuddy_core::getTempDirectory(), $die = false);
     }
     global $pb_backupbuddy_directory_verification;
     $pb_backupbuddy_directory_verification = $success;
     return $success;
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:45,代码来源:core.php

示例14: site_size_listing

    public function site_size_listing()
    {
        $exclusions = pb_backupbuddy_core::get_directory_exclusions();
        $result = pb_backupbuddy::$filesystem->dir_size_map(ABSPATH, ABSPATH, $exclusions, $dir_array);
        $total_size = pb_backupbuddy::$options['stats']['site_size'] = $result[0];
        $total_size_excluded = pb_backupbuddy::$options['stats']['site_size_excluded'] = $result[1];
        pb_backupbuddy::$options['stats']['site_size_updated'] = time();
        pb_backupbuddy::save();
        arsort($dir_array);
        ?>
		<table class="widefat">
			<thead>
				<tr class="thead">
					<?php 
        echo '<th>', __('Directory', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Children', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Exclusions', 'it-l10n-backupbuddy'), '</th>';
        ?>
				</tr>
			</thead>
			<tfoot>
				<tr class="thead">
					<?php 
        echo '<th>', __('Directory', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Children', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size with Exclusions', 'it-l10n-backupbuddy'), '</th>';
        ?>
				</tr>
			</tfoot>
			<tbody>
		<?php 
        echo '<tr><td align="right"><b>' . __('TOTALS', 'it-l10n-backupbuddy') . ':</b></td><td><b>' . pb_backupbuddy::$format->file_size($total_size) . '</b></td><td><b>' . pb_backupbuddy::$format->file_size($total_size_excluded) . '</b></td></tr>';
        $item_count = 0;
        foreach ($dir_array as $id => $item) {
            // Each $item is in format array( TOTAL_SIZE, TOTAL_SIZE_TAKING_EXCLUSIONS_INTO_ACCOUNT );
            $item_count++;
            if ($item_count > 100) {
                flush();
                $item_count = 0;
            }
            if ($item[1] === false) {
                $excluded_size = '<i>Excluded</i>';
                echo '<tr style="background: #F9B6B6;">';
            } else {
                $excluded_size = pb_backupbuddy::$format->file_size($item[1]);
                echo '<tr>';
            }
            echo '<td>' . $id . '</td><td>' . pb_backupbuddy::$format->file_size($item[0]) . '</td><td>' . $excluded_size . '</td></tr>';
        }
        echo '<tr><td align="right"><b>' . __('TOTALS', 'it-l10n-backupbuddy') . ':</b></td><td><b>' . pb_backupbuddy::$format->file_size($total_size) . '</b></td><td><b>' . pb_backupbuddy::$format->file_size($total_size_excluded) . '</b></td></tr>';
        echo '</tbody>';
        echo '</table>';
        echo '<br>';
        echo 'Exclusions';
        pb_backupbuddy::tip('List of directories that will be excluded in an actual backup. This includes user-defined directories and BackupBuddy directories such as the archive directory and temporary directories.');
        echo '<div id="pb_backupbuddy_serverinfo_exclusions" style="background-color: #EEEEEE; padding: 4px; float: right; white-space: nowrap; height: 90px; width: 70%; min-width: 400px; overflow: auto;"><i>' . implode("<br>", $exclusions) . '</i></div>';
        echo '<br style="clear: both;">';
        die;
    }
开发者ID:brettex,项目名称:pspark,代码行数:55,代码来源:ajax.php

示例15: send

 public static function send($settings = array(), $files = array(), $clear_uploads = false)
 {
     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;
     }
     $itxapi_username = $settings['itxapi_username'];
     $itxapi_password = $settings['itxapi_password'];
     $db_archive_limit = $settings['db_archive_limit'];
     $full_archive_limit = $settings['full_archive_limit'];
     $max_chunk_size = $settings['max_chunk_size'];
     $remote_path = self::get_remote_path($settings['directory']);
     // Has leading and trailng slashes.
     if ($settings['ssl'] == '0') {
         $disable_ssl = true;
     } else {
         $disable_ssl = false;
     }
     $multipart_id = $settings['_multipart_id'];
     $multipart_counts = $settings['_multipart_counts'];
     pb_backupbuddy::status('details', 'Stash remote path set to `' . $remote_path . '`.');
     require_once dirname(__FILE__) . '/lib/class.itx_helper.php';
     require_once dirname(__FILE__) . '/lib/aws-sdk/sdk.class.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);
     // 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);
         //pb_backupbuddy::status('details', print_r( $request , true ) );
         $response = $request->send_request(true);
     }
     // Process multipart transfer that we already initiated in a previous PHP load.
     if ($multipart_id != '') {
         // Multipart upload initiated and needs parts sent.
         // Create S3 instance.
         pb_backupbuddy::status('details', 'Creating Stash S3 instance.');
         $s3 = new AmazonS3($settings['_multipart_upload_data']['credentials']);
         // the key, secret, token
         if ($disable_ssl === true) {
             @$s3->disable_ssl(true);
         }
         pb_backupbuddy::status('details', 'Stash S3 instance created.');
         $this_part_number = $settings['_multipart_partnumber'] + 1;
         pb_backupbuddy::status('details', 'Stash beginning upload of part `' . $this_part_number . '` of `' . count($settings['_multipart_counts']) . '` parts of file `' . $settings['_multipart_file'] . '` with multipart ID `' . $settings['_multipart_id'] . '`.');
         $response = $s3->upload_part($settings['_multipart_upload_data']['bucket'], $settings['_multipart_upload_data']['object'], $settings['_multipart_id'], array('expect' => '100-continue', 'fileUpload' => $settings['_multipart_file'], 'partNumber' => $this_part_number, 'seekTo' => (int) $settings['_multipart_counts'][$settings['_multipart_partnumber']]['seekTo'], 'length' => (int) $settings['_multipart_counts'][$settings['_multipart_partnumber']]['length']));
         if (!$response->isOK()) {
             $this_error = 'Stash unable to upload file part for multipart upload `' . $settings['_multipart_id'] . '`. Details: `' . print_r($response, true) . '`.';
             $pb_backupbuddy_destination_errors[] = $this_error;
             pb_backupbuddy::status('error', $this_error);
             return false;
         }
         // Update stats.
         foreach (pb_backupbuddy::$options['remote_sends'] as $identifier => $remote_send) {
             if (isset($remote_send['_multipart_id']) && $remote_send['_multipart_id'] == $multipart_id) {
                 // this item.
                 pb_backupbuddy::$options['remote_sends'][$identifier]['_multipart_status'] = 'Sent part ' . $this_part_number . ' of ' . count($settings['_multipart_counts']) . '.';
                 if ($this_part_number == count($settings['_multipart_counts'])) {
                     pb_backupbuddy::$options['remote_sends'][$identifier]['_multipart_status'] .= '<br>Success.';
                     pb_backupbuddy::$options['remote_sends'][$identifier]['finish_time'] = time();
                 }
                 pb_backupbuddy::save();
                 break;
             }
         }
         // Made it here so success sending part. Increment for next part to send.
         $settings['_multipart_partnumber']++;
         if (!isset($settings['_multipart_counts'][$settings['_multipart_partnumber']])) {
             // No more parts exist for this file. Tell S3 the multipart upload is complete and move on.
             pb_backupbuddy::status('details', 'Stash getting parts with etags to notify S3 of completed multipart send.');
             $etag_parts = $s3->list_parts($settings['_multipart_upload_data']['bucket'], $settings['_multipart_upload_data']['object'], $settings['_multipart_id']);
             pb_backupbuddy::status('details', 'Stash got parts list. Notifying S3 of multipart upload completion.');
             $response = $s3->complete_multipart_upload($settings['_multipart_upload_data']['bucket'], $settings['_multipart_upload_data']['object'], $settings['_multipart_id'], $etag_parts);
             if (!$response->isOK()) {
                 $this_error = 'Stash unable to notify S3 of completion of all parts for multipart upload `' . $settings['_multipart_id'] . '`.';
                 $pb_backupbuddy_destination_errors[] = $this_error;
                 pb_backupbuddy::status('error', $this_error);
                 return false;
             } else {
                 pb_backupbuddy::status('details', 'Stash notified S3 of multipart completion.');
             }
             // Notify Stash API that things were succesful.
             $done_url = $stash->get_upload_url($settings['_multipart_file'], 'done', $remote_path . $settings['_multipart_backup_type_dir'] . basename($settings['_multipart_file']));
             pb_backupbuddy::status('details', 'Notifying Stash of completed multipart upload with done url `' . $done_url . '`.');
             $request = new RequestCore($done_url);
             $response = $request->send_request(true);
             if (!$response->isOK()) {
                 $this_error = 'Error #756834682. Could not finalize Stash upload. Response code: `' . $response->get_response_code() . '`; Response body: `' . $response->get_response_body() . '`; Response headers: `' . $response->get_response_header() . '`.';
                 $pb_backupbuddy_destination_errors[] = $this_error;
                 pb_backupbuddy::status('error', $this_error);
                 return false;
             } else {
                 // Good server response.
                 // See if we got an optional json response.
//.........这里部分代码省略.........
开发者ID:CherylMuniz,项目名称:fashion,代码行数:101,代码来源:init.php


注:本文中的pb_backupbuddy::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。