Skip to content

Commit 1df1b06

Browse files
committed
Fix CS.
1 parent 63c1087 commit 1df1b06

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/Model/Table/QueuedTasksTable.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Cake\Core\Configure;
66
use Cake\I18n\Time;
77
use Cake\ORM\Table;
8-
use Cake\Utility\Hash;
98
use Exception;
109
use RecursiveDirectoryIterator;
1110
use RecursiveIteratorIterator;

src/Shell/QueueShell.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ protected function _taskName($task) {
155155
* @return void
156156
*/
157157
public function runworker() {
158-
if ($pidFilePath = Configure::read('Queue.pidfilepath')) {
158+
$pidFilePath = Configure::read('Queue.pidfilepath');
159+
if ($pidFilePath) {
159160
if (!file_exists($pidFilePath)) {
160161
mkdir($pidFilePath, 0755, true);
161162
}
@@ -473,16 +474,19 @@ protected function _exit($signal) {
473474
* Destructor, removes pid-file
474475
*/
475476
public function __destruct() {
476-
if ($pidFilePath = Configure::read('Queue.pidfilepath')) {
477-
if (function_exists('posix_getpid')) {
478-
$pid = posix_getpid();
479-
} else {
480-
$pid = $this->QueuedTasks->key();
481-
}
482-
$file = $pidFilePath . 'queue_' . $pid . '.pid';
483-
if (file_exists($file)) {
484-
unlink($file);
485-
}
477+
$pidFilePath = Configure::read('Queue.pidfilepath');
478+
if (!$pidFilePath) {
479+
return;
480+
}
481+
482+
if (function_exists('posix_getpid')) {
483+
$pid = posix_getpid();
484+
} else {
485+
$pid = $this->QueuedTasks->key();
486+
}
487+
$file = $pidFilePath . 'queue_' . $pid . '.pid';
488+
if (file_exists($file)) {
489+
unlink($file);
486490
}
487491
}
488492

0 commit comments

Comments
 (0)