Update storage.php
This commit is contained in:
parent
4dc7b9f6ad
commit
f35cdeb3a0
|
@ -333,6 +333,21 @@ if(!is_fn("write_storage_file")) {
|
|||
if($mode == "fake") {
|
||||
$result = $upload_filename;
|
||||
} elseif($fhandle = fopen($upload_filename, $mode)) {
|
||||
// if it is append, check the `rotate_size` option
|
||||
if($mode == "a") {
|
||||
$log_rotate_size = intval(get_value_in_array("log_rotate_size", $options, 0));
|
||||
$log_rotate_ratio = floatval(get_value_in_array("log_rotate_ratio", $options, 0.9));
|
||||
$log_size_limit = floor($log_rotate_size * $log_rotate_ratio);
|
||||
if($log_rotate_size > 0) {
|
||||
if($log_rotate_size > filesize($upload_filename)) {
|
||||
if(loadHelper("exectool")) {
|
||||
exec_command(sprintf("tail -c %s '%s' > '%s'", $log_size_limit, $upload_filename, $upload_filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write a file
|
||||
if(fwrite($fhandle, $data)) {
|
||||
$result = $upload_filename;
|
||||
if(!array_key_empty("chmod", $options)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user