本文整理汇总了PHP中backupbuddy_core::truncate_file_beginning方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::truncate_file_beginning方法的具体用法?PHP backupbuddy_core::truncate_file_beginning怎么用?PHP backupbuddy_core::truncate_file_beginning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::truncate_file_beginning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: purge_large_logs
public static function purge_large_logs()
{
$max_site_log_size = pb_backupbuddy::$options['max_site_log_size'] * 1024 * 1024;
// in bytes.
$max_log_size_skip_truncate = 10;
// If log file exceeds this site then simply unlink since it may be too large to trunace. In MB.
// Purge site-wide log if over certain size.
$files = glob(backupbuddy_core::getLogDirectory() . '*.txt');
if (!is_array($files)) {
$files = array();
}
foreach ($files as $file) {
if (($size = filesize($file)) > $max_log_size_skip_truncate * 1024 * 1024) {
pb_backupbuddy::status('warning', 'Warning #389349843: Log file `' . $file . '` was too large `' . $size . ' bytes` to truncate (max: `' . $max_log_size_skip_truncate . '`MB) so it was unlinked.');
if (false === @unlink($file)) {
pb_backupbuddy::status('error', 'Error #438934843: Log file `' . $file . '` was too large `' . $size . ' bytes` to truncate (max: `' . $max_log_size_skip_truncate . '`MB) BUT it could not be unlinked/deleted! Manually delete this file.');
}
} else {
backupbuddy_core::truncate_file_beginning($file, $max_site_log_size);
}
}
}
示例2: _truncate_log
private static function _truncate_log()
{
// Truncate large log.
$sumLogFile = backupbuddy_core::getLogDirectory() . 'status-live_periodic_' . pb_backupbuddy::$options['log_serial'] . '.txt';
$max_log_size = pb_backupbuddy::$options['max_site_log_size'] * 1024 * 1024;
backupbuddy_core::truncate_file_beginning($sumLogFile, $max_log_size, 50);
}