HOR-4415 PHP Fatal error: Call to undefined method stdClass::equalCronFileTo()

- Add field PLUGIN_CRON_FILES in table PLUGINS_REGISTRY and fix external step in running cases
This commit is contained in:
Marco Antonio Nina Mena
2018-03-15 16:35:53 -04:00
committed by Julio Cesar Laura Avendaño
parent d47e63e509
commit babe2c5a55
13 changed files with 156 additions and 39 deletions

View File

@@ -439,9 +439,17 @@ function executePlugins()
// -> Execute functions // -> Execute functions
if (!empty($cronFiles)) { if (!empty($cronFiles)) {
setExecutionMessage('Executing registered cron files for Workspace: ' . config("system.workspace")); setExecutionMessage('Executing registered cron files for Workspace: ' . config('system.workspace'));
/**
* @var \ProcessMaker\Plugins\Interfaces\CronFile $cronFile
*/
foreach($cronFiles as $cronFile) { foreach($cronFiles as $cronFile) {
executeCustomCronFunction(PATH_PLUGINS . $cronFile->namespace . PATH_SEP . 'bin' . PATH_SEP . $cronFile->cronFile . '.php', $cronFile->cronFile); $path = PATH_PLUGINS . $cronFile->getNamespace() . PATH_SEP . 'bin' . PATH_SEP . $cronFile->getCronFile() . '.php';
if (file_exists($path)) {
executeCustomCronFunction($path, $cronFile->getCronFile());
} else {
setExecutionMessage('File ' . $cronFile->getCronFile() . '.php ' . 'does not exist.');
}
} }
} }

View File

@@ -1480,21 +1480,22 @@ class PMPluginRegistry
/** /**
* Register a cron file in the singleton * Register a cron file in the singleton
* *
* @param unknown_type $namespace * @param string $pluginName
* @param unknown_type $cronFile * @param string $cronFileToRegister
*/ */
public function registerCronFile($namespace, $cronFile) public function registerCronFile($pluginName, $cronFileToRegister)
{ {
$found = false; $found = false;
foreach ($this->_aCronFiles as $row => $detail) { foreach ($this->_aCronFiles as $cronFile) {
if ($cronFile == $detail->cronFile && $namespace == $detail->namespace) { if ($cronFile instanceof cronFile &&
$detail->cronFile = $cronFile; $cronFileToRegister === $cronFile->cronFile &&
$pluginName === $cronFile->namespace) {
$cronFile->cronFile = $cronFileToRegister;
$found = true; $found = true;
} }
} }
if (!$found) { if (!$found) {
$cronFile = new cronFile($namespace, $cronFile); $this->_aCronFiles[] = new cronFile($pluginName, $cronFileToRegister);
$this->_aCronFiles[] = $cronFile;
} }
} }

View File

