3 Commits
Author SHA1 Message Date
bwilliams 7fbc1a364d Corrected the namespace path for jobs 2024-06-17 16:23:45 +01:00
bwilliams 378b0f5e4b Prevent abstract jobs from being included in the list 2024-06-17 16:23:21 +01:00
bwilliams e498990393 Updated readme 2024-06-06 10:24:43 +01:00
2 changed files with 26 additions and 2 deletions

No files matched your search

+20 -1
View File
@@ -1,3 +1,22 @@
# sprinkle-worker # sprinkle-worker
"Background" worker sprinkle for userfrosting "Background" worker sprinkle for userfrosting
The following snippit creates a single worker thread for processing tasks:
```
[Unit]
Description=UserFrosting workers service
[Service]
Restart=on-failure
Type=simple
PIDFile=/run/uf-workers.pid
ExecStart=php bakery worker:run --quiet
WorkingDirectory=/srv/UserFrosting
User=www-data
Group=www-data
SyslogIdentifier=UF-worker
[Install]
WantedBy=multi-user.target
```
+6 -1
View File
@@ -96,13 +96,18 @@ class JobInspector
$basePath = str_replace($file->getBasename(), '', $file->getBasePath()); $basePath = str_replace($file->getBasename(), '', $file->getBasePath());
$name = $basePath . $file->getFilename(); $name = $basePath . $file->getFilename();
$className = str_replace('/', '\\', $basePath) . $file->getFilename(); $className = str_replace('/', '\\', $basePath) . $file->getFilename();
$classPath = "\\$sprinkleNS\\Worker\\Jobs\\$className"; $classPath = "\\$sprinkleNS\\Jobs\\$className";
// Exclude known helper classes // Exclude known helper classes
if ($className == "JobInterface" || $className == "JobBase" || $className == "JobInspector") { if ($className == "JobInterface" || $className == "JobBase" || $className == "JobInspector") {
return null; return null;
} }
$reflect = new \ReflectionClass($classPath);
if ($reflect->isAbstract()) {
return null;
}
// Build the class name and namespace // Build the class name and namespace
return [ return [
'sprinkle' => $sprinkleName, 'sprinkle' => $sprinkleName,