mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Fixed broken file_write function (#736)
This commit is contained in:
parent
8f2150a986
commit
68ee788d32
42 changed files with 51 additions and 7 deletions
17
common.php
17
common.php
|
@ -212,19 +212,22 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
|
|||
{
|
||||
$bytes_written = false;
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if ($max_size && file_exists($file) && filesize($file) >= $max_size) {
|
||||
$old_name = $file;
|
||||
$ext = '';
|
||||
if (preg_match('#^(.+)(\.[^\\\/]+)$#', $file, $matches)) {
|
||||
[$old_name, $ext] = $matches;
|
||||
}
|
||||
$new_name = $old_name . '_[old]_' . date('Y-m-d_H-i-s_') . getmypid() . $ext;
|
||||
$file_parts = pathinfo($file);
|
||||
$new_name = ($file_parts['filename'] . '_[old]_' . date('Y-m-d_H-i-s_') . getmypid() . '.' . $file_parts['extension']);
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if (!file_exists($new_name)) {
|
||||
rename($file, $new_name);
|
||||
}
|
||||
}
|
||||
if (!file_exists($file) && $dir_created = bb_mkdir(dirname($file))) {
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if (!file_exists($file) && bb_mkdir(dirname($file))) {
|
||||
$fp = fopen($file, 'ab+');
|
||||
}
|
||||
if (isset($fp)) {
|
||||
|
|
1
test_[old]_2023-05-29_12-43-14_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-14_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-15_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-15_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-16_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-16_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-17_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-17_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-18_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-18_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-19_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-19_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-20_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-20_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-21_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-21_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-22_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-22_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-23_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-23_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-24_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-24_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-25_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-25_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-26_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-26_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-27_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-27_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-28_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-28_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-29_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-29_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-30_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-30_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-31_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-31_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-32_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-32_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-33_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-33_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-34_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-34_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-35_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-35_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-36_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-36_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-37_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-37_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-38_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-38_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-39_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-39_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-40_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-40_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-41_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-41_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-42_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-42_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-43_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-43_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-44_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-44_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-45_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-45_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-46_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-46_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-47_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-47_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-48_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-48_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-49_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-49_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-50_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-50_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-51_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-51_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-52_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-52_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-53_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-53_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
1
test_[old]_2023-05-29_12-43-54_8080.txt
Normal file
1
test_[old]_2023-05-29_12-43-54_8080.txt
Normal file
|
@ -0,0 +1 @@
|
|||
111111111111
|
Loading…
Add table
Add a link
Reference in a new issue