Skip to content

Commit

Permalink
Merge pull request #380 from fabsn182/patch-1
Browse files Browse the repository at this point in the history
Fixed TaskFinder failing to find tasks if app directory is not 'src'
  • Loading branch information
dereuromark committed Jun 2, 2023
2 parents 26014bf + ccfcd97 commit 0657b84
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Queue/TaskFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,15 @@ protected function getTasks(string $path, ?string $plugin = null): array {
foreach ($iterator as $file) {
$path = str_replace(DS, '/', $file[0]);
$pos = strpos($path, 'src/Queue/Task/');
if (!$pos) {
continue;
if ($pos) {
$name = substr($path, $pos + strlen('src/Queue/Task/'), -8);
} else {
$pos = strpos($path, APP_DIR . '/Queue/Task/');
if (!$pos) {
continue;
}
$name = substr($path, $pos + strlen(APP_DIR . '/Queue/Task/'), -8);
}
$name = substr($path, $pos + strlen('src/Queue/Task/'), -8);

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

Expand Down

0 comments on commit 0657b84

Please sign in to comment.