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


PHP pb_backupbuddy_fileoptions::is_ok方法代码示例

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


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

示例1: glob

backupbuddy_core::trim_remote_send_stats();
// Verify directory existance and anti-directory browsing is in place everywhere.
backupbuddy_core::verify_directories($skipTempGeneration = true);
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
// Mark any backups noted as in progress to timed out if taking too long. Send error email is scheduled and failed or timed out.
// Also, Purge fileoptions files without matching backup file in existance that are older than 30 days.
pb_backupbuddy::status('details', 'Cleaning up old backup fileoptions option files.');
$fileoptions_directory = backupbuddy_core::getLogDirectory() . 'fileoptions/';
$files = glob($fileoptions_directory . '*.txt');
if (!is_array($files)) {
    $files = array();
}
foreach ($files as $file) {
    pb_backupbuddy::status('details', 'Fileoptions instance #43.');
    $backup_options = new pb_backupbuddy_fileoptions($file, $read_only = false);
    if (true !== ($result = $backup_options->is_ok())) {
        pb_backupbuddy::status('error', 'Error retrieving fileoptions file `' . $file . '`. Err 335353266.');
    } else {
        if (isset($backup_options->options['archive_file'])) {
            //error_log( print_r( $backup_options->options, true ) );
            if (FALSE === $backup_options->options['finish_time']) {
                // Failed & already handled sending notification.
            } elseif ($backup_options->options['finish_time'] == -1) {
                // Cancelled manually
            } elseif ($backup_options->options['finish_time'] >= $backup_options->options['start_time'] && 0 != $backup_options->options['start_time']) {
                // Completed
            } else {
                // Timed out or in progress.
                $secondsAgo = time() - $backup_options->options['updated_time'];
                if ($secondsAgo > backupbuddy_constants::TIME_BEFORE_CONSIDERED_TIMEOUT) {
                    // If 24hrs passed since last update to backup then mark this timeout as failed.
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:31,代码来源:_periodicCleanup.php

示例2: run

 public function run($arguments)
 {
     $timeoutMinutes = 5;
     // Minutes after which BackupBuddy assumed a backup has timed out & no longer running.
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     /***** BEGIN CALCULATING CURRENT BACKUP DETAILS *****/
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     $backup_options = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/' . pb_backupbuddy::$options['last_backup_serial'] . '.txt', $read_only = true);
     if (true !== ($result = $backup_options->is_ok())) {
         $currentBackup = false;
     } else {
         $currentBackup = $backup_options->options;
     }
     $currentBackupStats['serial'] = $currentBackup['serial'];
     $currentBackupStats['isRunning'] = '0';
     if ('0' == $currentBackup['finish_time']) {
         // Last backup has not finished yet or timed out.
         if (time() - $currentBackup['updated_time'] > 60 * $timeoutMinutes) {
             // Most likely timed out.
         } else {
             // Still chugging along possibly.
             $currentBackupStats['isRunning'] = '1';
         }
     }
     $currentBackupStats['processStarted'] = $currentBackup['start_time'];
     $currentBackupStats['processFinished'] = $currentBackup['finish_time'];
     $currentBackupStats['processStepTitle'] = '';
     $currentBackupStats['processStepFunction'] = '';
     $currentBackupStats['processStepElapsed'] = 0;
     foreach ((array) $currentBackup['steps'] as $step) {
         if ('0' == $step['finish_time']) {
             $currentBackupStats['processStepTitle'] = backupbuddy_core::prettyFunctionTitle($step['function']);
             $currentBackupStats['processStepFunction'] = $step['function'];
             $currentBackupStats['processStepElapsed'] = time() - $step['start_time'];
             break;
         }
     }
     $currentBackupStats['backupType'] = $currentBackup['type'];
     $currentBackupStats['profileTitle'] = htmlentities($currentBackup['profile']['title']);
     $currentBackupStats['scheduleTitle'] = $currentBackup['schedule_title'];
     if (@file_exists($currentBackup['archive_file'])) {
         $currentBackupStats['archiveFile'] = basename($currentBackup['archive_file']);
     } else {
         $currentBackupStats['archiveFile'] = '';
     }
     $currentBackupStats['archiveURL'] = '';
     if (isset($currentBackup['archive_url'])) {
         $currentBackupStats['archiveURL'] = $currentBackup['archive_url'];
     }
     $currentBackupStats['archiveSize'] = 0;
     if ($currentBackup['archive_size'] == 0) {
         if (file_exists($currentBackup['temporary_zip_directory'])) {
             // Temp zip file.
             $directory = opendir($currentBackup['temporary_zip_directory']);
             while ($file = readdir($directory)) {
                 if ($file != '.' && $file != '..' && $file != 'exclusions.txt' && !preg_match('/.*\\.txt/', $file) && !preg_match('/pclzip.*\\.gz/', $file)) {
                     $stats = stat($currentBackup['temporary_zip_directory'] . $file);
                     $currentBackupStats['archiveSize'] = $stats['size'];
                 }
             }
             closedir($directory);
             unset($directory);
         }
     }
     $integrityIsOK = '-1';
     if (isset($currentBackup['integrity']) && isset($currentBackup['integrity']['is_ok'])) {
         $integrityIsOK = $currentBackup['integrity']['is_ok'];
     }
     $currentBackupStats['integrityStatus'] = $integrityIsOK;
     // true, false, -1 (unknown)
     $destinations = array();
     foreach ((array) $currentBackup['steps'] as $step) {
         if ('send_remote_destination' == $step['function']) {
             $destinations[] = array('id' => $step['args'][0], 'title' => pb_backupbuddy::$options['remote_destinations'][$step['args'][0]]['title'], 'type' => pb_backupbuddy::$options['remote_destinations'][$step['args'][0]]['type']);
         }
     }
     $currentBackupStats['destinations'] = $destinations;
     // Index is destination ID. Empty array if none.
     /***** END CALCULATING CURRENT BACKUP DETAILS *****/
     return array('version' => '4', 'status' => 'ok', 'message' => 'Latest backup process details retrieved successfully.', 'latestBackupProcess' => $currentBackupStats, 'localTime' => time());
 }
开发者ID:FelixNong1990,项目名称:andy,代码行数:84,代码来源:backupbuddy-get-latestBackupProcess.php

示例3:

<?php

backupbuddy_core::verifyAjaxAccess();
// Abort an in-process remote destination send.
/* remotesend_abort()
 *
 * Abort an in-progress demote destination file transfer. Dies with outputting "1" on success.
 *
 */
$send_id = pb_backupbuddy::_GET('send_id');
$send_id = str_replace('/\\', '', $send_id);
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #25.');
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = true, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
    pb_backupbuddy::status('error', __('Fatal Error #9034.324544. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
    return false;
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
$fileoptions['status'] = 'aborted';
$fileoptions_obj->save();
die('1');
开发者ID:Coop920,项目名称:Sterling-Wellness,代码行数:24,代码来源:remotesend_abort.php

示例4: send


//.........这里部分代码省略.........
         pb_backupbuddy::status('details', 'sFTP log (if available & enabled via full logging mode): `' . $sftp->getSFTPLog() . '`.');
         return false;
     }
     // Upload files.
     $total_transfer_size = 0;
     $total_transfer_time = 0;
     foreach ($files as $file) {
         if (!file_exists($file)) {
             pb_backupbuddy::status('error', 'Error #859485495. Could not upload local file `' . $file . '` to send to sFTP as it does not exist. Verify the file exists, permissions of file, parent directory, and that ownership is correct. You may need suphp installed on the server.');
         }
         if (!is_readable($file)) {
             pb_backupbuddy::status('error', 'Error #8594846548. Could not read local file `' . $file . '` to send to sFTP as it is not readable. Verify permissions of file, parent directory, and that ownership is correct. You may need suphp installed on the server.');
         }
         $filesize = filesize($file);
         $total_transfer_size += $filesize;
         $destination_file = basename($file);
         pb_backupbuddy::status('details', 'About to put to sFTP local file `' . $file . '` of size `' . pb_backupbuddy::$format->file_size($filesize) . '` to remote file `' . $destination_file . '`.');
         $send_time = -microtime(true);
         $upload = $sftp->put($destination_file, $file, NET_SFTP_LOCAL_FILE);
         $send_time += microtime(true);
         $total_transfer_time += $send_time;
         if ($upload === false) {
             // Failed sending.
             $error_message = 'ERROR #9012b ( http://ithemes.com/codex/page/BackupBuddy:_Error_Codes#9012 ).  sFTP file upload failed. Check file permissions & disk quota.';
             pb_backupbuddy::status('error', $error_message);
             backupbuddy_core::mail_error($error_message);
             pb_backupbuddy::status('details', 'sFTP log (if available & enabled via full logging mode): `' . $sftp->getSFTPLog() . '`.');
             return false;
         } else {
             // Success sending.
             pb_backupbuddy::status('details', 'Success completely sending `' . basename($file) . '` to destination.');
             // Start remote backup limit
             if ($settings['archive_limit'] > 0) {
                 pb_backupbuddy::status('details', 'Archive limit enabled. Getting contents of backup directory.');
                 $contents = $sftp->rawlist($settings['path']);
                 // already in destination directory/path.
                 // Create array of backups
                 $bkupprefix = backupbuddy_core::backup_prefix();
                 $backups = array();
                 foreach ($contents as $filename => $backup) {
                     // check if file is backup
                     $pos = strpos($filename, 'backup-' . $bkupprefix . '-');
                     if ($pos !== FALSE) {
                         $backups[] = array('file' => $filename, 'modified' => $backup['mtime']);
                     }
                 }
                 function backupbuddy_number_sort($a, $b)
                 {
                     return $a['modified'] < $b['modified'];
                 }
                 // Sort by modified using custom sort function above.
                 usort($backups, 'backupbuddy_number_sort');
                 if (count($backups) > $settings['archive_limit']) {
                     pb_backupbuddy::status('details', 'More backups found (' . count($backups) . ') than limit permits (' . $settings['archive_limit'] . ').' . print_r($backups, true));
                     $delete_fail_count = 0;
                     $i = 0;
                     foreach ($backups as $backup) {
                         $i++;
                         if ($i > $settings['archive_limit']) {
                             if (false === $sftp->delete($settings['path'] . '/' . $backup['file'])) {
                                 pb_backupbuddy::status('details', 'Unable to delete excess sFTP file `' . $backup['file'] . '` in path `' . $settings['path'] . '`.');
                                 $delete_fail_count++;
                             } else {
                                 pb_backupbuddy::status('details', 'Deleted excess sFTP file `' . $backup['file'] . '` in path `' . $settings['path'] . '`.');
                             }
                         }
                     }
                     if ($delete_fail_count != 0) {
                         backupbuddy_core::mail_error(sprintf(__('sFTP remote limit could not delete %s backups. Please check and verify file permissions.', 'it-l10n-backupbuddy'), $delete_fail_count));
                         pb_backupbuddy::status('error', 'Unable to delete one or more excess backup archives. File storage limit may be exceeded. Manually clean up backups and check permissions.');
                     } else {
                         pb_backupbuddy::status('details', 'No problems encountered deleting excess backups.');
                     }
                 } else {
                     pb_backupbuddy::status('details', 'Not enough backups found to exceed limit. Skipping limit enforcement.');
                 }
             } else {
                 pb_backupbuddy::status('details', 'No sFTP archive file limit to enforce.');
             }
             // End remote backup limit
         }
     }
     // end $files loop.
     // 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 #6.');
     $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.843498. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
     $fileoptions =& $fileoptions_obj->options;
     // Save stats.
     $fileoptions['write_speed'] = $total_transfer_size / $total_transfer_time;
     $fileoptions_obj->save();
     unset($fileoptions_obj);
     return true;
 }
开发者ID:elephantcode,项目名称:elephantcode,代码行数:101,代码来源:init.php

示例5: test

 public static function test($settings)
 {
     $settings = self::_init($settings);
     $sendOK = false;
     $deleteOK = false;
     $send_id = 'TEST-' . pb_backupbuddy::random_string(12);
     // Try sending a file.
     if ('1' == $settings['stash_mode']) {
         // Stash mode.
         $settings['type'] = 'stash2';
     }
     $send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id);
     // 3rd param true forces clearing of any current uploads.
     if (true === $send_response) {
         $send_response = __('Success.', 'it-l10n-backupbuddy');
         $sendOK = true;
     } else {
         global $pb_backupbuddy_destination_errors;
         $send_response = 'Error sending test file to S3 (v2). Details: `' . implode(', ', $pb_backupbuddy_destination_errors) . '`.';
     }
     pb_backupbuddy::add_status_serial('remote_send-' . $send_id);
     // Delete sent file if it was sent.
     $delete_response = 'n/a';
     if (true === $sendOK) {
         pb_backupbuddy::status('details', 'Preparing to delete sent test file.');
         if ('1' == $settings['stash_mode']) {
             // Stash mode.
             if (true === ($delete_response = pb_backupbuddy_destination_stash2::deleteFile($settings, 'remote-send-test.php'))) {
                 // success
                 $delete_response = __('Success.', 'it-l10n-backupbuddy');
                 $deleteOK = true;
             } else {
                 // error
                 $error = 'Unable to delete Stash test file `remote-send-test.php`. Details: `' . $delete_response . '`.';
                 $delete_response = $error;
                 $deleteOK = false;
             }
         } else {
             // S3 mode.
             if (true === ($delete_response = self::deleteFile($settings, 'remote-send-test.php'))) {
                 $delete_response = __('Success.', 'it-l10n-backupbuddy');
                 $deleteOK = true;
             } else {
                 $error = 'Unable to delete test file `remote-send-test.php`. Details: `' . $delete_response . '`.';
                 pb_backupbuddy::status('details', $error);
                 $delete_response = $error;
                 $deleteOK = false;
             }
         }
     } else {
         // end if $sendOK.
         pb_backupbuddy::status('details', 'Skipping test delete due to failed send.');
     }
     // 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 (true !== $sendOK || true !== $deleteOK) {
         $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);
     pb_backupbuddy::status('details', 'Finished test function.');
     return true;
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:77,代码来源:init.php

示例6: deploy_sendWait

 public function deploy_sendWait($state, $sendFile, $sendPath, $sendType, $nextStep)
 {
     $maxSendTime = 60 * 5;
     if ('' == $sendFile) {
         // File failed. Proceed to next.
         $this->insert_next_step($nextStep);
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     pb_backupbuddy::status('details', 'Fileoptions instance #38.');
     $identifier = $this->_backup['serial'] . '_' . md5($sendFile . $sendType);
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $identifier . '.txt', $read_only = false, $ignore_lock = true, $create_file = false);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034 E. 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.');
     $fileoptions =& $fileoptions_obj->options;
     // Set reference.
     if ('0' == $fileoptions['finish_time']) {
         // Not finished yet. Insert next chunk to wait.
         $timeAgo = time() - $fileoptions['start_time'];
         if ($timeAgo > $maxSendTime) {
             pb_backupbuddy::status('error', 'Error #4948348: Maximum allowed file send time of `' . $maxSendTime . '` seconds passed. Halting.');
             pb_backupbuddy::status('haltScript', '');
             // Halt JS on page.
         }
         pb_backupbuddy::status('details', 'File send not yet finished. Started `' . $timeAgo . '` seconds ago. Inserting wait.');
         $newStep = array('function' => 'deploy_sendWait', 'args' => array($state, $sendFile, $sendPath, $sendType, $nextStep), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0);
         $this->insert_next_step($newStep);
     } else {
         // Finished. Go to next step.
         $this->insert_next_step($nextStep);
     }
     return true;
 }
开发者ID:jcwproductions,项目名称:jcwproductions-blog,代码行数:37,代码来源:backup.php

示例7: array

backupbuddy_core::verifyAjaxAccess();
// Display backup integrity status.
/* integrity_status()
*
* description
*
*/
$send_id = pb_backupbuddy::_GET('send_id');
$send_di = str_replace('/\\', '', $send_id);
pb_backupbuddy::load();
pb_backupbuddy::$ui->ajax_header();
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #27.');
$optionsFile = backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt';
$send_options = new pb_backupbuddy_fileoptions($optionsFile, $read_only = true);
if (true !== ($result = $send_options->is_ok())) {
    pb_backupbuddy::alert(__('Unable to access fileoptions data file.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
    die;
}
$start_time = 'Unknown';
$finish_time = 'Unknown';
if (isset($send_options->options['start_time'])) {
    $start_time = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($send_options->options['start_time'])) . ' <span class="description">(' . pb_backupbuddy::$format->time_ago($send_options->options['start_time']) . ' ago)</span>';
    if ($send_options->options['finish_time'] > 0) {
        $finish_time = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($send_options->options['finish_time'])) . ' <span class="description">(' . pb_backupbuddy::$format->time_ago($send_options->options['finish_time']) . ' ago)</span>';
    } else {
        // unfinished.
        $finish_time = '<i>Unfinished</i>';
    }
}
$steps = array();
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:send_status.php

示例8: array

    $recentBackups_list = array();
}
if (count($recentBackups_list) == 0) {
    _e('No backups have been created recently.', 'it-l10n-backupbuddy');
} else {
    // Backup type.
    $pretty_type = array('full' => 'Full', 'db' => 'Database', 'files' => 'Files');
    // Read in list of backups.
    $recent_backup_count_cap = 5;
    // Max number of recent backups to list.
    $recentBackups = array();
    foreach ($recentBackups_list as $backup_fileoptions) {
        require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
        pb_backupbuddy::status('details', 'Fileoptions instance #1.');
        $backup = new pb_backupbuddy_fileoptions($backup_fileoptions, $read_only = true);
        if (true !== ($result = $backup->is_ok())) {
            pb_backupbuddy::status('error', __('Unable to access fileoptions data file.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
            continue;
        }
        $backup =& $backup->options;
        if (!isset($backup['serial']) || $backup['serial'] == '') {
            continue;
        }
        if ($backup['finish_time'] >= $backup['start_time'] && 0 != $backup['start_time']) {
            $status = '<span class="pb_label pb_label-success">Completed</span>';
        } elseif ($backup['finish_time'] == -1) {
            $status = '<span class="pb_label pb_label-warning">Cancelled</span>';
        } elseif (FALSE === $backup['finish_time']) {
            $status = '<span class="pb_label pb_label-error">Failed (timeout?)</span>';
        } elseif (time() - $backup['updated_time'] > backupbuddy_constants::TIME_BEFORE_CONSIDERED_TIMEOUT) {
            $status = '<span class="pb_label pb_label-error">Failed (likely timeout)</span>';
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:31,代码来源:_backup-home.php

示例9: _processSignatures

 private static function _processSignatures($type, $newFileSignatures)
 {
     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 #88.');
     $existingSignaturesObj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'live/' . $type . '-' . pb_backupbuddy::$options['log_serial'] . '.txt', $read_only = false, $ignore_lock = false, $create_file = true);
     if (true !== ($result = $existingSignaturesObj->is_ok())) {
         pb_backupbuddy::status('error', 'Error #382983. Unable to create or access fileoptions file for media. Details: `' . $result . '`.');
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
     if (!isset($existingSignaturesObj->options['signatures'])) {
         $existingSignaturesObj->options = array('signatures' => array(), 'stats' => array('totalFiles' => 0, 'needsSent' => 0, 'needsDelete' => 0));
     }
     $existingSignatures =& $existingSignaturesObj->options['signatures'];
     // Loop through local files to see if they differ from previous scan.
     pb_backupbuddy::status('details', 'Comparing new signatures with existing ones.');
     $addOrUpdateCount = 0;
     foreach ($newFileSignatures as $file => $signature) {
         $addOrUpdateFile = false;
         if (!isset($existingSignatures[$file])) {
             // This is a new file. Append to list.
             $addOrUpdateFile = true;
             $existingSignaturesObj->options['stats']['totalFiles']++;
         } else {
             // File exists on remote. See if content is the same.
             if (isset($signature['sha1']) && $signature['sha1'] != $existingSignatures[$file]['sha1']) {
                 // Hash mismatch. Needs updating.
                 $addOrUpdateFile = true;
             } elseif (!isset($signature['sha1']) || '' == $signature['sha1']) {
                 // sha1 not calculated. size may be too large. compare size to see if changed.
                 if ($signature['size'] != $existingSignatures[$file]['size']) {
                     // size mismatch
                     $addOrUpdateFile = true;
                 }
             }
         }
         // File is new and needs added to list to be sent to remote.
         if (true === $addOrUpdateFile) {
             $existingSignatures[$file] = $signature;
             $signature['added'] = time();
             // When did we first notice file?
             $signature['sent'] = false;
             // Has file been sent to Stash?
             $existingSignaturesObj->options['stats']['needsSent']++;
             pb_backupbuddy::status('details', 'New or modified file found `' . $file . '`.');
             $addOrUpdateCount++;
         }
     }
     // Loop through remote files to see if any no longer exist locally and therefore need deleted.
     $deleteCount = 0;
     foreach ($existingSignatures as $file => $signature) {
         if (!isset($newFileSignatures[$file])) {
             $existingSignatures[$file]['delete'] = true;
             $existingSignaturesObj->options['stats']['needsDelete']++;
             $existingSignaturesObj->options['stats']['totalFiles']--;
             pb_backupbuddy::status('details', 'Remote file that no longer exists locally found. Flagging `' . $file . '` for deletion.');
         }
     }
     // Save.
     pb_backupbuddy::status('details', 'Saving updated `' . $type . '` signatures... Added `' . $addOrUpdateCount . '`. Deleted `' . $deleteCount . '`. Total files: `' . $existingSignaturesObj->options['stats']['totalFiles'] . '`. Needs sent: `' . $existingSignaturesObj->options['stats']['needsSent'] . '`. Needs delete: `' . $existingSignaturesObj->options['stats']['needsDelete'] . '`.');
     $existingSignaturesObj->save();
     pb_backupbuddy::status('details', 'Signatures saved.');
     return true;
 }
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:65,代码来源:live.php

示例10: send

 public static function send($destination_settings, $file, $send_id = '', $delete_after = false)
 {
     if (is_array($file)) {
         // As of v6.1.0.1 no longer accepting multiple files to send.
         $file = $file[0];
     }
     if ('' != $send_id) {
         pb_backupbuddy::add_status_serial('remote_send-' . $send_id);
         pb_backupbuddy::status('details', '----- Initiating master send function for BackupBuddy v' . pb_backupbuddy::settings('version') . '. Post-send deletion: ' . $delete_after);
         require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
         $fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt';
         if (!file_exists($fileoptions_file)) {
             //pb_backupbuddy::status( 'details', 'Fileoptions file `' . $fileoptions_file . '` does not exist yet; creating.' );
             //pb_backupbuddy::status( 'details', 'Fileoptions instance #19.' );
             $fileoptions_obj = new pb_backupbuddy_fileoptions($fileoptions_file, $read_only = false, $ignore_lock = true, $create_file = true);
         } else {
             //pb_backupbuddy::status( 'details', 'Fileoptions file exists; loading.' );
             //pb_backupbuddy::status( 'details', 'Fileoptions instance #18.' );
             $fileoptions_obj = new pb_backupbuddy_fileoptions($fileoptions_file, $read_only = false, $ignore_lock = false, $create_file = false);
         }
         if (true !== ($result = $fileoptions_obj->is_ok())) {
             pb_backupbuddy::status('error', __('Fatal Error #9034.2344848. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
             return false;
         }
         //pb_backupbuddy::status( 'details', 'Fileoptions data loaded.' );
         $fileoptions =& $fileoptions_obj->options;
         if ('' == $fileoptions) {
             // Set defaults.
             $fileoptions = backupbuddy_core::get_remote_send_defaults();
             $fileoptions['type'] = $destination_settings['type'];
             $fileoptions['file'] = $file;
             $fileoptions['retries'] = 0;
         }
         $fileoptions['sendID'] = $send_id;
         $fileoptions['destinationSettings'] = $destination_settings;
         // always store the LATEST settings for resume info and retry function.
         $fileoptions['update_time'] = time();
         $fileoptions['deleteAfter'] = $delete_after;
         $fileoptions_obj->save();
         if (isset($fileoptions['status']) && 'aborted' == $fileoptions['status']) {
             pb_backupbuddy::status('warning', 'Destination send triggered on an ABORTED transfer. Ending send function.');
             return false;
         }
         unset($fileoptions_obj);
     }
     if (false === ($destination = self::_init_destination($destination_settings))) {
         echo '{Error #546893498a. Destination configuration file missing.}';
         if ('' != $send_id) {
             pb_backupbuddy::remove_status_serial('remote_send-' . $send_id);
         }
         return false;
     }
     $destination_settings = $destination['settings'];
     // Settings with defaults applied, normalized, etc.
     if (!file_exists($file)) {
         pb_backupbuddy::status('error', 'Error #58459458743. The file that was attempted to be sent to a remote destination, `' . $file . '`, was not found. It either does not exist or permissions prevent accessing it. Check that local backup limits are not causing it to be deleted.');
         if ('' != $send_id) {
             pb_backupbuddy::remove_status_serial('remote_send-' . $send_id);
         }
         return false;
     }
     if (!method_exists($destination['class'], 'send')) {
         pb_backupbuddy::status('error', 'Destination class `' . $destination['class'] . '` does not support send operation -- missing function.');
         if ('' != $send_id) {
             pb_backupbuddy::remove_status_serial('remote_send-' . $send_id);
         }
         return false;
     }
     global $pb_backupbuddy_destination_errors;
     $pb_backupbuddy_destination_errors = array();
     $result = call_user_func_array("{$destination['class']}::send", array($destination_settings, $file, $send_id, $delete_after));
     /* $result values:
      *		false		Transfer FAILED.
      *		true		Non-chunked transfer succeeded.
      *		array()		array(
      *						multipart_id,				// Unique string ID for multipart send. Empty string if last chunk finished sending successfully.
      *						multipart_status_message
      *					)
      */
     if ($result === false) {
         $error_details = implode('; ', $pb_backupbuddy_destination_errors);
         if ('' != $error_details) {
             $error_details = ' Details: ' . $error_details;
         }
         $log_directory = backupbuddy_core::getLogDirectory();
         $preError = 'There was an error sending to the remote destination titled `' . $destination_settings['title'] . '` of type `' . backupbuddy_core::pretty_destination_type($destination_settings['type']) . '`. One or more files may have not been fully transferred. Please see error details for additional information. If the error persists, enable full error logging and try again for full details and troubleshooting. Details: ' . "\n\n";
         $logFile = $log_directory . 'status-remote_send-' . $send_id . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
         pb_backupbuddy::status('details', 'Looking for remote send log file to send in error email: `' . $logFile . '`.');
         if (!file_exists($logFile)) {
             pb_backupbuddy::status('details', 'Remote send log file not found.');
             backupbuddy_core::mail_error($preError . $error_details);
         } else {
             // Log exists. Attach.
             pb_backupbuddy::status('details', 'Remote send log file found. Attaching to error email.');
             backupbuddy_core::mail_error($preError . $error_details . "\n\nSee the attached log for details.", '', array($logFile));
         }
         // Save error details into fileoptions for this send.
         //pb_backupbuddy::status( 'details', 'About to load fileoptions data.' );
         require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
         pb_backupbuddy::status('details', 'Fileoptions instance #45.');
//.........这里部分代码省略.........
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:101,代码来源:bootstrap.php

示例11: process_timed_out_sends

 public static function process_timed_out_sends()
 {
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     // Mark any timed out remote sends as timed out. Attempt resend once.
     $remote_sends = array();
     $send_fileoptions = pb_backupbuddy::$filesystem->glob_by_date(backupbuddy_core::getLogDirectory() . 'fileoptions/send-*.txt');
     if (!is_array($send_fileoptions)) {
         $send_fileoptions = array();
     }
     foreach ($send_fileoptions as $send_fileoption) {
         $send_id = str_replace('.txt', '', str_replace('send-', '', basename($send_fileoption)));
         pb_backupbuddy::status('details', 'About to load fileoptions data.');
         require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
         pb_backupbuddy::status('details', 'Fileoptions instance #23.');
         $fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt';
         $fileoptions_obj = new pb_backupbuddy_fileoptions($fileoptions_file, $read_only = false, $ignore_lock = false, $create_file = false);
         if (true !== ($result = $fileoptions_obj->is_ok())) {
             pb_backupbuddy::status('error', __('Fatal Error #9034.3224442393. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
             return false;
         }
         // Corrupt fileoptions file. Remove.
         if (!isset($fileoptions_obj->options['start_time'])) {
             unset($fileoptions_obj);
             @unlink($fileoptions_file);
             continue;
         }
         // Finish time not set. Shouldn't happen buuuuut.... skip.
         if (!isset($fileoptions_obj->options['finish_time'])) {
             continue;
         }
         // Don't do anything for success, failure, or already-marked as -1 finish time.
         if ('success' == $fileoptions_obj->options['status'] || 'failure' == $fileoptions_obj->options['status'] || -1 == $fileoptions_obj->options['finish_time']) {
             continue;
         }
         // Older format did not include updated_time.
         if (!isset($fileoptions_obj->options['update_time'])) {
             continue;
         }
         $secondsAgo = time() - $fileoptions_obj->options['update_time'];
         if ($secondsAgo > backupbuddy_constants::TIME_BEFORE_CONSIDERED_TIMEOUT) {
             // If 24hrs passed since last update to backup then mark this timeout as failed.
             // Potentially try to resend if not a live_periodic transfer.
             if ('live_periodic' != $fileoptions_obj->options['trigger']) {
                 $isResending = backupbuddy_core::remoteSendRetry($fileoptions_obj, $send_id, pb_backupbuddy::$options['remote_send_timeout_retries']);
                 if (true === $isResending) {
                     // If resending then skip sending any error email just yet...
                     continue;
                 }
                 if ('timeout' != $fileoptions_obj->options['status']) {
                     // Do not send email if status is 'timeout' since either already sent or old-style status marking (pre-v6.0).
                     // Calculate destination title and type for error email.
                     $destination_title = '';
                     $destination_type = '';
                     if (isset(pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']])) {
                         $destination_title = pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']]['title'];
                         $destination_type = backupbuddy_core::pretty_destination_type(pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']]['type']);
                     }
                     $error_message = 'A remote destination send of file `' . basename($fileoptions_obj->options['file']) . '` started `' . pb_backupbuddy::$format->time_ago($fileoptions_obj->options['start_time']) . '` ago sending to the destination titled `' . $destination_title . '` of type `' . $destination_type . '` likely timed out. BackupBuddy will attempt to retry this failed transfer ONCE. If the second atempt succeeds the failed attempt will be replaced in the recent sends list. Check the error log for further details and/or manually send a backup to test for problems.';
                     pb_backupbuddy::status('error', $error_message);
                     if ($secondsAgo < backupbuddy_constants::CLEANUP_MAX_AGE_TO_NOTIFY_TIMEOUT) {
                         // Prevents very old timed out backups from triggering email send.
                         backupbuddy_core::mail_error($error_message);
                     }
                 }
             }
             // Save as timed out.
             $fileoptions_obj->options['status'] = 'timeout';
             $fileoptions_obj->options['finish_time'] = -1;
             $fileoptions_obj->save();
             // If live_periofic then just try to delete the file at this point.
             if ('live_periodic' == $fileoptions_obj->options['trigger']) {
                 unset($fileoptions_obj);
                 @unlink($fileoptions_file);
                 continue;
             }
         }
         unset($fileoptions_obj);
     }
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:79,代码来源:housekeeping.php

示例12: _load_tables

 private static function _load_tables($force_reload = false, $get_contents_only = false)
 {
     if (is_object(self::$_tablesObj) && true !== $force_reload) {
         return self::$_tablesObj;
     }
     if (true === $force_reload) {
         unset(self::$_tablesObj);
     }
     $read_only = false;
     $ignore_lock = self::_fileoptions_lock_ignore_timeout_value();
     if (true === $get_contents_only) {
         $read_only = true;
         $ignore_lock = false;
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     $tablesObj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'live/tables-' . pb_backupbuddy::$options['log_serial'] . '.txt', $read_only, $ignore_lock, $create_file = true, $live_mode = true);
     if (true !== ($result = $tablesObj->is_ok())) {
         pb_backupbuddy::status('error', 'Error #435554390. Unable to create or access fileoptions file. Details: `' . $result . '`. Waiting a moment before ending.');
         sleep(3);
         // Wait a moment to give time for temporary issues to resolve.
         return false;
     }
     // Set defaults.
     if (!is_array($tablesObj->options)) {
         $tablesObj->options = array();
     }
     // Getting contents only.
     if (true === $get_contents_only) {
         return $tablesObj->options;
     }
     // Set class variables with references to object and options within.
     self::$_tablesObj =& $tablesObj;
     self::$_tables =& $tablesObj->options;
     return true;
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:35,代码来源:live_periodic.php

示例13: send

 public static function send($destination_settings, $files, $send_id = '')
 {
     if ('' != $send_id) {
         pb_backupbuddy::add_status_serial('remote_send-' . $send_id);
         pb_backupbuddy::status('details', '----- Initiating master send function.');
         require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
         $fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt';
         if (!file_exists($fileoptions_file)) {
             pb_backupbuddy::status('details', 'Fileoptions file `' . $fileoptions_file . '` does not exist yet; creating.');
             $fileoptions_obj = new pb_backupbuddy_fileoptions($fileoptions_file, $read_only = false, $ignore_lock = true, $create_file = true);
         } else {
             pb_backupbuddy::status('details', 'Fileoptions file exists; loading.');
             $fileoptions_obj = new pb_backupbuddy_fileoptions($fileoptions_file, $read_only = false, $ignore_lock = false, $create_file = false);
         }
         if (true !== ($result = $fileoptions_obj->is_ok())) {
             pb_backupbuddy::status('error', __('Fatal Error #9034.2344848. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
             return false;
         }
         pb_backupbuddy::status('details', 'Fileoptions data loaded.');
         $fileoptions =& $fileoptions_obj->options;
         if ('' == $fileoptions) {
             $fileoptions = backupbuddy_core::get_remote_send_defaults();
             $fileoptions['type'] = $destination_settings['type'];
             if (!is_array($files)) {
                 $fileoptions['file'] = $files;
             } else {
                 $fileoptions['file'] = $files[0];
             }
             $fileoptions_obj->save();
         }
         if (isset($fileoptions['status']) && 'aborted' == $fileoptions['status']) {
             pb_backupbuddy::status('warning', 'Destination send triggered on an ABORTED transfer. Ending send function.');
             return false;
         }
         unset($fileoptions_obj);
     }
     if (false === ($destination = self::_init_destination($destination_settings))) {
         echo '{Error #546893498a. Destination configuration file missing.}';
         if ('' != $send_id) {
             pb_backupbuddy::remove_status_serial('remote_send-' . $send_id);
         }
         return false;
     }
     $destination_settings = $destination['settings'];
     // Settings with defaults applied, normalized, etc.
     //$destination_info = $destination['info'];
     if (!is_array($files)) {
         $files = array($files);
     }
     $files_with_sizes = '';
     foreach ($files as $index => $file) {
         if ('' == $file) {
             unset($files[$index]);
             continue;
             // Not actually a file to send.
         }
         if (!file_exists($file)) {
             pb_backupbuddy::status('error', 'Error #58459458743. The file that was attempted to be sent to a remote destination, `' . $file . '`, was not found. It either does not exist or permissions prevent accessing it.');
             if ('' != $send_id) {
                 pb_backupbuddy::remove_status_serial('remote_send-' . $send_id);
             }
             return false;
         }
         $files_with_sizes .= $file . ' (' . pb_backupbuddy::$format->file_size(filesize($file)) . '); ';
     }
     pb_backupbuddy::status('details', 'Sending files `' . $files_with_sizes . '` to destination type `' . $destination_settings['type'] . '` titled `' . $destination_settings['title'] . '`.');
     unset($files_with_sizes);
     if (!method_exists($destination['class'], 'send')) {
         pb_backupbuddy::status('error', 'Destination class `' . $destination['class'] . '` does not support send operation -- missing function.');
         if ('' != $send_id) {
             pb_backupbuddy::remove_status_serial('remote_send-' . $send_id);
         }
         return false;
     }
     pb_backupbuddy::status('details', 'Calling send function.');
     //$result = $destination_class::send( $destination_settings, $files );
     global $pb_backupbuddy_destination_errors;
     $pb_backupbuddy_destination_errors = array();
     $result = call_user_func_array("{$destination['class']}::send", array($destination_settings, $files, $send_id));
     if ($result === false) {
         $error_details = implode('; ', $pb_backupbuddy_destination_errors);
         backupbuddy_core::mail_error('There was an error sending to the remote destination. One or more files may have not been fully transferred. Please see error details for additional information. If the error persists, enable full error logging and try again for full details and troubleshooting. Details: ' . "\n\n" . $error_details);
     }
     if (is_array($result)) {
         // Send is multipart.
         pb_backupbuddy::status('details', 'Completed send function. Multipart chunk mode. Result: `' . print_r($result, true) . '`.');
         if ('' != $send_id) {
             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 !== ($fileoptions_result = $fileoptions_obj->is_ok())) {
                 pb_backupbuddy::status('error', __('Fatal Error #9034.387462. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $fileoptions_result);
                 return false;
             }
             pb_backupbuddy::status('details', 'Fileoptions data loaded.');
             $fileoptions =& $fileoptions_obj->options;
             $fileoptions['_multipart_status'] = $result[1];
             pb_backupbuddy::status('details', 'Destination debugging details: `' . print_r($fileoptions, true) . '`.');
             $fileoptions_obj->save();
             unset($fileoptions_obj);
//.........这里部分代码省略.........
开发者ID:FelixNong1990,项目名称:andy,代码行数:101,代码来源:bootstrap.php

示例14: test

 public static function test($settings)
 {
     if ($settings['address'] == '' || $settings['username'] == '' || $settings['password'] == '') {
         return __('Missing required input.', 'it-l10n-backupbuddy');
     }
     // 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 FTP.';
     } else {
         $send_response = 'Success.';
     }
     // Now we will need to go and cleanup this potentially uploaded file.
     $delete_response = 'Error deleting test file from FTP.';
     // Default.
     // Settings.
     $server = $settings['address'];
     $username = $settings['username'];
     $password = $settings['password'];
     $path = $settings['path'];
     $ftps = $settings['ftps'];
     if ($settings['active_mode'] == '0') {
         $active_mode = false;
     } else {
         $active_mode = true;
     }
     $url = $settings['url'];
     // optional url for using with migration.
     $port = '21';
     if (strstr($server, ':')) {
         $server_params = explode(':', $server);
         $server = $server_params[0];
         $port = $server_params[1];
     }
     // Connect.
     if ($ftps == '0') {
         $conn_id = @ftp_connect($server, $port, 10);
         // timeout of 10 seconds.
         if ($conn_id === false) {
             $error = __('Unable to connect to FTP address `' . $server . '` on port `' . $port . '`.', 'it-l10n-backupbuddy');
             $error .= "\n" . __('Verify the server address and port (default 21). Verify your host allows outgoing FTP connections.', 'it-l10n-backupbuddy');
             return $send_response . ' ' . $error;
         }
     } else {
         if (function_exists('ftp_ssl_connect')) {
             $conn_id = @ftp_ssl_connect($server, $port);
             if ($conn_id === false) {
                 return $send_response . ' ' . __('Destination server does not support FTPS?', 'it-l10n-backupbuddy');
             }
         } else {
             return $send_response . ' ' . __('Your web server doesnt support FTPS.', 'it-l10n-backupbuddy');
         }
     }
     $login_result = @ftp_login($conn_id, $username, $password);
     if (!$conn_id || !$login_result) {
         pb_backupbuddy::status('details', 'FTP test: Invalid user/pass.');
         $response = __('Unable to login. Bad user/pass.', 'it-l10n-backupbuddy');
         if ($ftps != '0') {
             $response .= "\n\nNote: You have FTPs enabled. You may get this error if your host does not support encryption at this address/port.";
         }
         return $send_response . ' ' . $response;
     }
     pb_backupbuddy::status('details', 'FTP test: Success logging in.');
     // Handle active/pasive mode.
     if ($active_mode === true) {
         // do nothing, active is default.
         pb_backupbuddy::status('details', 'Active FTP mode based on settings.');
     } elseif ($active_mode === false) {
         // Turn passive mode on.
         pb_backupbuddy::status('details', 'Passive FTP mode based on settings.');
         ftp_pasv($conn_id, true);
     } else {
         pb_backupbuddy::status('error', 'Unknown FTP active/passive mode: `' . $active_mode . '`.');
     }
     // Delete test file.
     pb_backupbuddy::status('details', 'FTP test: Deleting temp test file.');
     if (true === ftp_delete($conn_id, $path . '/remote-send-test.php')) {
         $delete_response = 'Success.';
     }
     // Close FTP connection.
     pb_backupbuddy::status('details', 'FTP test: Closing FTP connection.');
     @ftp_close($conn_id);
     // 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 #12.');
     $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.72373. 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 {
//.........这里部分代码省略.........
开发者ID:ryankrieg,项目名称:wordpress-base,代码行数:101,代码来源:init.php

示例15: 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;
 }
开发者ID:shelbyneilsmith,项目名称:wptools,代码行数:42,代码来源:init.php


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