public function LogRotator::shouldRun in File Log 8
Same name and namespace in other branches
- 2.0.x src/LogRotator.php \Drupal\filelog\LogRotator::shouldRun()
Check if sufficient time has passed since the last log rotation.
Parameters
int $now: The current timestamp.
Return value
bool TRUE if the log file should be rotated now.
1 call to LogRotator::shouldRun()
- LogRotator::run in src/
LogRotator.php - Check and rotate if necessary.
File
- src/
LogRotator.php, line 125
Class
- LogRotator
- Log rotation cron service.
Namespace
Drupal\filelogCode
public function shouldRun($now) : bool {
$last = $this->state
->get('filelog.rotation');
switch ($this->config
->get('rotation.schedule')) {
case 'monthly':
return date('m', $last) !== date('m', $now);
case 'weekly':
return date('W', $last) !== date('W', $now);
case 'daily':
return date('d', $last) !== date('d', $now);
}
return FALSE;
}