Some reported bugfixes (#1275)

* Some reported bugfixes

* Updated

* Update common.php

* Update BBCode.php
This commit is contained in:
Roman Kelesidis 2023-12-27 12:15:43 +07:00 committed by GitHub
commit e8a90b025c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 31 deletions

View file

@ -190,11 +190,11 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
$bytes_written = false;
clearstatcache();
if (($max_size && file_exists($file) && is_file($file)) && filesize($file) >= $max_size) {
if (is_file($file) && ($max_size && filesize($file) >= $max_size)) {
$file_parts = pathinfo($file);
$new_name = ($file_parts['dirname'] . '/' . $file_parts['filename'] . '_[old]_' . date('Y-m-d_H-i-s_') . getmypid() . '.' . $file_parts['extension']);
clearstatcache();
if (!file_exists($new_name) && !is_file($new_name)) {
if (!is_file($new_name)) {
rename($file, $new_name);
}
}
@ -269,6 +269,7 @@ function str_compact($str)
*
* @param int $length
* @return string
* @throws Exception
*/
function make_rand_str(int $length = 10): string
{