mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
Revert "Fixed broken file_write() function"
This reverts commit 4a65e1af02
.
This commit is contained in:
parent
56fb344f46
commit
6a4ee4e238
1 changed files with 12 additions and 12 deletions
24
common.php
24
common.php
|
@ -253,19 +253,19 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
|
||||||
rename($file, $new_name);
|
rename($file, $new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (file_exists($file) && $dir_created = bb_mkdir(dirname($file))) {
|
||||||
if (bb_mkdir(dirname($file))) {
|
$fp = fopen($file, 'ab+');
|
||||||
if ($fp = fopen($file, 'ab+')) {
|
}
|
||||||
if ($lock) {
|
if (isset($fp)) {
|
||||||
flock($fp, LOCK_EX);
|
if ($lock) {
|
||||||
}
|
flock($fp, LOCK_EX);
|
||||||
if ($replace_content) {
|
|
||||||
ftruncate($fp, 0);
|
|
||||||
fseek($fp, 0, SEEK_SET);
|
|
||||||
}
|
|
||||||
$bytes_written = fwrite($fp, $str);
|
|
||||||
fclose($fp);
|
|
||||||
}
|
}
|
||||||
|
if ($replace_content) {
|
||||||
|
ftruncate($fp, 0);
|
||||||
|
fseek($fp, 0, SEEK_SET);
|
||||||
|
}
|
||||||
|
$bytes_written = fwrite($fp, $str);
|
||||||
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bytes_written;
|
return $bytes_written;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue