Skip to content

Commit

Permalink
Merge commit 'ee172011c4262096640cd136f641770a23eaadf7' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv committed Sep 13, 2024
2 parents 13aaa5d + ee17201 commit 35d9282
Show file tree
Hide file tree
Showing 82 changed files with 506 additions and 378 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ vendor
.git-blame-ignore-revs
vendor/
build/
docs/cache/
cache/
22 changes: 10 additions & 12 deletions Actions/Command/GetCommandsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@ public function execute(): DataCollection
// foreach (config('filament-database-schedule.commands.exclude') as $exclude) {
// $commandsKeys = preg_grep("/^$exclude/", $commandsKeys, PREG_GREP_INVERT);
// }
if ($commandsKeys == null) {
if ($commandsKeys === null) {
return CommandData::collection([]);
}
Assert::isArray($commandsKeys, '['.__LINE__.']['.__FILE__.']');
Assert::isArray($commandsKeys, '['.__LINE__.']['.class_basename($this).']');

$commands = $commands
->only($commandsKeys)
->map(function ($command) {
return [
'name' => $command->getName(),
'description' => $command->getDescription(),
'signature' => $command->getSynopsis(),
'full_name' => $command->getName().' - '.$command->getDescription(),
'arguments' => app(GetCommandArgumentsActions::class)->execute($command),
'options' => app(GetCommandOptionsActions::class)->execute($command),
];
});
->map(fn ($command): array => [
'name' => $command->getName(),
'description' => $command->getDescription(),
'signature' => $command->getSynopsis(),
'full_name' => $command->getName().' - '.$command->getDescription(),
'arguments' => app(GetCommandArgumentsActions::class)->execute($command),
'options' => app(GetCommandOptionsActions::class)->execute($command),
]);

return CommandData::collection($commands);
}
Expand Down
2 changes: 1 addition & 1 deletion Actions/GetTaskFrequenciesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function execute(): array
return $res;
}

throw new Exception('['.__LINE__.']['.__FILE__.']');
throw new Exception('['.__LINE__.']['.class_basename($this).']');
}
}
3 changes: 2 additions & 1 deletion Console/Commands/TestJobCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Modules\Job\Console\Commands;

use Illuminate\Console\Command;
use Log;

