PMC-930 Use the "JobsManager" class in "Derivation" class
This commit is contained in:
8
app/Jobs/Email.php
Normal file
8
app/Jobs/Email.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
class Email extends QueuedClosure
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ use Illuminate\Foundation\Http\Kernel;
|
|||||||
use Luracast\Restler\Format\UploadFormat;
|
use Luracast\Restler\Format\UploadFormat;
|
||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
use Maveriks\Util;
|
use Maveriks\Util;
|
||||||
|
use ProcessMaker\Core\JobsManager;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
use ProcessMaker\Plugins\PluginRegistry;
|
||||||
use ProcessMaker\Services;
|
use ProcessMaker\Services;
|
||||||
@@ -612,6 +613,11 @@ class WebApplication
|
|||||||
|
|
||||||
\Propel::init(PATH_CONFIG . "databases.php");
|
\Propel::init(PATH_CONFIG . "databases.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JobsManager
|
||||||
|
*/
|
||||||
|
JobsManager::getSingleton()->init();
|
||||||
|
|
||||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||||
$attributes = $oPluginRegistry->getAttributes();
|
$attributes = $oPluginRegistry->getAttributes();
|
||||||
Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes);
|
Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ require_once __DIR__ . '/../../../gulliver/system/class.g.php';
|
|||||||
require_once __DIR__ . '/../../../bootstrap/autoload.php';
|
require_once __DIR__ . '/../../../bootstrap/autoload.php';
|
||||||
require_once __DIR__ . '/../../../bootstrap/app.php';
|
require_once __DIR__ . '/../../../bootstrap/app.php';
|
||||||
|
|
||||||
|
use ProcessMaker\Core\JobsManager;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
use ProcessMaker\Plugins\PluginRegistry;
|
||||||
|
|
||||||
@@ -251,6 +252,11 @@ try {
|
|||||||
//Processing
|
//Processing
|
||||||
eprintln('Processing workspace: ' . $workspace, 'green');
|
eprintln('Processing workspace: ' . $workspace, 'green');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JobsManager
|
||||||
|
*/
|
||||||
|
JobsManager::getSingleton()->init();
|
||||||
|
|
||||||
// We load plugins' pmFunctions
|
// We load plugins' pmFunctions
|
||||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||||
$oPluginRegistry->init();
|
$oPluginRegistry->init();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use ProcessMaker\BusinessModel\EmailServer;
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
use ProcessMaker\ChangeLog\ChangeLog;
|
use ProcessMaker\ChangeLog\ChangeLog;
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
use ProcessMaker\Core\JobsManager;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
|
||||||
class WsBase
|
class WsBase
|
||||||
@@ -956,9 +957,6 @@ class WsBase
|
|||||||
$msgError = "The default configuration wasn't defined";
|
$msgError = "The default configuration wasn't defined";
|
||||||
}
|
}
|
||||||
|
|
||||||
$spool = new SpoolRun();
|
|
||||||
$spool->setConfig($setup);
|
|
||||||
|
|
||||||
$case = new Cases();
|
$case = new Cases();
|
||||||
$oldFields = $case->loadCase($appUid, $delIndex);
|
$oldFields = $case->loadCase($appUid, $delIndex);
|
||||||
if ($gmail == 1) {
|
if ($gmail == 1) {
|
||||||
@@ -1003,19 +1001,27 @@ class WsBase
|
|||||||
isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0,
|
isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0,
|
||||||
$this->getTaskId() ?$this->getTaskId():(isset($oldFields['TAS_ID'])? $oldFields['TAS_ID'] : 0)
|
$this->getTaskId() ?$this->getTaskId():(isset($oldFields['TAS_ID'])? $oldFields['TAS_ID'] : 0)
|
||||||
);
|
);
|
||||||
$spool->create($messageArray);
|
|
||||||
|
|
||||||
$result = "";
|
$result = "";
|
||||||
if ($gmail != 1) {
|
if ($gmail != 1) {
|
||||||
|
$closure = function() use ($setup, $messageArray, $gmail, $to) {
|
||||||
|
$spool = new SpoolRun();
|
||||||
|
$spool->setConfig($setup);
|
||||||
|
$spool->create($messageArray);
|
||||||
$spool->sendMail();
|
$spool->sendMail();
|
||||||
|
return $spool;
|
||||||
if ($spool->status == 'sent') {
|
};
|
||||||
$result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
|
$result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
|
||||||
} else {
|
switch ($appMsgType) {
|
||||||
$result = new WsResponse(29, $spool->status . ' ' . $spool->error . print_r($setup, 1));
|
case WsBase::MESSAGE_TYPE_EMAIL_EVENT:
|
||||||
|
case WsBase::MESSAGE_TYPE_PM_FUNCTION:
|
||||||
|
JobsManager::getSingleton()->dispatch('EmailEvent', $closure);
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
JobsManager::getSingleton()->dispatch('Email', $closure);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return new WsResponse(100, $e->getMessage());
|
return new WsResponse(100, $e->getMessage());
|
||||||
|
|||||||
6
workflow/engine/config/schema.xml
Normal file → Executable file
6
workflow/engine/config/schema.xml
Normal file → Executable file
@@ -5837,9 +5837,9 @@
|
|||||||
<column name="queue" type="VARCHAR" size="255" required="true"/>
|
<column name="queue" type="VARCHAR" size="255" required="true"/>
|
||||||
<column name="payload" type="LONGVARCHAR" required="true"/>
|
<column name="payload" type="LONGVARCHAR" required="true"/>
|
||||||
<column name="attempts" type="TINYINT" size="3" required="true"/>
|
<column name="attempts" type="TINYINT" size="3" required="true"/>
|
||||||
<column name="reserved_at" type="TINYINT" size="10" required="false"/>
|
<column name="reserved_at" type="BIGINT" size="10" required="false"/>
|
||||||
<column name="available_at" type="TINYINT" size="10" required="true"/>
|
<column name="available_at" type="BIGINT" size="10" required="true"/>
|
||||||
<column name="created_at" type="TINYINT" size="10" required="true"/>
|
<column name="created_at" type="BIGINT" size="10" required="true"/>
|
||||||
<index name="jobs_queue_index">
|
<index name="jobs_queue_index">
|
||||||
<index-column name="queue"/>
|
<index-column name="queue"/>
|
||||||
</index>
|
</index>
|
||||||
|
|||||||
@@ -3257,9 +3257,9 @@ CREATE TABLE `JOBS_PENDING`
|
|||||||
`queue` VARCHAR(255) NOT NULL,
|
`queue` VARCHAR(255) NOT NULL,
|
||||||
`payload` MEDIUMTEXT NOT NULL,
|
`payload` MEDIUMTEXT NOT NULL,
|
||||||
`attempts` TINYINT(3) NOT NULL,
|
`attempts` TINYINT(3) NOT NULL,
|
||||||
`reserved_at` TINYINT(10),
|
`reserved_at` BIGINT(10),
|
||||||
`available_at` TINYINT(10) NOT NULL,
|
`available_at` BIGINT(10) NOT NULL,
|
||||||
`created_at` TINYINT(10) NOT NULL,
|
`created_at` BIGINT(10) NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `jobs_queue_index`(`queue`)
|
KEY `jobs_queue_index`(`queue`)
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class System
|
|||||||
private static $config = null;
|
private static $config = null;
|
||||||
private static $debug = null;
|
private static $debug = null;
|
||||||
private static $instance;
|
private static $instance;
|
||||||
private static $defaultConfig = array(
|
private static $defaultConfig = [
|
||||||
'debug' => 0,
|
'debug' => 0,
|
||||||
'debug_sql' => 0,
|
'debug_sql' => 0,
|
||||||
'debug_time' => 0,
|
'debug_time' => 0,
|
||||||
@@ -70,8 +70,11 @@ class System
|
|||||||
'google_map_signature' => '',
|
'google_map_signature' => '',
|
||||||
'logging_level' => 'INFO',
|
'logging_level' => 'INFO',
|
||||||
'upload_attempts_limit_per_user' => '60,1',
|
'upload_attempts_limit_per_user' => '60,1',
|
||||||
'files_white_list' => ''
|
'files_white_list' => '',
|
||||||
);
|
'delay' => '0',
|
||||||
|
'tries' => '10',
|
||||||
|
'retry_after' => '90'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List currently installed plugins
|
* List currently installed plugins
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Illuminate\Foundation\Http\Kernel;
|
use Illuminate\Foundation\Http\Kernel;
|
||||||
use ProcessMaker\Core\AppEvent;
|
use ProcessMaker\Core\AppEvent;
|
||||||
|
use ProcessMaker\Core\JobsManager;
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
use ProcessMaker\ChangeLog\ChangeLog;
|
use ProcessMaker\ChangeLog\ChangeLog;
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
@@ -704,6 +705,11 @@ if (defined('DEBUG_SQL_LOG') && DEBUG_SQL_LOG) {
|
|||||||
Propel::init(PATH_CORE . "config/databases.php");
|
Propel::init(PATH_CORE . "config/databases.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JobsManager
|
||||||
|
*/
|
||||||
|
JobsManager::getSingleton()->init();
|
||||||
|
|
||||||
//here we are loading all plugins registered
|
//here we are loading all plugins registered
|
||||||
//the singleton has a list of enabled plugins
|
//the singleton has a list of enabled plugins
|
||||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||||
|
|||||||
Reference in New Issue
Block a user