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


PHP backupbuddy_core::truncate_file_beginning方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:22,代码来源:housekeeping.php

示例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);
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:7,代码来源:live_periodic.php


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