mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
parent
cbf0771e21
commit
b63e125172
@ -10,7 +10,7 @@
|
||||
- Corrected translations [\#183](https://github.com/torrentpier/torrentpier-lts/pull/183) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Fixed $bb_cfg['pm_days_keep'] [\#180](https://github.com/torrentpier/torrentpier-lts/pull/180) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- IP storage bugfix [\#177](https://github.com/torrentpier/torrentpier-lts/pull/177) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#172](https://github.com/torrentpier/torrentpier-lts/pull/172), [\#175](https://github.com/torrentpier/torrentpier-lts/pull/175), [\#176](https://github.com/torrentpier/torrentpier-lts/pull/176), [\#178](https://github.com/torrentpier/torrentpier-lts/pull/178), [\#179](https://github.com/torrentpier/torrentpier-lts/pull/179), [\#181](https://github.com/torrentpier/torrentpier-lts/pull/181), [\#187](https://github.com/torrentpier/torrentpier-lts/pull/187), [\#192](https://github.com/torrentpier/torrentpier-lts/pull/192), [\#194](https://github.com/torrentpier/torrentpier-lts/pull/194) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#172](https://github.com/torrentpier/torrentpier-lts/pull/172), [\#175](https://github.com/torrentpier/torrentpier-lts/pull/175), [\#176](https://github.com/torrentpier/torrentpier-lts/pull/176), [\#178](https://github.com/torrentpier/torrentpier-lts/pull/178), [\#179](https://github.com/torrentpier/torrentpier-lts/pull/179), [\#181](https://github.com/torrentpier/torrentpier-lts/pull/181), [\#187](https://github.com/torrentpier/torrentpier-lts/pull/187), [\#192](https://github.com/torrentpier/torrentpier-lts/pull/192), [\#194](https://github.com/torrentpier/torrentpier-lts/pull/194), [\#195](https://github.com/torrentpier/torrentpier-lts/pull/195) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Fixed empty user search box [\#171](https://github.com/torrentpier/torrentpier-lts/pull/171) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added some placeholders for input fields [\#173](https://github.com/torrentpier/torrentpier-lts/pull/173) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
||||
|
37
common.php
37
common.php
@ -199,46 +199,35 @@ function bb_log ($msg, $file_name)
|
||||
function file_write ($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replace_content = false)
|
||||
{
|
||||
$bytes_written = false;
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if ($max_size && @file_exists($file) && !is_dir($file) && (@filesize($file) >= $max_size))
|
||||
if (($max_size && file_exists($file) && is_file($file)) && filesize($file) >= $max_size)
|
||||
{
|
||||
$old_name = $file; $ext = '';
|
||||
if (preg_match('#^(.+)(\.[^\\\/]+)$#', $file, $matches))
|
||||
{
|
||||
$old_name = $matches[1]; $ext = $matches[2];
|
||||
}
|
||||
$new_name = $old_name .'_[old]_'. date('Y-m-d_H-i-s_') . getmypid() . $ext;
|
||||
$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($file) && !is_dir($file) && (@filesize($file) >= $max_size) && !@file_exists($new_name))
|
||||
if (!file_exists($new_name) && !is_file($new_name))
|
||||
{
|
||||
@rename($file, $new_name);
|
||||
rename($file, $new_name);
|
||||
}
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if (!$fp = @fopen($file, 'ab'))
|
||||
if (bb_mkdir(dirname($file)))
|
||||
{
|
||||
if ($dir_created = bb_mkdir(dirname($file)))
|
||||
{
|
||||
$fp = @fopen($file, 'ab');
|
||||
}
|
||||
}
|
||||
if ($fp)
|
||||
if ($fp = fopen($file, 'ab+'))
|
||||
{
|
||||
if ($lock)
|
||||
{
|
||||
@flock($fp, LOCK_EX);
|
||||
flock($fp, LOCK_EX);
|
||||
}
|
||||
if ($replace_content)
|
||||
{
|
||||
@ftruncate($fp, 0);
|
||||
@fseek($fp, 0, SEEK_SET);
|
||||
ftruncate($fp, 0);
|
||||
fseek($fp, 0, SEEK_SET);
|
||||
}
|
||||
$bytes_written = fwrite($fp, $str);
|
||||
fclose($fp);
|
||||
}
|
||||
$bytes_written = @fwrite($fp, $str);
|
||||
@fclose($fp);
|
||||
}
|
||||
|
||||
return $bytes_written;
|
||||
|
Loading…
Reference in New Issue
Block a user