當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。