mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Minor fixes (#103)
This commit is contained in:
parent
da382c3520
commit
584cf6784b
@ -192,7 +192,9 @@ function file_write ($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $repla
|
|||||||
{
|
{
|
||||||
$bytes_written = false;
|
$bytes_written = false;
|
||||||
|
|
||||||
if ($max_size && @filesize($file) >= $max_size)
|
clearstatcache();
|
||||||
|
|
||||||
|
if ($max_size && @file_exists($file) && !is_dir($file) && (@filesize($file) >= $max_size))
|
||||||
{
|
{
|
||||||
$old_name = $file; $ext = '';
|
$old_name = $file; $ext = '';
|
||||||
if (preg_match('#^(.+)(\.[^\\\/]+)$#', $file, $matches))
|
if (preg_match('#^(.+)(\.[^\\\/]+)$#', $file, $matches))
|
||||||
@ -201,11 +203,14 @@ function file_write ($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $repla
|
|||||||
}
|
}
|
||||||
$new_name = $old_name .'_[old]_'. date('Y-m-d_H-i-s_') . getmypid() . $ext;
|
$new_name = $old_name .'_[old]_'. date('Y-m-d_H-i-s_') . getmypid() . $ext;
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
if (@file_exists($file) && @filesize($file) >= $max_size && !@file_exists($new_name))
|
if (@file_exists($file) && !is_dir($file) && (@filesize($file) >= $max_size) && !@file_exists($new_name))
|
||||||
{
|
{
|
||||||
@rename($file, $new_name);
|
@rename($file, $new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
if (!$fp = @fopen($file, 'ab'))
|
if (!$fp = @fopen($file, 'ab'))
|
||||||
{
|
{
|
||||||
if ($dir_created = bb_mkdir(dirname($file)))
|
if ($dir_created = bb_mkdir(dirname($file)))
|
||||||
|
@ -59,7 +59,7 @@ switch ($mode)
|
|||||||
|
|
||||||
if (!is_file($bb_cfg['sphinx_config_path'].".log"))
|
if (!is_file($bb_cfg['sphinx_config_path'].".log"))
|
||||||
{
|
{
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", "####Logger from dimka3210.####".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
|
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
|
||||||
|
Loading…
Reference in New Issue
Block a user