Skip to content

Commit

Permalink
Merge pull request #94 from lion-packages/support
Browse files Browse the repository at this point in the history
Support CRON tasks
  • Loading branch information
GabrielPalac authored Oct 22, 2024
2 parents ee2d8d0 + 4f96bc9 commit c94783d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"lion/command": "^3.1",
"lion/database": "^10.3",
"lion/dependency-injection": "^2.0",
"lion/exceptions": "^1.2",
"lion/exceptions": "^1.3",
"lion/files": "^7.0",
"lion/helpers": "^4.0",
"lion/mailer": "^6.0",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/LionBundle/Commands/Lion/New/CommandsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ protected function configure(): void
* @param OutputInterface $output [OutputInterface is the interface
* implemented by all Output classes]
*
* @return int 0 if everything went fine, or an exit code
* @return int [0 if everything went fine, or an exit code]
*
* @throws LogicException When this abstract method is not implemented
* @throws LogicException [When this abstract method is not implemented]
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
8 changes: 4 additions & 4 deletions src/LionBundle/Commands/Lion/Schedule/UpScheduleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::FAILURE;
}

/** @var array<ScheduleInterface> $files */
/** @var array<int, ScheduleInterface> $files */
$files = [];

foreach ($this->container->getFiles('app/Console/Cron/') as $file) {
if (isSuccess($this->store->validate([$file], ['php']))) {
$namespace = $this->container->getNamespace(
(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? str_replace('\\', '/', $file) : $file),
$this->store->normalizePath($file),
'App\\Console\\Cron\\',
$this->store->normalizePath('Cron/')
);
Expand Down Expand Up @@ -190,9 +190,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
/** @var Command $commandObject */
$commandObject = new $config['command'];

$command = "{$config['cron']} cd {$_ENV['CRONTAB_PROJECT_PATH']}";
$command = "{$config['cron']} lion cd {$_ENV['CRONTAB_PROJECT_PATH']} && ";

$command .= " && {$_ENV['CRONTAB_PHP_PATH']} {$_ENV['CRONTAB_PROJECT_PATH']}lion {$commandObject->getName()}";
$command .= "{$_ENV['CRONTAB_PHP_PATH']} {$_ENV['CRONTAB_PROJECT_PATH']}lion {$commandObject->getName()}";

$command .= '' === $options ? '' : " {$options}";

Expand Down

0 comments on commit c94783d

Please sign in to comment.