Skip to content

Commit 0657b84

Browse files
authored
Merge pull request #380 from fabsn182/patch-1
Fixed TaskFinder failing to find tasks if app directory is not 'src'
2 parents 26014bf + ccfcd97 commit 0657b84

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Queue/TaskFinder.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@ protected function getTasks(string $path, ?string $plugin = null): array {
9494
foreach ($iterator as $file) {
9595
$path = str_replace(DS, '/', $file[0]);
9696
$pos = strpos($path, 'src/Queue/Task/');
97-
if (!$pos) {
98-
continue;
97+
if ($pos) {
98+
$name = substr($path, $pos + strlen('src/Queue/Task/'), -8);
99+
} else {
100+
$pos = strpos($path, APP_DIR . '/Queue/Task/');
101+
if (!$pos) {
102+
continue;
103+
}
104+
$name = substr($path, $pos + strlen(APP_DIR . '/Queue/Task/'), -8);
99105
}
100-
$name = substr($path, $pos + strlen('src/Queue/Task/'), -8);
101106

102107
$namespace = $plugin ? str_replace('/', '\\', $plugin) : Configure::read('App.namespace');
103108

0 commit comments

Comments
 (0)