@@ -803,7 +803,7 @@ class ProcessMap
if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) { if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
$sTitle = $val->getStepTitle(); $sTitle = $val->getStepTitle();
if (trim($val->getSetupStepPage()) != '') { if (trim($val->getSetupStepPage()) != '') {
$urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');"; $urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->getSetupStepPage() . "');";
$linkEditValue = 'Edit'; $linkEditValue = 'Edit';
} else { } else {
$urlEdit = ""; $urlEdit = "";

View File

@@ -109,6 +109,8 @@ class PluginsRegistryMapBuilder
$tMap->addColumn('PLUGIN_REST_SERVICE', 'PluginRestService', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('PLUGIN_REST_SERVICE', 'PluginRestService', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_CRON_FILES', 'PluginCronFiles', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_TASK_EXTENDED_PROPERTIES', 'PluginTaskExtendedProperties', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('PLUGIN_TASK_EXTENDED_PROPERTIES', 'PluginTaskExtendedProperties', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PLUGIN_ATTRIBUTES', 'PluginAttributes', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('PLUGIN_ATTRIBUTES', 'PluginAttributes', 'string', CreoleTypes::LONGVARCHAR, false, null);

View File

@@ -159,6 +159,12 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
*/ */
protected $plugin_rest_service; protected $plugin_rest_service;
/**
* The value for the plugin_cron_files field.
* @var string
*/
protected $plugin_cron_files;
/** /**
* The value for the plugin_task_extended_properties field. * The value for the plugin_task_extended_properties field.
* @var string * @var string
@@ -427,6 +433,17 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
return $this->plugin_rest_service; return $this->plugin_rest_service;
} }
/**
* Get the [plugin_cron_files] column value.
*
* @return string
*/
public function getPluginCronFiles()
{
return $this->plugin_cron_files;
}
/** /**
* Get the [plugin_task_extended_properties] column value. * Get the [plugin_task_extended_properties] column value.
* *
@@ -933,6 +950,28 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
} // setPluginRestService() } // setPluginRestService()
/**
* Set the value of [plugin_cron_files] column.
*
* @param string $v new value
* @return void
*/
public function setPluginCronFiles($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->plugin_cron_files !== $v) {
$this->plugin_cron_files = $v;
$this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_CRON_FILES;
}
} // setPluginCronFiles()
/** /**
* Set the value of [plugin_task_extended_properties] column. * Set the value of [plugin_task_extended_properties] column.
* *
@@ -1038,16 +1077,18 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$this->plugin_rest_service = $rs->getString($startcol + 21); $this->plugin_rest_service = $rs->getString($startcol + 21);
$this->plugin_task_extended_properties = $rs->getString($startcol + 22); $this->plugin_cron_files = $rs->getString($startcol + 22);
$this->plugin_attributes = $rs->getString($startcol + 23); $this->plugin_task_extended_properties = $rs->getString($startcol + 23);
$this->plugin_attributes = $rs->getString($startcol + 24);
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer. // FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 24; // 24 = PluginsRegistryPeer::NUM_COLUMNS - PluginsRegistryPeer::NUM_LAZY_LOAD_COLUMNS). return $startcol + 25; // 25 = PluginsRegistryPeer::NUM_COLUMNS - PluginsRegistryPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating PluginsRegistry object", $e); throw new PropelException("Error populating PluginsRegistry object", $e);
@@ -1318,9 +1359,12 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
return $this->getPluginRestService(); return $this->getPluginRestService();
break; break;
case 22: case 22:
return $this->getPluginTaskExtendedProperties(); return $this->getPluginCronFiles();
break; break;
case 23: case 23:
return $this->getPluginTaskExtendedProperties();
break;
case 24:
return $this->getPluginAttributes(); return $this->getPluginAttributes();
break; break;
default: default:
@@ -1365,8 +1409,9 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$keys[19] => $this->getPluginCss(), $keys[19] => $this->getPluginCss(),
$keys[20] => $this->getPluginJs(), $keys[20] => $this->getPluginJs(),
$keys[21] => $this->getPluginRestService(), $keys[21] => $this->getPluginRestService(),
$keys[22] => $this->getPluginTaskExtendedProperties(), $keys[22] => $this->getPluginCronFiles(),
$keys[23] => $this->getPluginAttributes(), $keys[23] => $this->getPluginTaskExtendedProperties(),
$keys[24] => $this->getPluginAttributes(),
); );
return $result; return $result;
} }
@@ -1465,9 +1510,12 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$this->setPluginRestService($value); $this->setPluginRestService($value);
break; break;
case 22: case 22:
$this->setPluginTaskExtendedProperties($value); $this->setPluginCronFiles($value);
break; break;
case 23: case 23:
$this->setPluginTaskExtendedProperties($value);
break;
case 24:
$this->setPluginAttributes($value); $this->setPluginAttributes($value);
break; break;
} // switch() } // switch()
@@ -1582,11 +1630,15 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
} }
if (array_key_exists($keys[22], $arr)) { if (array_key_exists($keys[22], $arr)) {
$this->setPluginTaskExtendedProperties($arr[$keys[22]]); $this->setPluginCronFiles($arr[$keys[22]]);
} }
if (array_key_exists($keys[23], $arr)) { if (array_key_exists($keys[23], $arr)) {
$this->setPluginAttributes($arr[$keys[23]]); $this->setPluginTaskExtendedProperties($arr[$keys[23]]);
}
if (array_key_exists($keys[24], $arr)) {
$this->setPluginAttributes($arr[$keys[24]]);
} }
} }
@@ -1688,6 +1740,10 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$criteria->add(PluginsRegistryPeer::PLUGIN_REST_SERVICE, $this->plugin_rest_service); $criteria->add(PluginsRegistryPeer::PLUGIN_REST_SERVICE, $this->plugin_rest_service);
} }
if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_CRON_FILES)) {
$criteria->add(PluginsRegistryPeer::PLUGIN_CRON_FILES, $this->plugin_cron_files);
}
if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES)) { if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES)) {
$criteria->add(PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES, $this->plugin_task_extended_properties); $criteria->add(PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES, $this->plugin_task_extended_properties);
} }
@@ -1792,6 +1848,8 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$copyObj->setPluginRestService($this->plugin_rest_service); $copyObj->setPluginRestService($this->plugin_rest_service);
$copyObj->setPluginCronFiles($this->plugin_cron_files);
$copyObj->setPluginTaskExtendedProperties($this->plugin_task_extended_properties); $copyObj->setPluginTaskExtendedProperties($this->plugin_task_extended_properties);
$copyObj->setPluginAttributes($this->plugin_attributes); $copyObj->setPluginAttributes($this->plugin_attributes);

View File

@@ -25,7 +25,7 @@ abstract class BasePluginsRegistryPeer
const CLASS_DEFAULT = 'classes.model.PluginsRegistry'; const CLASS_DEFAULT = 'classes.model.PluginsRegistry';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 24; const NUM_COLUMNS = 25;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -97,6 +97,9 @@ abstract class BasePluginsRegistryPeer
/** the column name for the PLUGIN_REST_SERVICE field */ /** the column name for the PLUGIN_REST_SERVICE field */
const PLUGIN_REST_SERVICE = 'PLUGINS_REGISTRY.PLUGIN_REST_SERVICE'; const PLUGIN_REST_SERVICE = 'PLUGINS_REGISTRY.PLUGIN_REST_SERVICE';
/** the column name for the PLUGIN_CRON_FILES field */
const PLUGIN_CRON_FILES = 'PLUGINS_REGISTRY.PLUGIN_CRON_FILES';
/** the column name for the PLUGIN_TASK_EXTENDED_PROPERTIES field */ /** the column name for the PLUGIN_TASK_EXTENDED_PROPERTIES field */
const PLUGIN_TASK_EXTENDED_PROPERTIES = 'PLUGINS_REGISTRY.PLUGIN_TASK_EXTENDED_PROPERTIES'; const PLUGIN_TASK_EXTENDED_PROPERTIES = 'PLUGINS_REGISTRY.PLUGIN_TASK_EXTENDED_PROPERTIES';
@@ -114,10 +117,10 @@ abstract class BasePluginsRegistryPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('PrUid', 'PluginNamespace', 'PluginDescription', 'PluginClassName', 'PluginFriendlyName', 'PluginFile', 'PluginFolder', 'PluginSetupPage', 'PluginCompanyLogo', 'PluginWorkspaces', 'PluginVersion', 'PluginEnable', 'PluginPrivate', 'PluginMenus', 'PluginFolders', 'PluginTriggers', 'PluginPmFunctions', 'PluginRedirectLogin', 'PluginSteps', 'PluginCss', 'PluginJs', 'PluginRestService', 'PluginTaskExtendedProperties', 'PluginAttributes', ), BasePeer::TYPE_PHPNAME => array ('PrUid', 'PluginNamespace', 'PluginDescription', 'PluginClassName', 'PluginFriendlyName', 'PluginFile', 'PluginFolder', 'PluginSetupPage', 'PluginCompanyLogo', 'PluginWorkspaces', 'PluginVersion', 'PluginEnable', 'PluginPrivate', 'PluginMenus', 'PluginFolders', 'PluginTriggers', 'PluginPmFunctions', 'PluginRedirectLogin', 'PluginSteps', 'PluginCss', 'PluginJs', 'PluginRestService', 'PluginCronFiles', 'PluginTaskExtendedProperties', 'PluginAttributes', ),
BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::PR_UID, PluginsRegistryPeer::PLUGIN_NAMESPACE, PluginsRegistryPeer::PLUGIN_DESCRIPTION, PluginsRegistryPeer::PLUGIN_CLASS_NAME, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME, PluginsRegistryPeer::PLUGIN_FILE, PluginsRegistryPeer::PLUGIN_FOLDER, PluginsRegistryPeer::PLUGIN_SETUP_PAGE, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO, PluginsRegistryPeer::PLUGIN_WORKSPACES, PluginsRegistryPeer::PLUGIN_VERSION, PluginsRegistryPeer::PLUGIN_ENABLE, PluginsRegistryPeer::PLUGIN_PRIVATE, PluginsRegistryPeer::PLUGIN_MENUS, PluginsRegistryPeer::PLUGIN_FOLDERS, PluginsRegistryPeer::PLUGIN_TRIGGERS, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN, PluginsRegistryPeer::PLUGIN_STEPS, PluginsRegistryPeer::PLUGIN_CSS, PluginsRegistryPeer::PLUGIN_JS, PluginsRegistryPeer::PLUGIN_REST_SERVICE, PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES, PluginsRegistryPeer::PLUGIN_ATTRIBUTES, ), BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::PR_UID, PluginsRegistryPeer::PLUGIN_NAMESPACE, PluginsRegistryPeer::PLUGIN_DESCRIPTION, PluginsRegistryPeer::PLUGIN_CLASS_NAME, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME, PluginsRegistryPeer::PLUGIN_FILE, PluginsRegistryPeer::PLUGIN_FOLDER, PluginsRegistryPeer::PLUGIN_SETUP_PAGE, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO, PluginsRegistryPeer::PLUGIN_WORKSPACES, PluginsRegistryPeer::PLUGIN_VERSION, PluginsRegistryPeer::PLUGIN_ENABLE, PluginsRegistryPeer::PLUGIN_PRIVATE, PluginsRegistryPeer::PLUGIN_MENUS, PluginsRegistryPeer::PLUGIN_FOLDERS, PluginsRegistryPeer::PLUGIN_TRIGGERS, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN, PluginsRegistryPeer::PLUGIN_STEPS, PluginsRegistryPeer::PLUGIN_CSS, PluginsRegistryPeer::PLUGIN_JS, PluginsRegistryPeer::PLUGIN_REST_SERVICE, PluginsRegistryPeer::PLUGIN_CRON_FILES, PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES, PluginsRegistryPeer::PLUGIN_ATTRIBUTES, ),
BasePeer::TYPE_FIELDNAME => array ('PR_UID', 'PLUGIN_NAMESPACE', 'PLUGIN_DESCRIPTION', 'PLUGIN_CLASS_NAME', 'PLUGIN_FRIENDLY_NAME', 'PLUGIN_FILE', 'PLUGIN_FOLDER', 'PLUGIN_SETUP_PAGE', 'PLUGIN_COMPANY_LOGO', 'PLUGIN_WORKSPACES', 'PLUGIN_VERSION', 'PLUGIN_ENABLE', 'PLUGIN_PRIVATE', 'PLUGIN_MENUS', 'PLUGIN_FOLDERS', 'PLUGIN_TRIGGERS', 'PLUGIN_PM_FUNCTIONS', 'PLUGIN_REDIRECT_LOGIN', 'PLUGIN_STEPS', 'PLUGIN_CSS', 'PLUGIN_JS', 'PLUGIN_REST_SERVICE', 'PLUGIN_TASK_EXTENDED_PROPERTIES', 'PLUGIN_ATTRIBUTES', ), BasePeer::TYPE_FIELDNAME => array ('PR_UID', 'PLUGIN_NAMESPACE', 'PLUGIN_DESCRIPTION', 'PLUGIN_CLASS_NAME', 'PLUGIN_FRIENDLY_NAME', 'PLUGIN_FILE', 'PLUGIN_FOLDER', 'PLUGIN_SETUP_PAGE', 'PLUGIN_COMPANY_LOGO', 'PLUGIN_WORKSPACES', 'PLUGIN_VERSION', 'PLUGIN_ENABLE', 'PLUGIN_PRIVATE', 'PLUGIN_MENUS', 'PLUGIN_FOLDERS', 'PLUGIN_TRIGGERS', 'PLUGIN_PM_FUNCTIONS', 'PLUGIN_REDIRECT_LOGIN', 'PLUGIN_STEPS', 'PLUGIN_CSS', 'PLUGIN_JS', 'PLUGIN_REST_SERVICE', 'PLUGIN_CRON_FILES', 'PLUGIN_TASK_EXTENDED_PROPERTIES', 'PLUGIN_ATTRIBUTES', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, )
); );
/** /**
@@ -127,10 +130,10 @@ abstract class BasePluginsRegistryPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('PrUid' => 0, 'PluginNamespace' => 1, 'PluginDescription' => 2, 'PluginClassName' => 3, 'PluginFriendlyName' => 4, 'PluginFile' => 5, 'PluginFolder' => 6, 'PluginSetupPage' => 7, 'PluginCompanyLogo' => 8, 'PluginWorkspaces' => 9, 'PluginVersion' => 10, 'PluginEnable' => 11, 'PluginPrivate' => 12, 'PluginMenus' => 13, 'PluginFolders' => 14, 'PluginTriggers' => 15, 'PluginPmFunctions' => 16, 'PluginRedirectLogin' => 17, 'PluginSteps' => 18, 'PluginCss' => 19, 'PluginJs' => 20, 'PluginRestService' => 21, 'PluginTaskExtendedProperties' => 22, 'PluginAttributes' => 23, ), BasePeer::TYPE_PHPNAME => array ('PrUid' => 0, 'PluginNamespace' => 1, 'PluginDescription' => 2, 'PluginClassName' => 3, 'PluginFriendlyName' => 4, 'PluginFile' => 5, 'PluginFolder' => 6, 'PluginSetupPage' => 7, 'PluginCompanyLogo' => 8, 'PluginWorkspaces' => 9, 'PluginVersion' => 10, 'PluginEnable' => 11, 'PluginPrivate' => 12, 'PluginMenus' => 13, 'PluginFolders' => 14, 'PluginTriggers' => 15, 'PluginPmFunctions' => 16, 'PluginRedirectLogin' => 17, 'PluginSteps' => 18, 'PluginCss' => 19, 'PluginJs' => 20, 'PluginRestService' => 21, 'PluginCronFiles' => 22, 'PluginTaskExtendedProperties' => 23, 'PluginAttributes' => 24, ),
BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::PR_UID => 0, PluginsRegistryPeer::PLUGIN_NAMESPACE => 1, PluginsRegistryPeer::PLUGIN_DESCRIPTION => 2, PluginsRegistryPeer::PLUGIN_CLASS_NAME => 3, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME => 4, PluginsRegistryPeer::PLUGIN_FILE => 5, PluginsRegistryPeer::PLUGIN_FOLDER => 6, PluginsRegistryPeer::PLUGIN_SETUP_PAGE => 7, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO => 8, PluginsRegistryPeer::PLUGIN_WORKSPACES => 9, PluginsRegistryPeer::PLUGIN_VERSION => 10, PluginsRegistryPeer::PLUGIN_ENABLE => 11, PluginsRegistryPeer::PLUGIN_PRIVATE => 12, PluginsRegistryPeer::PLUGIN_MENUS => 13, PluginsRegistryPeer::PLUGIN_FOLDERS => 14, PluginsRegistryPeer::PLUGIN_TRIGGERS => 15, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS => 16, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN => 17, PluginsRegistryPeer::PLUGIN_STEPS => 18, PluginsRegistryPeer::PLUGIN_CSS => 19, PluginsRegistryPeer::PLUGIN_JS => 20, PluginsRegistryPeer::PLUGIN_REST_SERVICE => 21, PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES => 22, PluginsRegistryPeer::PLUGIN_ATTRIBUTES => 23, ), BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::PR_UID => 0, PluginsRegistryPeer::PLUGIN_NAMESPACE => 1, PluginsRegistryPeer::PLUGIN_DESCRIPTION => 2, PluginsRegistryPeer::PLUGIN_CLASS_NAME => 3, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME => 4, PluginsRegistryPeer::PLUGIN_FILE => 5, PluginsRegistryPeer::PLUGIN_FOLDER => 6, PluginsRegistryPeer::PLUGIN_SETUP_PAGE => 7, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO => 8, PluginsRegistryPeer::PLUGIN_WORKSPACES => 9, PluginsRegistryPeer::PLUGIN_VERSION => 10, PluginsRegistryPeer::PLUGIN_ENABLE => 11, PluginsRegistryPeer::PLUGIN_PRIVATE => 12, PluginsRegistryPeer::PLUGIN_MENUS => 13, PluginsRegistryPeer::PLUGIN_FOLDERS => 14, PluginsRegistryPeer::PLUGIN_TRIGGERS => 15, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS => 16, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN => 17, PluginsRegistryPeer::PLUGIN_STEPS => 18, PluginsRegistryPeer::PLUGIN_CSS => 19, PluginsRegistryPeer::PLUGIN_JS => 20, PluginsRegistryPeer::PLUGIN_REST_SERVICE => 21, PluginsRegistryPeer::PLUGIN_CRON_FILES => 22, PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES => 23, PluginsRegistryPeer::PLUGIN_ATTRIBUTES => 24, ),
BasePeer::TYPE_FIELDNAME => array ('PR_UID' => 0, 'PLUGIN_NAMESPACE' => 1, 'PLUGIN_DESCRIPTION' => 2, 'PLUGIN_CLASS_NAME' => 3, 'PLUGIN_FRIENDLY_NAME' => 4, 'PLUGIN_FILE' => 5, 'PLUGIN_FOLDER' => 6, 'PLUGIN_SETUP_PAGE' => 7, 'PLUGIN_COMPANY_LOGO' => 8, 'PLUGIN_WORKSPACES' => 9, 'PLUGIN_VERSION' => 10, 'PLUGIN_ENABLE' => 11, 'PLUGIN_PRIVATE' => 12, 'PLUGIN_MENUS' => 13, 'PLUGIN_FOLDERS' => 14, 'PLUGIN_TRIGGERS' => 15, 'PLUGIN_PM_FUNCTIONS' => 16, 'PLUGIN_REDIRECT_LOGIN' => 17, 'PLUGIN_STEPS' => 18, 'PLUGIN_CSS' => 19, 'PLUGIN_JS' => 20, 'PLUGIN_REST_SERVICE' => 21, 'PLUGIN_TASK_EXTENDED_PROPERTIES' => 22, 'PLUGIN_ATTRIBUTES' => 23, ), BasePeer::TYPE_FIELDNAME => array ('PR_UID' => 0, 'PLUGIN_NAMESPACE' => 1, 'PLUGIN_DESCRIPTION' => 2, 'PLUGIN_CLASS_NAME' => 3, 'PLUGIN_FRIENDLY_NAME' => 4, 'PLUGIN_FILE' => 5, 'PLUGIN_FOLDER' => 6, 'PLUGIN_SETUP_PAGE' => 7, 'PLUGIN_COMPANY_LOGO' => 8, 'PLUGIN_WORKSPACES' => 9, 'PLUGIN_VERSION' => 10, 'PLUGIN_ENABLE' => 11, 'PLUGIN_PRIVATE' => 12, 'PLUGIN_MENUS' => 13, 'PLUGIN_FOLDERS' => 14, 'PLUGIN_TRIGGERS' => 15, 'PLUGIN_PM_FUNCTIONS' => 16, 'PLUGIN_REDIRECT_LOGIN' => 17, 'PLUGIN_STEPS' => 18, 'PLUGIN_CSS' => 19, 'PLUGIN_JS' => 20, 'PLUGIN_REST_SERVICE' => 21, 'PLUGIN_CRON_FILES' => 22, 'PLUGIN_TASK_EXTENDED_PROPERTIES' => 23, 'PLUGIN_ATTRIBUTES' => 24, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, )
); );
/** /**
@@ -275,6 +278,8 @@ abstract class BasePluginsRegistryPeer
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_REST_SERVICE); $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_REST_SERVICE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_CRON_FILES);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES); $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_TASK_EXTENDED_PROPERTIES);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_ATTRIBUTES); $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_ATTRIBUTES);

View File

@@ -5739,6 +5739,7 @@
<column name="PLUGIN_CSS" type="LONGVARCHAR"/> <column name="PLUGIN_CSS" type="LONGVARCHAR"/>
<column name="PLUGIN_JS" type="LONGVARCHAR"/> <column name="PLUGIN_JS" type="LONGVARCHAR"/>
<column name="PLUGIN_REST_SERVICE" type="LONGVARCHAR"/> <column name="PLUGIN_REST_SERVICE" type="LONGVARCHAR"/>
<column name="PLUGIN_CRON_FILES" type="LONGVARCHAR"/>
<column name="PLUGIN_TASK_EXTENDED_PROPERTIES" type="LONGVARCHAR"/> <column name="PLUGIN_TASK_EXTENDED_PROPERTIES" type="LONGVARCHAR"/>
<column name="PLUGIN_ATTRIBUTES" type="LONGVARCHAR"/> <column name="PLUGIN_ATTRIBUTES" type="LONGVARCHAR"/>
</table> </table>

View File

@@ -3181,6 +3181,7 @@ CREATE TABLE `PLUGINS_REGISTRY`
`PLUGIN_CSS` MEDIUMTEXT, `PLUGIN_CSS` MEDIUMTEXT,
`PLUGIN_JS` MEDIUMTEXT, `PLUGIN_JS` MEDIUMTEXT,
`PLUGIN_REST_SERVICE` MEDIUMTEXT, `PLUGIN_REST_SERVICE` MEDIUMTEXT,
`PLUGIN_CRON_FILES` MEDIUMTEXT,
`PLUGIN_TASK_EXTENDED_PROPERTIES` MEDIUMTEXT, `PLUGIN_TASK_EXTENDED_PROPERTIES` MEDIUMTEXT,
`PLUGIN_ATTRIBUTES` MEDIUMTEXT, `PLUGIN_ATTRIBUTES` MEDIUMTEXT,
PRIMARY KEY (`PR_UID`) PRIMARY KEY (`PR_UID`)

View File

@@ -1127,9 +1127,9 @@ try {
$sNamespace = ''; $sNamespace = '';
$sStepName = ''; $sStepName = '';
foreach ($externalSteps as $key => $val) { foreach ($externalSteps as $key => $val) {
if ($val->sStepId == $_GET['UID']) { if ($val->getStepId() == $_GET['UID']) {
$sNamespace = $val->sNamespace; $sNamespace = $val->getNamespace();
$sStepName = $val->sStepName; $sStepName = $val->getStepName();
} }
} }

View File

@@ -90,6 +90,7 @@ class PluginAdapter
'_aJavascripts' => ['name' => 'PLUGIN_JS', 'type' => 'array'], '_aJavascripts' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
'_aJs' => ['name' => 'PLUGIN_JS', 'type' => 'array'], '_aJs' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
'_restServices' => ['name' => 'PLUGIN_REST_SERVICE', 'type' => 'array'], '_restServices' => ['name' => 'PLUGIN_REST_SERVICE', 'type' => 'array'],
'_aCronFiles' => ['name' => 'PLUGIN_CRON_FILES', 'type' => 'array'],
'_aTaskExtendedProperties' => ['name' => 'PLUGIN_TASK_EXTENDED_PROPERTIES', 'type' => 'array'], '_aTaskExtendedProperties' => ['name' => 'PLUGIN_TASK_EXTENDED_PROPERTIES', 'type' => 'array'],
]; ];

View File

@@ -53,4 +53,24 @@ class CronFile
{ {
return $CronFile == $this->CronFile; return $CronFile == $this->CronFile;
} }
/**
* Get plugin name
*
* @return string
*/
public function getNamespace()
{
return $this->Namespace;
}
/**
* Get Cron file
*
* @return string
*/
public function getCronFile()
{
return $this->CronFile;
}
} }

