Revert "Fixed broken file_write() function"

This reverts commit 4a65e1af02.
This commit is contained in:
Roman Kelesidis 2023-03-09 16:24:32 +07:00
commit 6a4ee4e238

View file

@ -253,9 +253,10 @@ 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 (isset($fp)) {
if ($lock) { if ($lock) {
flock($fp, LOCK_EX); flock($fp, LOCK_EX);
} }
@ -266,7 +267,6 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
$bytes_written = fwrite($fp, $str); $bytes_written = fwrite($fp, $str);
fclose($fp); fclose($fp);
} }
}
return $bytes_written; return $bytes_written;
} }