Minor improvements (#769)

This commit is contained in:
Roman Kelesidis 2023-06-05 13:52:34 +07:00 committed by GitHub
commit 2c1cb6d703
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -226,7 +226,7 @@ function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replac
} }
clearstatcache(); clearstatcache();
if (bb_mkdir(dirname($file))) { if (bb_mkdir(dirname($file))) {
$fp = fopen($file, 'ab+'); if ($fp = fopen($file, 'ab+')) {
if ($lock) { if ($lock) {
flock($fp, LOCK_EX); flock($fp, LOCK_EX);
} }
@ -237,6 +237,7 @@ 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;
} }
@ -269,16 +270,6 @@ function clean_filename($fname)
return str_replace($s, '_', str_compact($fname)); return str_replace($s, '_', str_compact($fname));
} }
function bb_crc32($str)
{
return (float)sprintf('%u', crc32($str));
}
function hexhex($value)
{
return dechex(hexdec($value));
}
/** /**
* @param string $str * @param string $str
* @return string * @return string