Skip to content
Open
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ storage/ssl
storage/api/*
storage/data-sources/logs/*
storage/decision-tables/*
storage/saved_search_advanced_configuration/*
npm.sh
laravel-echo-server.lock
public/.htaccess
Expand Down
31 changes: 31 additions & 0 deletions ProcessMaker/Managers/TaskSchedulerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use InvalidArgumentException;
use PDOException;
use ProcessMaker\Facades\WorkflowManager;
use ProcessMaker\Jobs\StartEventConditional;
Expand Down Expand Up @@ -574,6 +575,9 @@ public function scheduleCycle(
*/
public function scheduleCycleJob($interval, array $config): ScheduledTask
{
if (!isset($config['job'])) {
throw new InvalidArgumentException('$config["job"] is required');
}
$configuration = [
'type' => 'TimeCycle',
'interval' => $interval,
Expand All @@ -590,6 +594,33 @@ public function scheduleCycleJob($interval, array $config): ScheduledTask
return $scheduledTask;
}

/**
* Schedule a job for a specific datetime
*
* @param string $datetime in ISO-8601 format
* @param array $config configuration
*
* @return ScheduledTask
*/
public function scheduleDateJob($datetime, array $config): ScheduledTask
{
if (!isset($config['job'])) {
throw new InvalidArgumentException('$config["job"] is required');
}
$configuration = [
'type' => 'TimeDate',
'date' => $datetime,
...$config,
];
$scheduledTask = new ScheduledTask();
$scheduledTask->configuration = json_encode($configuration);
$scheduledTask->type = 'SCHEDULED_JOB';
$scheduledTask->last_execution = null;
$scheduledTask->save();

return $scheduledTask;
}

/**
* Schedule a job execution after a time duration for the given BPMN element,
* event definition and an optional Token object
Expand Down
7 changes: 7 additions & 0 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@
// Others declared in packages
// - translations - package-translations
// - 'filesystems.disks.install' configured on the fly

'saved_search_advanced_configuration' => [
'driver' => 'local',
'root' => storage_path('saved_search_advanced_configuration'),
'url' => env('APP_URL') . '/storage/saved_search_advanced_configuration',
'visibility' => 'private',
],
],

/*
Expand Down