View File

@@ -1354,22 +1354,23 @@ class PluginRegistry
/** /**
* Register a cron file * Register a cron file
* @param string $Namespace Name of Plugin * @param string $pluginName Name of Plugin
* @param string $CronFile * @param string $cronFileToRegister
*/ */
public function registerCronFile($Namespace, $CronFile) public function registerCronFile($pluginName, $cronFileToRegister)
{ {
$found = false; $found = false;
/** @var CronFile $cronFile */ /** @var CronFile $cronFile */
foreach ($this->_aCronFiles as $cronFile) { foreach ($this->_aCronFiles as $cronFile) {
if ($cronFile->equalCronFileTo($CronFile) && $cronFile->equalNamespaceTo($Namespace)) { if ($cronFile instanceof CronFile &&
$cronFile->setCronFile($CronFile); $cronFile->equalNamespaceTo($pluginName) &&
$cronFile->equalCronFileTo($cronFileToRegister)) {
$cronFile->setCronFile($cronFileToRegister);
$found = true; $found = true;
} }
} }
if (!$found) { if (!$found) {
$CronFile = new CronFile($Namespace, $CronFile); $this->_aCronFiles[] = new CronFile($pluginName, $cronFileToRegister);
$this->_aCronFiles[] = $CronFile;
} }
} }

