File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 55use Cake \Core \Configure ;
66use Cake \I18n \Time ;
77use Cake \ORM \Table ;
8- use Cake \Utility \Hash ;
98use Exception ;
109use RecursiveDirectoryIterator ;
1110use RecursiveIteratorIterator ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments