Skip to content

Commit

Permalink
fix: function strftime() is deprecated in PHP 8.1. Replace with date(…
Browse files Browse the repository at this point in the history
…). (#66)
  • Loading branch information
JoyceBabu authored Aug 10, 2023
1 parent 54966de commit 6334006
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function log($level, $message, array $context = array())
if ($this->verbose) {
fwrite(
STDOUT,
'[' . $level . '] [' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL
'[' . $level . '] [' . date('H:i:s Y-m-d') . '] ' . $this->interpolate($message, $context) . PHP_EOL
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Worker/ResqueWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)

// Forked and we're the child. Or PCNTL is not installed. Run the job.
if ($this->child === 0 || $this->child === false || $this->child === -1) {
$status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T');
$status = 'Processing ' . $job->queue . ' since ' . date('Y-m-d H:i:s');
$this->updateProcLine($status);
$this->logger->log(LogLevel::INFO, $status);

Expand All @@ -267,7 +267,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)

if ($this->child > 0) {
// Parent process, sit and wait
$status = 'Forked ' . $this->child . ' at ' . strftime('%F %T');
$status = 'Forked ' . $this->child . ' at ' . date('Y-m-d H:i:s');
$this->updateProcLine($status);
$this->logger->log(LogLevel::INFO, $status);

Expand Down
2 changes: 1 addition & 1 deletion lib/Worker/SchedulerWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function log($message)
if ($this->logLevel == self::LOG_NORMAL) {
fwrite(STDOUT, "*** " . $message . "\n");
} elseif ($this->logLevel == self::LOG_VERBOSE) {
fwrite(STDOUT, "** [" . strftime('%T %Y-%m-%d') . "] " . $message . "\n");
fwrite(STDOUT, "** [" . date('H:i:s Y-m-d') . "] " . $message . "\n");
}
}

Expand Down

0 comments on commit 6334006

Please sign in to comment.