Skip to content

Commit 6334006

Browse files
authored
fix: function strftime() is deprecated in PHP 8.1. Replace with date(). (#66)
1 parent 54966de commit 6334006

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function log($level, $message, array $context = array())
3434
if ($this->verbose) {
3535
fwrite(
3636
STDOUT,
37-
'[' . $level . '] [' . strftime('%T %Y-%m-%d') . '] ' . $this->interpolate($message, $context) . PHP_EOL
37+
'[' . $level . '] [' . date('H:i:s Y-m-d') . '] ' . $this->interpolate($message, $context) . PHP_EOL
3838
);
3939
return;
4040
}

lib/Worker/ResqueWorker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
246246

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

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

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

lib/Worker/SchedulerWorker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function log($message)
144144
if ($this->logLevel == self::LOG_NORMAL) {
145145
fwrite(STDOUT, "*** " . $message . "\n");
146146
} elseif ($this->logLevel == self::LOG_VERBOSE) {
147-
fwrite(STDOUT, "** [" . strftime('%T %Y-%m-%d') . "] " . $message . "\n");
147+
fwrite(STDOUT, "** [" . date('H:i:s Y-m-d') . "] " . $message . "\n");
148148
}
149149
}
150150

0 commit comments

Comments
 (0)