Skip to content

Commit 0cbedac

Browse files
committed
Bug-fix.
Changelog excerpt: - Log truncation not being calculated properly; Fixed.
1 parent f519c10 commit 0cbedac

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
4141
[2021.03.11; Maikuolan]: Added some missing return type declarations.
4242

4343
[2021.04.27; Maikuolan]: Removed the default username/password tip from the front-end login page.
44+
45+
[2021.05.01; Bug-fix; Maikuolan]: Log truncation not being calculated properly; Fixed.

src/FrontEnd.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: Front-end handler (last modified: 2021.04.27).
11+
* This file: Front-end handler (last modified: 2021.05.01).
1212
*/
1313

1414
namespace phpMussel\FrontEnd;
@@ -2306,11 +2306,8 @@ private function frontendLogger(string $IPAddr, string $User, string $Message):
23062306
$Data = $this->Loader->Configuration['legal']['pseudonymise_ip_addresses'] ? $this->Loader->pseudonymiseIP($IPAddr) : $IPAddr;
23072307
$Data .= ' - ' . $this->Loader->timeFormat($this->Loader->Time, $this->Loader->Configuration['core']['time_format']) . ' - "' . $User . '" - ' . $Message . "\n";
23082308

2309-
$WriteMode = (!file_exists($File) || (
2310-
$this->Loader->Configuration['core']['truncate'] > 0 &&
2311-
filesize($File) >= $this->Loader->readBytes($this->Loader->Configuration['core']['truncate'])
2312-
)) ? 'wb' : 'ab';
2313-
2309+
$Truncate = $this->Loader->readBytes($this->Loader->Configuration['core']['truncate']);
2310+
$WriteMode = (!file_exists($File) || ($Truncate > 0 && filesize($File) >= $Truncate)) ? 'wb' : 'ab';
23142311
$Handle = fopen($File, $WriteMode);
23152312
fwrite($Handle, $Data);
23162313
fclose($Handle);

0 commit comments

Comments
 (0)