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


PHP backupbuddy_core::calculateArchiveFilename方法代码示例

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


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

示例1: _verb_runBackup

 private static function _verb_runBackup()
 {
     $backupSerial = pb_backupbuddy::random_string(10);
     $profileArray = pb_backupbuddy::_POST('profile');
     if (false === ($profileArray = base64_decode($profileArray))) {
         $message = 'Error #8343728: Unable to base64 decode profile data.';
         pb_backupbuddy::status('error', $message, $backupSerial);
         die(json_encode(array('success' => false, 'error' => $message)));
     }
     if (NULL === ($profileArray = json_decode($profileArray, true))) {
         $message = 'Error #3272383: Unable to json decode profile data.';
         pb_backupbuddy::status('error', $message, $backupSerial);
         die(json_encode(array('success' => false, 'error' => $message)));
     }
     // Appends session tokens from the pulling site so they wont get logged out when this database is restored there.
     if (isset($profileArray['sessionTokens']) && is_array($profileArray['sessionTokens'])) {
         pb_backupbuddy::status('details', 'Remote session tokens need updated.', $backupSerial);
         //error_log( 'needtoken' );
         if (!is_numeric($profileArray['sessionID'])) {
             $message = 'Error #328989893. Invalid session ID. Must be numeric.';
             pb_backupbuddy::status('error', $message);
             die(json_encode(array('success' => false, 'error' => $message)));
         }
         // Get current session tokens.
         global $wpdb;
         $sql = "SELECT meta_value FROM `" . DB_NAME . "`.`" . $wpdb->prefix . "usermeta` WHERE `user_id` = '" . $profileArray['sessionID'] . "' AND `meta_key` = 'session_tokens';";
         $results = $wpdb->get_var($sql);
         $oldSessionTokens = @unserialize($results);
         // Add remote tokens.
         if (!is_array($oldSessionTokens)) {
             $oldSessionTokens = array();
         }
         $newSessionTokens = array_merge($oldSessionTokens, $profileArray['sessionTokens']);
         // Re-serialize.
         $newSessionTokens = serialize($newSessionTokens);
         // Save merged tokens here.
         $sql = "UPDATE `" . DB_NAME . "`.`" . $wpdb->prefix . "usermeta` SET meta_value= %s WHERE `user_id` = '" . $profileArray['sessionID'] . "' AND `meta_key` = 'session_tokens';";
         $stringedSessionTokens = serialize($profileArray['sessionTokens']);
         if (false === $wpdb->query($wpdb->prepare($sql, $stringedSessionTokens))) {
             $message = 'Error #43734784: Unable to update remote session token.';
             pb_backupbuddy::status('error', $message, $backupSerial);
             die(json_encode(array('success' => false, 'error' => $message)));
         }
         pb_backupbuddy::status('details', 'Updated remote session tokens.', $backupSerial);
     }
     if (true !== ($maybeMessage = backupbuddy_api::runBackup($profileArray, $triggerTitle = 'deployment_pulling', $backupMode = '', $backupSerial))) {
         $message = 'Error #48394873: Unable to launch backup at source. Details: `' . $maybeMessage . '`.';
         pb_backupbuddy::status('error', $message, $backupSerial);
         die(json_encode(array('success' => false, 'error' => $message)));
     } else {
         $archiveFilename = basename(backupbuddy_core::calculateArchiveFilename($backupSerial, $profileArray['type']));
         die(json_encode(array('success' => true, 'backupSerial' => $backupSerial, 'backupFile' => $archiveFilename)));
     }
 }
开发者ID:JDjimenezdelgado,项目名称:old-mmexperience,代码行数:54,代码来源:remote_api.php

