本文整理汇总了PHP中pb_backupbuddy_destinations::multipart_cleanup方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy_destinations::multipart_cleanup方法的具体用法?PHP pb_backupbuddy_destinations::multipart_cleanup怎么用?PHP pb_backupbuddy_destinations::multipart_cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy_destinations
的用法示例。
在下文中一共展示了pb_backupbuddy_destinations::multipart_cleanup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
示例2: 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) {
示例3: 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.');
}
}
}