class TestJobCommand extends Command
{
Expand All @@ -31,7 +32,7 @@ class TestJobCommand extends Command
public function handle(): int
{
$this->info('Hello the test worked.');
\Log::info('Hello the test worked.');
Log::info('Hello the test worked.');

return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions Console/Commands/WorkerCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function handle(): void
*/
private function isQueueListenerRunning(): bool
{
if (! $pid = $this->getLastQueueListenerPID()) {
if (($pid = $this->getLastQueueListenerPID()) === '' || ($pid = $this->getLastQueueListenerPID()) === '0' || ($pid = $this->getLastQueueListenerPID()) === false || ($pid = $this->getLastQueueListenerPID()) === null) {
return false;
}

Expand All @@ -71,13 +71,13 @@ private function isQueueListenerRunning(): bool
// $processIsQueueListener = str_contains($process, 'queue:listen'); // 5.1
// if ($process === false) {
// DISABILITATO PER SBLOCCARE MODULE JOB
// throw new Exception('['.__LINE__.']['.__FILE__.']');
// throw new Exception('['.__LINE__.']['.class_basename($this).']');
// }

$this->comment($process);

// $processIsQueueListener = ! empty($process); // 5.6 - see comments
return str_contains($process, substr(base_path(), 0, 30));
return str_contains($process, mb_substr(base_path(), 0, 30));
}

/**
Expand Down Expand Up @@ -137,7 +137,7 @@ private function startQueueListener(): string

$pid = exec($command);
if ($pid == false) {
throw new \Exception('['.__LINE__.']['.__FILE__.']');
throw new \Exception('['.__LINE__.']['.class_basename($this).']');
}

$this->comment($pid);
Expand Down
5 changes: 4 additions & 1 deletion Database/Factories/ExportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\Export;

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

Expand Down
5 changes: 4 additions & 1 deletion Database/Factories/FailedImportRowFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\FailedImportRow;

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

Expand Down
19 changes: 11 additions & 8 deletions Database/Factories/FailedJobFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\FailedJob;

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

Expand All @@ -23,13 +26,13 @@ class FailedJobFactory extends Factory
public function definition(): array
{
return [
'id' => $this->faker->randomNumber(5, false),
'uuid' => $this->faker->uuid,
'connection' => $this->faker->text,
'queue' => $this->faker->text,
'payload' => $this->faker->text,
'exception' => $this->faker->text,
'failed_at' => $this->faker->dateTime,
'id' => fake()->randomNumber(5, false),
'uuid' => fake()->uuid,
'connection' => fake()->text,
'queue' => fake()->text,
'payload' => fake()->text,
'exception' => fake()->text,
'failed_at' => fake()->dateTime,
];
}
}
9 changes: 6 additions & 3 deletions Database/Factories/FrequencyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\Frequency;

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

Expand All @@ -24,8 +27,8 @@ public function definition(): array
{
return [
// 'id' => $this->faker->randomNumber(5, false),
'label' => $this->faker->word,
'interval' => $this->faker->word,
'label' => fake()->word,
'interval' => fake()->word,
];
}
}
5 changes: 4 additions & 1 deletion Database/Factories/ImportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\Import;

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

Expand Down
25 changes: 14 additions & 11 deletions Database/Factories/JobBatchFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\JobBatch;

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

Expand All @@ -23,16 +26,16 @@ class JobBatchFactory extends Factory
public function definition(): array
{
return [
'id' => $this->faker->word,
'name' => $this->faker->name,
'total_jobs' => $this->faker->randomNumber(5, false),
'pending_jobs' => $this->faker->randomNumber(5, false),
'failed_jobs' => $this->faker->randomNumber(5, false),
'failed_job_ids' => $this->faker->text,
'options' => $this->faker->text,
'cancelled_at' => $this->faker->randomNumber(5, false),
'created_at' => $this->faker->randomNumber(5, false),
'finished_at' => $this->faker->randomNumber(5, false),
'id' => fake()->word,
'name' => fake()->name,
'total_jobs' => fake()->randomNumber(5, false),
'pending_jobs' => fake()->randomNumber(5, false),
'failed_jobs' => fake()->randomNumber(5, false),
'failed_job_ids' => fake()->text,
'options' => fake()->text,
'cancelled_at' => fake()->randomNumber(5, false),
'created_at' => fake()->randomNumber(5, false),
'finished_at' => fake()->randomNumber(5, false),
];
}
}
17 changes: 10 additions & 7 deletions Database/Factories/JobFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\Job;

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

Expand All @@ -24,12 +27,12 @@ public function definition(): array
{
return [
// 'id' => $this->faker->randomNumber(5, false),
'queue' => $this->faker->word,
'payload' => $this->faker->text,
'attempts' => $this->faker->boolean,
'reserved_at' => $this->faker->randomNumber(5, false),
'available_at' => $this->faker->randomNumber(5, false),
'created_at' => $this->faker->randomNumber(5, false),
'queue' => fake()->word,
'payload' => fake()->text,
'attempts' => fake()->boolean,
'reserved_at' => fake()->randomNumber(5, false),
'available_at' => fake()->randomNumber(5, false),
'created_at' => fake()->randomNumber(5, false),
];
}
}
5 changes: 4 additions & 1 deletion Database/Factories/JobManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\JobManager;

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

Expand Down
11 changes: 7 additions & 4 deletions Database/Factories/JobsWaitingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\JobsWaiting;

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

Expand All @@ -23,9 +26,9 @@ public function definition(): array
{
return [
// 'id' => $this->faker->number(1,5),
'queue' => $this->faker->word,
'payload' => $this->faker->text,
'attempts' => $this->faker->boolean,
'queue' => fake()->word,
'payload' => fake()->text,
'attempts' => fake()->boolean,
// 'reserved_at' => $this->faker->randomNumber,
// 'available_at' => $this->faker->randomNumber,
// 'created_at' => $this->faker->randomNumber
Expand Down
9 changes: 6 additions & 3 deletions Database/Factories/ParameterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use Illuminate\Database\Eloquent\Model;
use Modules\Job\Models\Parameter;

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

Expand All @@ -24,8 +27,8 @@ public function definition(): array
{
return [
// 'id' => $this->faker->randomNumber(5, false),
'name' => $this->faker->name,
'value' => $this->faker->word,
'name' => fake()->name,
'value' => fake()->word,
];
}
}
13 changes: 8 additions & 5 deletions Database/Factories/ResultFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Modules\Job\Models\Result;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Modules\Job\Models\Result>
*/
class ResultFactory extends Factory
{
protected $model = Result::class;
Expand All @@ -15,11 +18,11 @@ public function definition(): array
{
return [
// 'task_id' => $this->faker->randomDigit,
'ran_at' => $this->faker->dateTimeBetween('-1 hour'),
'duration' => (string) $this->faker->randomFloat(11, 0, 8_000_000),
'result' => $this->faker->sentence,
'created_at' => $this->faker->dateTimeBetween('-1 year', '-6 months'),
'updated_at' => $this->faker->dateTimeBetween('-6 months'),
'ran_at' => fake()->dateTimeBetween('-1 hour'),
'duration' => (string) fake()->randomFloat(11, 0, 8_000_000),
'result' => fake()->sentence,
'created_at' => fake()->dateTimeBetween('-1 year', '-6 months'),
'updated_at' => fake()->dateTimeBetween('-6 months'),
];
}
}
Loading

0 comments on commit 35d9282

Please sign in to comment.