示例2: start_backup_process

 function start_backup_process($profile, $trigger = 'manual', $pre_backup = array(), $post_backup = array(), $schedule_title = '', $serial_override = '', $export_plugins = array(), $deployDirection = '', $deployDestinationSettings = '')
 {
     // Load profile defaults.
     $profile = array_merge(pb_backupbuddy::settings('profile_defaults'), $profile);
     foreach ($profile as $profile_item_name => &$profile_item) {
         // replace non-overridden defaults with actual default value.
         if ('-1' == $profile_item) {
             // Set to use default so go grab default.
             if (isset(pb_backupbuddy::$options['profiles'][0][$profile_item_name])) {
                 $profile_item = pb_backupbuddy::$options['profiles'][0][$profile_item_name];
                 // Grab value from defaults profile and replace with it.
             }
         }
     }
     // Handle backup mode.
     $backup_mode = pb_backupbuddy::$options['backup_mode'];
     // Load global default mode.
     if ('1' == $profile['backup_mode']) {
         // Profile forces classic.
         $backup_mode = '1';
     } elseif ('2' == $profile['backup_mode']) {
         // Profiles forces modern.
         $backup_mode = '2';
     }
     $profile['backup_mode'] = $backup_mode;
     unset($backup_mode);
     // If classic mode then we need to redirect output to displaying inline via JS instead of AJAX-based.
     if ('1' == $profile['backup_mode']) {
         //global $pb_backupbuddy_js_status;
         //$pb_backupbuddy_js_status = true;
     }
     if ($serial_override != '') {
         $serial = $serial_override;
     } else {
         $serial = pb_backupbuddy::random_string(10);
     }
     pb_backupbuddy::set_status_serial($serial);
     // Default logging serial.
     global $wp_version;
     pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
     //pb_backupbuddy::status( 'details', __('Peak memory usage', 'it-l10n-backupbuddy' ) . ': ' . round( memory_get_peak_usage() / 1048576, 3 ) . ' MB' );
     $type = $profile['type'];
     $archiveFile = backupbuddy_core::calculateArchiveFilename($serial, $type, $profile);
     //if ( 'pull' != $deployDirection ) {
     if ($this->pre_backup($serial, $archiveFile, $profile, $trigger, $pre_backup, $post_backup, $schedule_title, $export_plugins, $deployDirection, $deployDestinationSettings) === false) {
         pb_backupbuddy::status('details', 'pre_backup() function failed.');
         return false;
     }
     /*
     } else { // PULL deployment.
     	
     	pb_backupbuddy::status( 'details', 'About to load fileoptions data in create mode.' );
     	require_once( pb_backupbuddy::plugin_path() . '/classes/fileoptions.php' );
     	pb_backupbuddy::status( 'details', 'Fileoptions instance #40.' );
     	$this->_backup_options = new pb_backupbuddy_fileoptions( backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true );
     	if ( true !== ( $result = $this->_backup_options->is_ok() ) ) {
     		pb_backupbuddy::status( 'error', __('Fatal Error #38293. Unable to access fileoptions data.', 'it-l10n-backupbuddy' ) . ' Error: ' . $result );
     		pb_backupbuddy::status( 'haltScript', '' ); // Halt JS on page.
     		return false;
     	}
     	pb_backupbuddy::status( 'details', 'Fileoptions data loaded.' );
     	$this->_backup = &$this->_backup_options->options; // Set reference.
     	$this->_backup['serial'] = $serial;
     }
     */
     if ($trigger == 'scheduled' && pb_backupbuddy::$options['email_notify_scheduled_start'] != '') {
         pb_backupbuddy::status('details', __('Sending scheduled backup start email notification if applicable.', 'it-l10n-backupbuddy'));
         backupbuddy_core::mail_notify_scheduled($serial, 'start', __('Scheduled backup', 'it-l10n-backupbuddy') . ' (' . $this->_backup['schedule_title'] . ') has begun.');
     }
     if ($profile['backup_mode'] == '2') {
         // Modern mode with crons.
         pb_backupbuddy::status('message', 'Running in modern backup mode based on settings. Mode value: `' . $profile['backup_mode'] . '`. Trigger: `' . $trigger . '`.');
         unset($this->_backup_options);
         // File unlocking is handled on deconstruction.  Make sure unlocked before firing off another cron spawn.
         // If using alternate cron on a manually triggered backup then skip running the cron on this pageload to avoid header already sent warnings.
         if ($trigger != 'manual' || defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
             $this->cron_next_step(false);
         } else {
             //$this->cron_next_step( true );
             $this->cron_next_step(false);
             // as of Aug 9, 2013 no longer spawn the cron. Caused very odd issue of double code runs.
         }
     } else {
         // Classic mode; everything runs in this single PHP page load.
         pb_backupbuddy::status('message', 'Running in classic backup mode based on settings.');
         $this->process_backup($this->_backup['serial'], $trigger);
     }
     return true;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:89,代码来源:backup.php


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