本文整理汇总了PHP中backupbuddy_core::prettyFunctionTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::prettyFunctionTitle方法的具体用法?PHP backupbuddy_core::prettyFunctionTitle怎么用?PHP backupbuddy_core::prettyFunctionTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::prettyFunctionTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
// 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'] = microtime(true) - $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'])) {
示例2: process_backup
//.........这里部分代码省略.........
// Step flagged for skipping. Do not run.
pb_backupbuddy::status('details', 'Step `' . $step['function'] . '` flagged for skipping. Skipping.');
} else {
// Last case: Finished. Skip.
// Do nothing for completed steps.
//pb_backupbuddy::status( 'details', 'Step `' . $step['function'] . '` doing nothing with start `' . $step['start_time'] . '`.' );
}
}
// End foreach().
if ($found_next_step === false) {
// No more steps to perform; return.
pb_backupbuddy::status('details', 'No more steps found.');
return false;
}
//pb_backupbuddy::save();
pb_backupbuddy::status('details', __('Peak memory usage', 'it-l10n-backupbuddy') . ': ' . round(memory_get_peak_usage() / 1048576, 3) . ' MB');
/********* Begin Running Step Function **********/
if (method_exists($this, $step['function'])) {
/*
$args = '';
foreach( $step['args'] as $arg ) {
if ( is_array( $arg ) ) {
$args .= '{' . implode( ',', $arg ) . '},';
} else {
$args .= str_replace('],[', '|', trim(json_encode($step['args']), '[]'));
}
}
*/
pb_backupbuddy::status('details', '-----');
pb_backupbuddy::status('details', 'Starting step function `' . $step['function'] . '`. Attempt #' . ($step['attempts'] + 1) . '.');
// attempts 0-indexed.
$functionTitle = $step['function'];
$subFunctionTitle = '';
$functionTitle = backupbuddy_core::prettyFunctionTitle($step['function'], $step['args']);
pb_backupbuddy::status('startFunction', json_encode(array('function' => $step['function'], 'title' => $functionTitle)));
if ('' != $subFunctionTitle) {
pb_backupbuddy::status('startSubFunction', json_encode(array('function' => $step['function'] . '_subfunctiontitle', 'title' => $subFunctionTitle)));
}
$response = call_user_func_array(array(&$this, $step['function']), $step['args']);
} else {
pb_backupbuddy::status('error', __('Error #82783745: Invalid function `' . $step['function'] . '`'));
$response = false;
}
/********* End Running Step Function **********/
//unset( $step );
if ($response === false) {
// Function finished but reported failure.
// Failure caused by backup cancellation.
if (true == get_transient('pb_backupbuddy_stop_backup-' . $serial)) {
pb_backupbuddy::status('haltScript', '');
// Halt JS on page.
return false;
}
pb_backupbuddy::status('error', 'Failed function `' . $this->_backup['steps'][$step_index]['function'] . '`. Backup terminated.');
pb_backupbuddy::status('errorFunction', $this->_backup['steps'][$step_index]['function']);
pb_backupbuddy::status('details', __('Peak memory usage', 'it-l10n-backupbuddy') . ': ' . round(memory_get_peak_usage() / 1048576, 3) . ' MB');
pb_backupbuddy::status('haltScript', '');
// Halt JS on page.
$args = print_r($this->_backup['steps'][$step_index]['args'], true);
$attachment = NULL;
$attachment_note = 'Enable full logging for troubleshooting (a log will be sent with future error emails while enabled).';
if (pb_backupbuddy::$options['log_level'] == '3') {
// Full logging enabled.
// Log file will be attached.
$log_file = backupbuddy_core::getLogDirectory() . 'status-' . $serial . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
if (file_exists($log_file)) {
示例3: 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());
}