View File

@@ -5,6 +5,7 @@ namespace ProcessMaker\Plugins\Traits;
use BasePeer; use BasePeer;
use G; use G;
use PluginsRegistry; use PluginsRegistry;
use ProcessMaker\Plugins\Interfaces\CronFile;
use ProcessMaker\Plugins\Interfaces\CssFile; use ProcessMaker\Plugins\Interfaces\CssFile;
use ProcessMaker\Plugins\Interfaces\FolderDetail; use ProcessMaker\Plugins\Interfaces\FolderDetail;
use ProcessMaker\Plugins\Interfaces\JsFile; use ProcessMaker\Plugins\Interfaces\JsFile;
@@ -116,6 +117,7 @@ trait PluginStructure
$this->buildCss(G::json_decode($plugin['PluginCss'], true)); $this->buildCss(G::json_decode($plugin['PluginCss'], true));
$this->buildJs(G::json_decode($plugin['PluginJs'], true)); $this->buildJs(G::json_decode($plugin['PluginJs'], true));
$this->buildRestService(G::json_decode($plugin['PluginRestService'], true)); $this->buildRestService(G::json_decode($plugin['PluginRestService'], true));
$this->buildCronFiles($plugin['PluginNamespace'], G::json_decode($plugin['PluginCronFiles'], true));
$this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes'])); $this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes']));
} }
} }
@@ -261,6 +263,23 @@ trait PluginStructure
$this->_restServices = array_merge($this->_restServices, $restServices); $this->_restServices = array_merge($this->_restServices, $restServices);
} }
/**
* Builds an array with the Cron Files configurations and set to the respective attribute
*
* @param string $pluginName
* @param array $cronFilesToAdd
*/
private function buildCronFiles($pluginName, $cronFilesToAdd)
{
$cronFiles = [];
if ($cronFilesToAdd) {
foreach ($cronFilesToAdd as $cronFile) {
$cronFiles[] = new CronFile($pluginName, $cronFile['CronFile']);
}
}
$this->_aCronFiles = array_merge($this->_aCronFiles, $cronFiles);
}
/** /**
* Build other properties that are not considered in the schema of the table * Build other properties that are not considered in the schema of the table
* @param string $namespace * @param string $namespace