本文整理汇总了PHP中pb_backupbuddy_destinations类的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy_destinations类的具体用法?PHP pb_backupbuddy_destinations怎么用?PHP pb_backupbuddy_destinations使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pb_backupbuddy_destinations类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
if (true === ($results = pb_backupbuddy_destinations::test($settings))) {
return array('api' => '0', 'status' => 'ok', 'message' => 'Supported destinations retrieved.');
} else {
return array('api' => '0', 'status' => 'error', 'message' => $results);
}
}
示例2: test
public static function test($settings)
{
/*
if ( ( $settings['address'] == '' ) || ( $settings['username'] == '' ) || ( $settings['password'] == '' ) ) {
return __('Missing required input.', 'it-l10n-backupbuddy' );
}
*/
// Try sending a file.
return 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.
}
示例3: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$response = pb_backupbuddy_destinations::delete($arguments['id'], true);
if (true === $response) {
return array('api' => '0', 'status' => 'ok', 'message' => 'Destination deleted.');
} else {
return array('api' => '0', 'status' => 'error', 'message' => 'Error #384783783: Failure deleting destination.');
}
}
示例4: foreach
backupbuddy_core::mail_error($message);
}
}
}
}
// Cleanup remote S3 multipart chunking.
foreach (pb_backupbuddy::$options['remote_destinations'] as $destination) {
if ($destination['type'] != 's3') {
continue;
}
if (isset($destination['max_chunk_size']) && $destination['max_chunk_size'] == '0') {
continue;
}
pb_backupbuddy::status('details', 'Found S3 Multipart Chunking Destinations to cleanup.');
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$cleanup_result = pb_backupbuddy_destinations::multipart_cleanup($destination);
/*
if ( true === $cleanup_result ) {
pb_backupbuddy::status( 'details', 'S3 Multipart Chunking Cleanup Success.' );
} else {
pb_backupbuddy::status( 'error', 'S3 Multipart Chunking Cleanup FAILURE. Manually cleanup stalled multipart send via S3 or try again later.' );
}
*/
}
// Clean up any temp rollback or deployment database tables.
backupbuddy_core::cleanup_temp_tables();
// Cleanup any cron schedules pointing to non-existing schedules.
$cron = get_option('cron');
// Loop through each cron time to create $crons array for displaying later.
$crons = array();
foreach ((array) $cron as $time => $cron_item) {
示例5: process_destination_copy
function process_destination_copy($destination_settings, $remote_file, $fileID = '')
{
pb_backupbuddy::set_greedy_script_limits();
if (!class_exists('backupbuddy_core')) {
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
}
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$local_file = backupbuddy_core::getBackupDirectory() . basename($remote_file);
if (file_exists(basename($local_file))) {
$local_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $local_file);
}
if ($fileID != '') {
$remote_file = $fileID;
}
if (true === pb_backupbuddy_destinations::getFile($destination_settings, $remote_file, $local_file)) {
pb_backupbuddy::status('message', 'Success copying remote file to local.');
return true;
} else {
pb_backupbuddy::status('error', 'Failure copying remote file to local.');
return false;
}
}
示例6: foreach
$url = pb_backupbuddy::ajax_url('remoteClient') . '&destination_id=' . $destination_id;
echo '<iframe id="pb_backupbuddy_iframe-dest-' . $destination_id . '" src="' . $url . '" width="100%" height="3000" frameBorder="0">Error #4584594579. Browser not compatible with iframes.</iframe>';
echo '</div>';
pb_backupbuddy::$ui->end_tab();
}
pb_backupbuddy::$ui->start_tab('add_new');
$destination_type = pb_backupbuddy::_GET('add');
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
?>
<div class="bb_destinations" style="display: block; margin: 0;">
<div class="bb_destinations-group bb_destinations-new" style="display: block;">
<h3>What kind of destination do you want to add?</h3>
<ul>
<?php
$i = 0;
foreach (pb_backupbuddy_destinations::get_destinations_list($showUnavailable = true) as $destination_name => $destination) {
$i++;
if (true === $destination['compatible']) {
echo '<li class="bb_destination-item bb_destination-' . $destination_name . ' bb_destination-new-item">';
/*
if ( 's32' == $destination_name ) {
echo '<div class="bb-ribbon"><span>New</span></div>';
}
*/
if ('stash2' == $destination_name) {
echo '<div class="bb-ribbon"><span>New</span></div>';
}
echo '<a href="javascript:void(0)" rel="' . $destination_name . '">';
echo $destination['name'];
echo '</a></li>';
} else {
示例7: pb_bb_add_box
function pb_bb_add_box($mode, $picker_url, $hideBack = false)
{
?>
<div class="bb_destinations-group bb_destinations-new">
<h3>What kind of destination do you want to add?</h3>
<ul>
<?php
$i = 0;
foreach (pb_backupbuddy_destinations::get_destinations_list() as $destination_name => $destination) {
if ($mode == 'migration') {
if ($destination_name != 'local' && $destination_name != 'ftp' && $destination_name != 'sftp') {
// if not local or ftp when in migration mode then skip.
continue;
}
}
// Filter only showing certain destination type.
if ('' != pb_backupbuddy::_GET('filter')) {
if ($destination_name != pb_backupbuddy::_GET('filter')) {
continue;
// Move along to next destination.
}
}
$i++;
echo '<li class="bb_destination-item bb_destination-' . $destination_name . ' bb_destination-new-item"><a href="' . $picker_url . '&add=' . $destination_name . '&callback_data=' . pb_backupbuddy::_GET('callback_data') . '&sending=' . pb_backupbuddy::_GET('sending') . '" rel="' . $destination_name . '">' . $destination['name'] . '</a></li>';
if ($i >= 5) {
echo '<span class="bb_destination-break"></span>';
$i = 0;
}
}
if (false === $hideBack) {
?>
<br><br>
<a href="javascript:void(0)" class="btn btn-small btn-white btn-with-icon btn-back btn-back-add" onClick="jQuery('.bb_destinations-new').hide(); jQuery('.bb_destinations-existing').show();"><span class="btn-icon"></span>Back to existing destinations</a>
<?php
}
?>
</ul>
</div>
<?php
}
示例8: die
// 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.');
}
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'] . '%).';
示例9: die
<?php
if (!is_admin()) {
die('Access denied.');
}
/* remote_delete()
*
* description
*
*/
pb_backupbuddy::verify_nonce();
// Security check.
// Destination ID.
$destination_id = pb_backupbuddy::_GET('pb_backupbuddy_destinationid');
// Delete the destination.
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$delete_response = pb_backupbuddy_destinations::delete_destination($destination_id, true);
// Response.
if ($delete_response !== true) {
// Some kind of error so just echo it.
echo 'Error #544558: `' . $delete_response . '`.';
} else {
// Success.
echo 'Destination deleted.';
}
die;
示例10: test
public static function test($settings)
{
$settings = self::_init($settings);
// 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 S3.';
} else {
$send_response = 'Success.';
}
// Delete sent file.
$delete_response = 'Success.';
try {
$delete_response = self::$_client->delete_object(array('Bucket' => $settings['bucket'], 'Key' => $settings['directory'] . 'remote-send-test.php'));
$delete_response = 'Success.';
} catch (Exception $e) {
pb_backupbuddy::status('details', 'Unable to delete test S3 file `remote-send-test.php`. Details: `' . $e->getMessage() . '`.');
}
// Load destination fileoptions.
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #7.');
$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())) {
return self::_error(__('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
}
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;
}
示例11: periodic_cleanup
//.........这里部分代码省略.........
pb_backupbuddy::status('details', 'Unlinked importbuddy.php in root of site.');
unlink(ABSPATH . 'importbuddy.php');
} else {
pb_backupbuddy::status('details', 'SKIPPED unlinking importbuddy.php in root of site as it is fresh and may still be in use.');
}
}
// Remove any copy of importbuddy directory in root.
pb_backupbuddy::status('details', 'Cleaning up importbuddy directory in site root if it exists & is not very recent.');
if (file_exists(ABSPATH . 'importbuddy/')) {
$modified = filemtime(ABSPATH . 'importbuddy/');
if (FALSE === $modified || time() > $modified + $max_importbuddy_age) {
// If time modified unknown OR was modified long enough ago.
pb_backupbuddy::status('details', 'Unlinked importbuddy directory recursively in root of site.');
pb_backupbuddy::$filesystem->unlink_recursive(ABSPATH . 'importbuddy/');
} else {
pb_backupbuddy::status('details', 'SKIPPED unlinked importbuddy directory recursively in root of site as it is fresh and may still be in use.');
}
}
// Remove any old temporary directories in wp-content/uploads/backupbuddy_temp/. Logs any directories it cannot delete.
pb_backupbuddy::status('details', 'Cleaning up any old temporary zip directories in: wp-content/uploads/backupbuddy_temp/');
$temp_directory = WP_CONTENT_DIR . '/uploads/backupbuddy_temp/';
$files = glob($temp_directory . '*');
if (is_array($files) && !empty($files)) {
// For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
foreach ($files as $file) {
if (strpos($file, 'index.') !== false || strpos($file, '.htaccess') !== false) {
// Index file or htaccess dont get deleted so go to next file.
continue;
}
$file_stats = stat($file);
if (0 == $backup_age_limit || time() - $file_stats['mtime'] > $backup_age_limit) {
// If older than 12 hours, delete the log.
if (@pb_backupbuddy::$filesystem->unlink_recursive($file) === false) {
pb_backupbuddy::status('error', 'Unable to clean up (delete) temporary directory/file: `' . $file . '`. You should manually delete it or check permissions.');
}
}
}
}
// Cleanup any temp files from a failed restore within WordPress. (extract file feature).
$temp_dir = get_temp_dir();
pb_backupbuddy::status('details', 'Cleaning up temporary files from individual file / directory restores in directory `' . $temp_dir . '`...');
$possibly_temp_restore_dirs = glob($temp_dir . 'backupbuddy-*');
if (!is_array($possibly_temp_restore_dirs)) {
$possibly_temp_restore_dirs = array();
}
foreach ($possibly_temp_restore_dirs as $possibly_temp_restore_dir) {
if (false === pb_backupbuddy::$filesystem->unlink_recursive($possibly_temp_restore_dir)) {
// Delete.
pb_backupbuddy::status('details', 'Unable to delete temporary holding directory `' . $possibly_temp_restore_dir . '`.');
} else {
pb_backupbuddy::status('details', 'Cleaned up temporary files.');
}
}
pb_backupbuddy::status('details', 'Individual file / directory restore cleanup complete.');
// Remove any old temporary zip directories: wp-content/uploads/backupbuddy_backups/temp_zip_XXXX/. Logs any directories it cannot delete.
pb_backupbuddy::status('details', 'Cleaning up any old temporary zip directories in backup directory temp location `' . backupbuddy_core::getBackupDirectory() . 'temp_zip_XXXX/`.');
// $temp_directory = WP_CONTENT_DIR . '/uploads/backupbuddy_backups/temp_zip_*';
$temp_directory = backupbuddy_core::getBackupDirectory() . 'temp_zip_*';
$files = glob($temp_directory . '*');
if (is_array($files) && !empty($files)) {
// For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
foreach ($files as $file) {
if (strpos($file, 'index.') !== false || strpos($file, '.htaccess') !== false) {
// Index file or htaccess dont get deleted so go to next file.
continue;
}
$file_stats = stat($file);
if (time() - $file_stats['mtime'] > $backup_age_limit) {
// If older than 12 hours, delete the log.
if (@pb_backupbuddy::$filesystem->unlink_recursive($file) === false) {
$message = 'BackupBuddy was unable to clean up (delete) temporary directory/file: `' . $file . '`. You should manually delete it and/or verify proper file permissions to allow BackupBuddy to clean up for you.';
pb_backupbuddy::status('error', $message);
self::mail_error($message);
}
}
}
}
// Cleanup remote S3 multipart chunking.
foreach (pb_backupbuddy::$options['remote_destinations'] as $destination) {
if ($destination['type'] != 's3') {
continue;
}
if (isset($destination['max_chunk_size']) && $destination['max_chunk_size'] == '0') {
continue;
}
pb_backupbuddy::status('details', 'Found S3 Multipart Chunking Destinations to cleanup.');
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$cleanup_result = pb_backupbuddy_destinations::multipart_cleanup($destination);
/*
if ( true === $cleanup_result ) {
pb_backupbuddy::status( 'details', 'S3 Multipart Chunking Cleanup Success.' );
} else {
pb_backupbuddy::status( 'error', 'S3 Multipart Chunking Cleanup FAILURE. Manually cleanup stalled multipart send via S3 or try again later.' );
}
*/
}
@clearstatcache();
// Clears file info stat cache.
pb_backupbuddy::status('message', 'Finished cleanup procedure.');
}
示例12: network_admin_url
<?php
backupbuddy_core::verifyAjaxAccess();
pb_backupbuddy::$ui->ajax_header();
if (isset(pb_backupbuddy::$options['remote_destinations'][pb_backupbuddy::_GET('destination_id')])) {
$destination = pb_backupbuddy::$options['remote_destinations'][$_GET['destination_id']];
} else {
echo 'Error #438934894349. Invalid destination ID `' . pb_backupbuddy::_GET('destination_id') . '`.';
return;
}
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
pb_backupbuddy_destinations::manage($destination, $_GET['destination_id']);
/*
echo '<br><br><br>';
echo '<a class="button" href="';
if ( is_network_admin() ) {
echo network_admin_url( 'admin.php' );
} else {
echo admin_url( 'admin.php' );
}
echo '?page=pb_backupbuddy_destinations">← back to destinations</a><br><br>';
*/
pb_backupbuddy::$ui->ajax_footer();
die;
示例13: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
return array('api' => '0', 'status' => 'ok', 'message' => 'Supported destinations retrieved.', 'destinations' => pb_backupbuddy_destinations::get_destinations_list());
}
示例14: s32_cancel_multipart_pieces
public static function s32_cancel_multipart_pieces()
{
foreach (pb_backupbuddy::$options['remote_destinations'] as $destination) {
if ($destination['type'] != 's32') {
continue;
}
pb_backupbuddy::status('details', 'Found S32 Multipart Chunking Destinations to cleanup.');
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$cleanup_result = pb_backupbuddy_destinations::multipart_cleanup($destination);
if (true === $cleanup_result) {
pb_backupbuddy::status('details', 'S32 Multipart Chunking Cleanup Success.');
} else {
pb_backupbuddy::status('warning', 'Warning #2389328: S32 Multipart Chunking Cleanup FAILURE. Manually cleanup stalled multipart send via S3 or try again later.');
}
}
}
示例15: __
<?php
backupbuddy_core::verifyAjaxAccess();
pb_backupbuddy::$ui->ajax_header($js = true, $padding = true);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php';
$destination_id = backupbuddy_live::getLiveID();
$destination_settings = backupbuddy_live_periodic::get_destination_settings();
echo '<h2>' . __('BackupBuddy Stash Live Settings', 'it-l10n-backupbuddy') . '</h2>';
// Settings form setup.
$settings_form = pb_backupbuddy_destinations::configure($destination_settings, $mode = 'edit', $destination_id, $url = pb_backupbuddy::ajax_url('live_settings'));
// Process saving.
if ('' != pb_backupbuddy::_POST('pb_backupbuddy_')) {
pb_backupbuddy::verify_nonce();
$save_result = $settings_form->process();
if (count($save_result['errors']) == 0) {
// NO ERRORS SO SAVE.
pb_backupbuddy::$options['remote_destinations'][$destination_id] = array_merge(pb_backupbuddy::$options['remote_destinations'][$destination_id], $save_result['data']);
pb_backupbuddy::save();
pb_backupbuddy::alert(__('Settings saved. Restarting Live process so they take immediate effect.', 'it-l10n-backupbuddy'));
set_transient('backupbuddy_live_jump', array('daily_init', array()), 60 * 60 * 48);
// Tells Live process to restart from the beginning (if mid-process) so new settigns apply.
// Add final entry to log if disabled
if ($destination_settings['disable_logging'] == 0 && $save_result['data']['disable_logging'] == 1) {
$previous_status_serial = pb_backupbuddy::get_status_serial();
// Hold current serial.
pb_backupbuddy::set_status_serial('live_periodic');
// Redirect logging output to a certain log file.
pb_backupbuddy::status('details', '-----');
pb_backupbuddy::status('details', 'Logging disabled in Stash Live --> Settings --> Advanced.');