Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv committed Sep 5, 2023
1 parent 1a17bab commit 305dbd1
Show file tree
Hide file tree
Showing 57 changed files with 288 additions and 225 deletions.
2 changes: 1 addition & 1 deletion Actions/DummyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Spatie\QueueableAction\QueueableAction;

class DummyAction
final class DummyAction
{
use QueueableAction;

Expand Down
2 changes: 1 addition & 1 deletion Actions/ExecuteTaskAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Modules\Job\Models\Task;
use Spatie\QueueableAction\QueueableAction;

class ExecuteTaskAction
final class ExecuteTaskAction
{
use QueueableAction;

Expand Down
6 changes: 3 additions & 3 deletions Actions/GetTaskCommandsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Spatie\QueueableAction\QueueableAction;
use Symfony\Component\Console\Command\Command;

class GetTaskCommandsAction
final class GetTaskCommandsAction
{
use QueueableAction;

Expand All @@ -34,10 +34,10 @@ public function execute(): Collection
});
}
*/
return $all_commands->sortBy(function (Command $command): string {
return $all_commands->sortBy(static function (Command $command) : string {
$name = (string) $command->getName();
if (false === mb_strpos($name, ':')) {
$name = ':' . $name;
return ':' . $name;
}

return $name;
Expand Down
3 changes: 2 additions & 1 deletion Actions/GetTaskFrequenciesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Exception;
use Spatie\QueueableAction\QueueableAction;

class GetTaskFrequenciesAction
final class GetTaskFrequenciesAction
{
use QueueableAction;

Expand All @@ -17,6 +17,7 @@ public function execute(): array
if (is_array($res)) {
return $res;
}

throw new Exception('[' . __LINE__ . '][' . __FILE__ . ']');
}
}
12 changes: 7 additions & 5 deletions Config/job-filament.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

declare(strict_types=1);
use Filament\Pages\Dashboard;
use Modules\Job\Http\Middleware\FilamentMiddleware;

use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
Expand Down Expand Up @@ -57,9 +59,9 @@

'pages' => [
'namespace' => $contextNs . '\\Pages',
'path' => base_path('Modules/' . $moduleName . "/{$contextPath}/Pages"),
'path' => base_path('Modules/' . $moduleName . sprintf('/%s/Pages', $contextPath)),
'register' => [
Pages\Dashboard::class,
Dashboard::class,
],
],

Expand All @@ -75,7 +77,7 @@

'resources' => [
'namespace' => $contextNs . '\\Resources',
'path' => base_path('Modules/' . $moduleName . "/{$contextPath}/Resources"),
'path' => base_path('Modules/' . $moduleName . sprintf('/%s/Resources', $contextPath)),
'register' => [],
],

Expand All @@ -91,7 +93,7 @@

'widgets' => [
'namespace' => $contextNs . '\\Widgets',
'path' => base_path('Modules/' . $moduleName . "/{$contextPath}/Widgets"),
'path' => base_path('Modules/' . $moduleName . sprintf('/%s/Widgets', $contextPath)),
'register' => [
// Widgets\AccountWidget::class,
// Widgets\FilamentInfoWidget::class,
Expand Down Expand Up @@ -143,7 +145,7 @@
'middleware' => [
'auth' => [
// Authenticate::class,
Modules\Job\Http\Middleware\FilamentMiddleware::class,
FilamentMiddleware::class,
],
'base' => [
EncryptCookies::class,
Expand Down
9 changes: 6 additions & 3 deletions Console/Commands/WorkerCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use function Safe\exec;

class WorkerCheck extends Command
final class WorkerCheck extends Command
{
/**
* The name and signature of the console command.
Expand All @@ -23,7 +23,7 @@ class WorkerCheck extends Command
*/
protected $signature = 'worker:check';

protected string $filename = 'queue.pid';
private string $filename = 'queue.pid';

/**
* The console command description.
Expand Down Expand Up @@ -62,7 +62,8 @@ private function isQueueListenerRunning(): bool
if (! $pid = $this->getLastQueueListenerPID()) {
return false;
}
$process_cmd = "ps -p {$pid} -opid=,cmd=";

$process_cmd = sprintf('ps -p %s -opid=,cmd=', $pid);
$this->comment($process_cmd);
$output = null;
$process = exec($process_cmd, $output);
Expand All @@ -71,6 +72,7 @@ private function isQueueListenerRunning(): bool
// DISABILITATO PER SBLOCCARE MODULE JOB
// throw new Exception('['.__LINE__.']['.__FILE__.']');
}

$this->comment($process);
// $processIsQueueListener = ! empty($process); // 5.6 - see comments
$processIsQueueListener = str_contains($process, substr(base_path(), 0, 30));
Expand Down Expand Up @@ -140,6 +142,7 @@ private function startQueueListener(): string
if (false == $pid) {
throw new Exception('[' . __LINE__ . '][' . __FILE__ . ']');
}

$this->comment($pid);

return $pid;
Expand Down
5 changes: 3 additions & 2 deletions Database/Factories/FailedJobFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace Modules\Job\Database\Factories;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\FailedJob;

class FailedJobFactory extends Factory
final class FailedJobFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
* @var class-string<Model>
*/
protected $model = FailedJob::class;

Expand Down
5 changes: 3 additions & 2 deletions Database/Factories/FrequencyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace Modules\Job\Database\Factories;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\Frequency;

class FrequencyFactory extends Factory
final class FrequencyFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
* @var class-string<Model>
*/
protected $model = Frequency::class;

Expand Down
5 changes: 3 additions & 2 deletions Database/Factories/JobBatchFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace Modules\Job\Database\Factories;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\JobBatch;

class JobBatchFactory extends Factory
final class JobBatchFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
* @var class-string<Model>
*/
protected $model = JobBatch::class;

Expand Down
5 changes: 3 additions & 2 deletions Database/Factories/JobFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace Modules\Job\Database\Factories;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\Job;

class JobFactory extends Factory
final class JobFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
* @var class-string<Model>
*/
protected $model = Job::class;

Expand Down
5 changes: 3 additions & 2 deletions Database/Factories/ParameterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace Modules\Job\Database\Factories;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\Parameter;

class ParameterFactory extends Factory
final class ParameterFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
* @var class-string<Model>
*/
protected $model = Parameter::class;

Expand Down
2 changes: 1 addition & 1 deletion Database/Factories/ResultFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\Result;

class ResultFactory extends Factory
final class ResultFactory extends Factory
{
protected $model = Result::class;

Expand Down
2 changes: 1 addition & 1 deletion Database/Factories/TaskFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\Task;

class TaskFactory extends Factory
final class TaskFactory extends Factory
{
protected $model = Task::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Database\Schema\Blueprint;
use Modules\Xot\Database\Migrations\XotBaseMigration;

class CreateJobBatchesTable extends XotBaseMigration
final class CreateJobBatchesTable extends XotBaseMigration
{
/**
* Run the migrations.
Expand All @@ -14,7 +14,7 @@ public function up(): void
{
// -- CREATE --
$this->tableCreate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
$blueprint->string('id')->primary();
$blueprint->string('name');
$blueprint->integer('total_jobs');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Database\Schema\Blueprint;
use Modules\Xot\Database\Migrations\XotBaseMigration;

class CreateFailedJobsTable extends XotBaseMigration
final class CreateFailedJobsTable extends XotBaseMigration
{
/**
* Run the migrations.
Expand All @@ -14,7 +14,7 @@ public function up(): void
{
// -- CREATE --
$this->tableCreate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
$blueprint->id();
$blueprint->string('uuid')->unique();
$blueprint->text('connection');
Expand Down
6 changes: 4 additions & 2 deletions Database/Migrations/2022_03_01_000003_create_jobs_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Database\Schema\Blueprint;
use Modules\Xot\Database\Migrations\XotBaseMigration;

class CreateJobsTable extends XotBaseMigration
final class CreateJobsTable extends XotBaseMigration
{
/**
* Run the migrations.
Expand All @@ -14,7 +14,7 @@ public function up(): void
{
// -- CREATE --
$this->tableCreate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
$blueprint->bigIncrements('id');
$blueprint->string('queue')->index();
$blueprint->longText('payload');
Expand All @@ -31,9 +31,11 @@ function (Blueprint $blueprint): void {
$blueprint->string('created_by')->nullable();
$blueprint->string('updated_by')->nullable();
}

if (! $this->hasColumn('updated_at')) {
$blueprint->timestamp('updated_at')->nullable();
}

if (! $this->hasColumn('created_at')) {
$blueprint->timestamp('created_at')->nullable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Database\Schema\Blueprint;
use Modules\Xot\Database\Migrations\XotBaseMigration;

class CreateFrequenciesTable extends XotBaseMigration
final class CreateFrequenciesTable extends XotBaseMigration
{
/**
* Run the migrations.
Expand All @@ -14,7 +14,7 @@ public function up(): void
{
// -- CREATE --
$this->tableCreate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
$blueprint->increments('id');
$blueprint->unsignedInteger('task_id');
$blueprint->string('label');
Expand All @@ -30,7 +30,7 @@ function (Blueprint $blueprint): void {
);
// -- UPDATE --
$this->tableUpdate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
// if (! $this->hasColumn('created_by')) {
// $table->string('created_by')->nullable();
// $table->string('updated_by')->nullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Database\Schema\Blueprint;
use Modules\Xot\Database\Migrations\XotBaseMigration;

class CreateParametersTable extends XotBaseMigration
final class CreateParametersTable extends XotBaseMigration
{
/**
* Run the migrations.
Expand All @@ -14,7 +14,7 @@ public function up(): void
{
// -- CREATE --
$this->tableCreate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
$blueprint->increments('id');
$blueprint->unsignedInteger('frequency_id');
$blueprint->string('name');
Expand All @@ -26,7 +26,7 @@ function (Blueprint $blueprint): void {
);
// -- UPDATE --
$this->tableUpdate(
function (Blueprint $blueprint): void {
static function (Blueprint $blueprint) : void {
// if (! $this->hasColumn('created_by')) {
// $table->string('created_by')->nullable();
// $table->string('updated_by')->nullable();
Expand Down
Loading

0 comments on commit 305dbd1

Please sign in to comment.