Files
luos/app/Console/Commands/ScheduleRunCommand.php

55 lines
1.5 KiB
PHP
Raw Normal View History

2020-05-29 18:36:07 +00:00
<?php
2020-05-29 18:36:07 +00:00
namespace App\Console\Commands;
use Maveriks\WebApplication;
use \Illuminate\Support\Carbon;
use Illuminate\Console\Scheduling\ScheduleRunCommand as BaseCommand;
use Illuminate\Support\Facades\Log;
2020-06-09 14:28:16 +00:00
use ProcessMaker\BusinessModel\TaskSchedulerBM;
2020-05-29 18:36:07 +00:00
class ScheduleRunCommand extends BaseCommand
{
use AddParametersTrait;
/**
2020-05-29 18:36:07 +00:00
* Create a new command instance.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
2020-05-29 18:36:07 +00:00
* @return void
*/
public function __construct(\Illuminate\Console\Scheduling\Schedule $schedule)
{
$this->startedAt = Carbon::now();
$this->signature = "schedule:run";
$this->signature .= '
{--workspace=workflow : ProcessMaker Indicates the workspace to be processed.}
{--processmakerPath=./ : ProcessMaker path.}
';
$this->description .= ' (ProcessMaker has extended this command)';
2020-05-29 18:36:07 +00:00
parent::__construct($schedule);
}
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$that = $this;
$workspace = $this->option('workspace');
if (!empty($workspace)) {
$webApplication = new WebApplication();
$webApplication->setRootDir($this->option('processmakerPath'));
$webApplication->loadEnvironment($workspace, false);
}
2020-06-09 14:28:16 +00:00
TaskSchedulerBM::executeScheduler($this);
2020-05-29 18:36:07 +00:00
parent::handle();
}
}