LogFilesService
in package
implements
LogFilesServiceInterface
Class LogFilesService
Interfaces, Classes and Traits
- LogFilesServiceInterface
- Interface LogFilesServiceInterface
Table of Contents
- $blacklist : array<string|int, mixed>
- $root : string
- $threshold : int
- __construct() : mixed
- LogFilesService constructor.
- deleteOldLogFiles() : array<string|int, string>
- Returns the deleted log files.
- _isBlacklisted() : bool
- Checks and returns true if given file is blacklisted.
- _isNotDeprecated() : bool
- Checks and returns true if given file is NOT deprecated (Never than $threshold days).
Properties
$blacklist
protected
array<string|int, mixed>
$blacklist
= ['.', '..']
$root
protected
string
$root
$threshold
protected
int
$threshold
Methods
__construct()
LogFilesService constructor.
public
__construct(IntType $thresholdAsDays, ExistingDirectory $root, array<string|int, mixed> $blacklist) : mixed
Parameters
- $thresholdAsDays : IntType
-
Maximum age in days of logfile until it gets removed.
- $root : ExistingDirectory
-
Log files root directory.
- $blacklist : array<string|int, mixed>
-
List of blacklisted file names (e.g. .htaccess). Gets merged with "." and "..".
Return values
mixed —deleteOldLogFiles()
Returns the deleted log files.
public
deleteOldLogFiles() : array<string|int, string>
Return values
array<string|int, string> —List of removed file names.
_isBlacklisted()
Checks and returns true if given file is blacklisted.
protected
_isBlacklisted(DirectoryIterator $file) : bool
Parameters
- $file : DirectoryIterator
-
File to be checked.
Return values
bool —True if file is blacklisted.
_isNotDeprecated()
Checks and returns true if given file is NOT deprecated (Never than $threshold days).
protected
_isNotDeprecated(DirectoryIterator $file) : bool
Parameters
- $file : DirectoryIterator
-
File to be checked.
Return values
bool —True if file is NOT deprecated.