This commit is contained in:
Ronald Quenta
2017-08-10 12:10:42 -04:00
parent dc7abaae6b
commit 94a2db1e23
20 changed files with 125 additions and 104 deletions

View File

@@ -24,6 +24,8 @@
* *
*/ */
use ProcessMaker\Plugins\PluginRegistry;
/** /**
* @package gulliver.system * @package gulliver.system
*/ */
@@ -502,7 +504,7 @@ class G
* *
* @return void * @return void
*/ */
public function rm_dir ($dirName) public static function rm_dir ($dirName)
{ {
if (! is_writable( $dirName )) { if (! is_writable( $dirName )) {
return false; return false;
@@ -5042,9 +5044,9 @@ class G
$restClasses = array_merge( $restClasses, $pluginRestClasses ); $restClasses = array_merge( $restClasses, $pluginRestClasses );
} }
// hook to get rest api classes from plugins // hook to get rest api classes from plugins
if (class_exists( 'PMPluginRegistry' )) { if (class_exists( 'ProcessMaker\Plugins\PluginRegistry' )) {
$pluginRegistry = & PMPluginRegistry::getSingleton(); $pluginRegistry = PluginRegistry::loadSingleton();
$pluginClasses = $pluginRegistry->getRegisteredRestClassFiles(); $pluginClasses = $pluginRegistry->getRegisteredRestServices();
$restClasses = array_merge( $restClasses, $pluginClasses ); $restClasses = array_merge( $restClasses, $pluginClasses );
} }
foreach ($restClasses as $key => $classFile) { foreach ($restClasses as $key => $classFile) {

View File

@@ -25,6 +25,8 @@
* *
*/ */
use ProcessMaker\Plugins\PluginRegistry;
/** /**
* Class headPublisher * Class headPublisher
* *
@@ -387,7 +389,7 @@ class headPublisher
// Load external/plugin css // Load external/plugin css
// NOTE is necesary to move this to decorator server // NOTE is necesary to move this to decorator server
if (class_exists('PMPluginRegistry') && defined('SYS_SYS')) { if (class_exists('PMPluginRegistry') && defined('SYS_SYS')) {
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
$registeredCss = $oPluginRegistry->getRegisteredCss(); $registeredCss = $oPluginRegistry->getRegisteredCss();
/** @var \ProcessMaker\Plugins\Interfaces\CssFile $cssFile */ /** @var \ProcessMaker\Plugins\Interfaces\CssFile $cssFile */
foreach ($registeredCss as $cssFile) { foreach ($registeredCss as $cssFile) {
@@ -505,7 +507,7 @@ class headPublisher
$flagPlugin = false; $flagPlugin = false;
$keyPlugin = count($aux)-2; $keyPlugin = count($aux)-2;
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[$keyPlugin])) { if ($oPluginRegistry->isRegisteredFolder($aux[$keyPlugin])) {
$flagPlugin = true; $flagPlugin = true;
} else { } else {
@@ -682,7 +684,7 @@ class headPublisher
$aux = explode(PATH_SEP, $file); $aux = explode(PATH_SEP, $file);
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) {
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[0])) { if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
$sPath = PATH_PLUGINS; $sPath = PATH_PLUGINS;
} }

View File

@@ -197,12 +197,12 @@ class RbacUsers extends BaseRbacUsers
public function create($aData) public function create($aData)
{ {
if (class_exists('PMPluginRegistry')) { if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$pluginRegistry = PluginRegistry::loadSingleton(); $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) { if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
try { try {
$pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null); $pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);
} catch(Exception $error) { } catch (Exception $error) {
throw new Exception($error->getMessage()); throw new Exception($error->getMessage());
} }
} }

View File

@@ -126,7 +126,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/ */
public function getDatabaseInfo() public function getDatabaseInfo()
{ {
require_once 'creole/drivers/mysql/metadata/MySQLDatabaseInfo.php';
return new MySQLDatabaseInfo($this); return new MySQLDatabaseInfo($this);
} }
@@ -135,7 +134,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/ */
public function getIdGenerator() public function getIdGenerator()
{ {
require_once 'creole/drivers/mysql/MySQLIdGenerator.php';
return new MySQLIdGenerator($this); return new MySQLIdGenerator($this);
} }
@@ -144,7 +142,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/ */
public function prepareStatement($sql) public function prepareStatement($sql)
{ {
require_once 'creole/drivers/mysql/MySQLPreparedStatement.php';
return new MySQLPreparedStatement($this, $sql); return new MySQLPreparedStatement($this, $sql);
} }
@@ -160,7 +157,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/ */
public function createStatement() public function createStatement()
{ {
require_once 'creole/drivers/mysql/MySQLStatement.php';
return new MySQLStatement($this); return new MySQLStatement($this);
} }

View File

@@ -495,8 +495,6 @@ class Propel {
throw new PropelException("No connection params set for " . $name); throw new PropelException("No connection params set for " . $name);
} }
} }
include_once 'creole/Creole.php';
// if specified, use custom driver // if specified, use custom driver
if (isset(self::$configuration['datasources'][$name]['driver'])) { if (isset(self::$configuration['datasources'][$name]['driver'])) {
Creole::registerDriver($dsn['phptype'], self::$configuration['datasources'][$name]['driver']); Creole::registerDriver($dsn['phptype'], self::$configuration['datasources'][$name]['driver']);

View File

@@ -179,12 +179,6 @@ try {
eprintln('WARNING! No server info found!', 'red'); eprintln('WARNING! No server info found!', 'red');
} }
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
if (file_exists($sSerializedFile)) {
$pluginRegistry = PMPluginRegistry::loadSingleton($sSerializedFile);
}
//DB //DB
$phpCode = ''; $phpCode = '';

View File

@@ -72,7 +72,7 @@ function flush_cache($workspace)
echo " Update singleton in workspace " . $workspace->name . " ... "; echo " Update singleton in workspace " . $workspace->name . " ... ";
echo PHP_EOL; echo PHP_EOL;
echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL; echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL;
$status = \ProcessMaker\Util\System::flushCache($workspace); \ProcessMaker\Util\System::flushCache($workspace);
echo "DONE" . PHP_EOL; echo "DONE" . PHP_EOL;
} catch (Exception $e) { } catch (Exception $e) {
echo $e->getMessage() . PHP_EOL; echo $e->getMessage() . PHP_EOL;

View File

@@ -84,7 +84,7 @@ class PmInstaller
* @param string $name Default value "workflow" * @param string $name Default value "workflow"
* @return string file_exists(PATH_DATA."sites/".$name); * @return string file_exists(PATH_DATA."sites/".$name);
*/ */
public function isset_site($name = "workflow") public static function isset_site($name = "workflow")
{ {
$pathSites = PATH_DATA . 'sites/'. '*'; $pathSites = PATH_DATA . 'sites/'. '*';
$directories = glob($pathSites, GLOB_ONLYDIR); $directories = glob($pathSites, GLOB_ONLYDIR);

View File

@@ -24,6 +24,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
use ProcessMaker\Plugins\PluginRegistry;
/** /**
* *
* @package workflow.engine.ProcessMaker * @package workflow.engine.ProcessMaker
@@ -368,12 +371,13 @@ class ProcessMap
$oPM->derivation = array('Sequential', 'Evaluate (manual)', 'Evaluate (auto)', 'Parallel (fork)', 'Parallel by evaluation (fork)', 'Parallel (sequential join)', 'Parallel (sequential main join)' ); $oPM->derivation = array('Sequential', 'Evaluate (manual)', 'Evaluate (auto)', 'Parallel (fork)', 'Parallel by evaluation (fork)', 'Parallel (sequential join)', 'Parallel (sequential main join)' );
//Load extended task properties from plugin. By JHL Jan 18, 2011 //Load extended task properties from plugin. By JHL Jan 18, 2011
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\TaskExtendedProperty[] $activePluginsForTaskProperties */
$activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties(); $activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
$oPM->taskOptions = array(); $oPM->taskOptions = array();
foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) { foreach ($activePluginsForTaskProperties as $taskPropertiesInfo) {
$taskOption['title'] = $taskPropertiesInfo->sName; $taskOption['title'] = $taskPropertiesInfo->getName();
$taskOption['id'] = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName; $taskOption['id'] = $taskPropertiesInfo->getNamespace() . "--" . $taskPropertiesInfo->getName();
$oPM->taskOptions[] = $taskOption; $oPM->taskOptions[] = $taskOption;
} }
@@ -745,7 +749,8 @@ class ProcessMap
{ {
try { try {
//call plugin //call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps(); $externalSteps = $oPluginRegistry->getSteps();
$aSteps = array(); $aSteps = array();
@@ -795,9 +800,9 @@ class ProcessMap
case 'EXTERNAL': case 'EXTERNAL':
$sTitle = 'unknown ' . $aRow['STEP_UID']; $sTitle = 'unknown ' . $aRow['STEP_UID'];
foreach ($externalSteps as $key => $val) { foreach ($externalSteps as $key => $val) {
if ($val->sStepId == $aRow['STEP_UID_OBJ']) { if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
$sTitle = $val->sStepTitle; $sTitle = $val->getStepTitle();
if (trim($val->sSetupStepPage) != '') { if (trim($val->getSetupStepPage()) != '') {
$urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');"; $urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');";
$linkEditValue = 'Edit'; $linkEditValue = 'Edit';
} else { } else {
@@ -929,11 +934,17 @@ class ProcessMap
} }
//call plugin //call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps(); $externalSteps = $oPluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) { if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $stepVar) { foreach ($externalSteps as $key => $stepVar) {
$aBB[] = array('STEP_UID' => $stepVar->sStepId, 'STEP_TITLE' => $stepVar->sStepTitle, 'STEP_TYPE_OBJ' => 'EXTERNAL', 'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->sStepId . '">' ); $aBB[] = array(
'STEP_UID' => $stepVar->getStepId(),
'STEP_TITLE' => $stepVar->getStepTitle(),
'STEP_TYPE_OBJ' => 'EXTERNAL',
'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->getStepId() . '">'
);
} }
} }
global $_DBArray; global $_DBArray;
@@ -1363,12 +1374,13 @@ class ProcessMap
break; break;
default: default:
//if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011 //if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\TaskExtendedProperty[] $activePluginsForTaskProperties */
$activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties(); $activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) { foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {
$id = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName; $id = $taskPropertiesInfo->getNamespace() . "--" . $taskPropertiesInfo->getName();
if ($id == $iForm) { if ($id == $iForm) {
$sFilename = $taskPropertiesInfo->sPage; $sFilename = $taskPropertiesInfo->getPage();
$sw_template = true; $sw_template = true;
} }
} }
@@ -4697,10 +4709,6 @@ class ProcessMap
public function getDynaformList($sTaskUID = '') public function getDynaformList($sTaskUID = '')
{ {
try { try {
//call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$aSteps = array(); $aSteps = array();
//$aSteps [] = array ('STEP_TITLE' => 'char', 'STEP_UID' => 'char', 'STEP_TYPE_OBJ' => 'char', 'STEP_CONDITION' => 'char', 'STEP_POSITION' => 'integer' ); //$aSteps [] = array ('STEP_TITLE' => 'char', 'STEP_UID' => 'char', 'STEP_TYPE_OBJ' => 'char', 'STEP_CONDITION' => 'char', 'STEP_POSITION' => 'integer' );
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
@@ -5131,11 +5139,17 @@ class ProcessMap
} }
//call plugin //call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps(); $externalSteps = $oPluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) { if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $stepVar) { foreach ($externalSteps as $key => $stepVar) {
$aBB[] = array('STEP_UID' => $stepVar->sStepId, 'STEP_TITLE' => $stepVar->sStepTitle, 'STEP_TYPE_OBJ' => 'EXTERNAL', 'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->sStepId . '">' ); $aBB[] = array(
'STEP_UID' => $stepVar->getStepId(),
'STEP_TITLE' => $stepVar->getStepTitle(),
'STEP_TYPE_OBJ' => 'EXTERNAL',
'STEP_MODE' => '<input type="hidden" id="STEP_MODE_' . $stepVar->getStepId() . '">'
);
} }
} }
@@ -5180,7 +5194,8 @@ class ProcessMap
{ {
try { try {
//call plugin //call plugin
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps(); $externalSteps = $oPluginRegistry->getSteps();
$aSteps = array(); $aSteps = array();
@@ -5239,10 +5254,10 @@ class ProcessMap
case 'EXTERNAL': case 'EXTERNAL':
$sTitle = 'unknown ' . $aRow['STEP_UID']; $sTitle = 'unknown ' . $aRow['STEP_UID'];
foreach ($externalSteps as $key => $val) { foreach ($externalSteps as $key => $val) {
if ($val->sStepId == $aRow['STEP_UID_OBJ']) { if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
$sTitle = $val->sStepTitle; $sTitle = $val->getStepTitle();
if (trim($val->sSetupStepPage) != '') { 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

@@ -504,7 +504,7 @@ class PMPlugin
$aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php'; $aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php';
} }
} }
$oPluginRegistry = PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
if ($handle = opendir(PATH_PLUGINS)) { if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
if (in_array($file, $aPluginsPP)) { if (in_array($file, $aPluginsPP)) {
@@ -512,23 +512,24 @@ class PMPlugin
} }
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) { if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file); include_once (PATH_PLUGINS . $file);
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $pluginDetail */
$pluginDetail = $oPluginRegistry->getPluginDetails($file); $pluginDetail = $oPluginRegistry->getPluginDetails($file);
if ($pluginDetail === null) { if ($pluginDetail === null) {
continue; continue;
} }
$status_label = $pluginDetail->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); $status_label = $pluginDetail->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
$status = $pluginDetail->enabled ? 1 : 0; $status = $pluginDetail->isEnabled();
if (isset($pluginDetail->aWorkspaces)) { if ($pluginDetail->getWorkspaces()) {
if (!is_array($pluginDetail->aWorkspaces)) { if (!is_array($pluginDetail->getWorkspaces())) {
$pluginDetail->aWorkspaces = array(); $pluginDetail->setWorkspaces(array());
} }
if (!in_array($workspace, $pluginDetail->aWorkspaces)) { if (!in_array($workspace, $pluginDetail->getWorkspaces())) {
continue; continue;
} }
} }
$setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0'; $setup = $pluginDetail->getSetupPage() != '' && $pluginDetail->isEnabled() ? '1' : '0';
if (isset($pluginDetail) && !$pluginDetail->bPrivate) { if (isset($pluginDetail) && !$pluginDetail->isPrivate()) {
$items[] = [ $items[] = [
'id' => (count($items) + 1), 'id' => (count($items) + 1),
'namespace' => $pluginDetail->sNamespace, 'namespace' => $pluginDetail->sNamespace,
@@ -559,14 +560,13 @@ class PMPlugin
*/ */
public static function getListAllPlugins($workspace) public static function getListAllPlugins($workspace)
{ {
PMPluginRegistry::saveState(); $oPluginRegistry = PluginRegistry::loadSingleton();
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP . "plugin.singleton";
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
$items = []; $items = [];
if ($handle = opendir(PATH_PLUGINS)) { if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) { if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file); include_once (PATH_PLUGINS . $file);
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $detail */
$detail = $oPluginRegistry->getPluginDetails($file); $detail = $oPluginRegistry->getPluginDetails($file);
if ($detail !== null) { if ($detail !== null) {
$items[] = $detail; $items[] = $detail;
@@ -575,7 +575,6 @@ class PMPlugin
} }
closedir($handle); closedir($handle);
} }
PMPluginRegistry::restoreState();
return $items; return $items;
} }

View File

@@ -269,7 +269,7 @@ class pmLicenseManager
public function unSerializeInstance($serialized) public function unSerializeInstance($serialized)
{ {
if (self::$instance == null) { if (self::$instance == null) {
self::$instance = new PMPluginRegistry (); self::$instance = new PluginRegistry();
} }
$instance = unserialize ( $serialized ); $instance = unserialize ( $serialized );
self::$instance = $instance; self::$instance = $instance;

View File

@@ -93,7 +93,7 @@ class triggerLibrary
function unSerializeInstance ($serialized) function unSerializeInstance ($serialized)
{ {
if (self::$instance == NULL) { if (self::$instance == NULL) {
self::$instance = new PMPluginRegistry(); self::$instance = new PluginRegistry();
} }
$instance = unserialize( $serialized ); $instance = unserialize( $serialized );

View File

@@ -1654,7 +1654,7 @@ class workspaceTools
if (count($metaFiles) > 1 && (!isset($srcWorkspace))) { if (count($metaFiles) > 1 && (!isset($srcWorkspace))) {
throw new Exception("Multiple workspaces in backup but no workspace specified to restore"); throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
} }
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(BASENAME, $metaFiles))) { if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map('basename', $metaFiles))) {
throw new Exception("Workspace $srcWorkspace not found in backup"); throw new Exception("Workspace $srcWorkspace not found in backup");
} }

View File

@@ -474,7 +474,7 @@ class Main extends Controller
$sWspaceSelect = trim( $aFotoSelect['WORKSPACE_LOGO_NAME'] ); $sWspaceSelect = trim( $aFotoSelect['WORKSPACE_LOGO_NAME'] );
} }
} }
if (class_exists( 'PMPluginRegistry' )) { if (class_exists( 'ProcessMaker\Plugins\PluginRegistry' )) {
$oPluginRegistry = PluginRegistry::loadSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
$logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo ); $logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo );
if ($logoPlugin != '/images/processmaker2.logo2.png') { if ($logoPlugin != '/images/processmaker2.logo2.png') {

View File

@@ -22,7 +22,12 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
use ProcessMaker\Plugins\PluginRegistry;
/** @var RBAC $RBAC */
global $RBAC; global $RBAC;
/** @var Menu $G_TMP_MENU */
global $G_TMP_MENU; global $G_TMP_MENU;
$G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOLDERS'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOLDERS'), '', '', 'blockHeader');
@@ -48,10 +53,6 @@ $G_TMP_MENU->AddIdRawOption('CASES_SELFSERVICE', 'casesListExtJs?action=selfserv
$G_TMP_MENU->AddIdRawOption('CASES_PAUSED', 'casesListExtJs?action=paused', G::LoadTranslation('ID_PAUSED'), $G_TMP_MENU->AddIdRawOption('CASES_PAUSED', 'casesListExtJs?action=paused', G::LoadTranslation('ID_PAUSED'),
'mail-queue.png'); 'mail-queue.png');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
//$G_TMP_MENU->AddIdRawOption('CASES_GRAL', 'casesListExtJs?action=gral', G::LoadTranslation('ID_GENERAL'));
}
$G_TMP_MENU->AddIdRawOption('SEARCHS', '', G::LoadTranslation('ID_CASES_MENU_SEARCH'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('SEARCHS', '', G::LoadTranslation('ID_CASES_MENU_SEARCH'), '', '', 'blockHeader');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) { if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
@@ -77,14 +78,15 @@ if ($RBAC->userCanAccess('PM_FOLDERS_VIEW') == 1) {
//Load Other registered Dashboards (From plugins) //Load Other registered Dashboards (From plugins)
$oPluginRegistry = & PMPluginRegistry::getSingleton (); $oPluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\DashboardPage[] $dashBoardPages */
$dashBoardPages = $oPluginRegistry->getDashboardPages (); $dashBoardPages = $oPluginRegistry->getDashboardPages ();
if (count($dashBoardPages)>0) { if (count($dashBoardPages)>0) {
$G_TMP_MENU->AddIdRawOption('PLUGINS', '', G::LoadTranslation('ID_PLUGINS'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('PLUGINS', '', G::LoadTranslation('ID_PLUGINS'), '', '', 'blockHeader');
foreach ($dashBoardPages as $key => $tabInfo) { foreach ($dashBoardPages as $key => $tabInfo) {
$tabNameSpace=$tabInfo->sNamespace; $tabNameSpace=$tabInfo->getNamespace();
$tabName=$tabInfo->sName; $tabName=$tabInfo->getName();
$tabIcon=str_replace("ICON_","",$tabInfo->sIcon); $tabIcon=str_replace("ICON_","",$tabInfo->getIcon());
if ($tabName!= "") { if ($tabName!= "") {
$G_TMP_MENU->AddIdRawOption($tabIcon, 'casesStartPage?action='.$tabNameSpace.'-'.$tabName, $G_TMP_MENU->AddIdRawOption($tabIcon, 'casesStartPage?action='.$tabNameSpace.'-'.$tabName,
ucwords(strtolower($tabName)), ''); ucwords(strtolower($tabName)), '');

View File

@@ -21,6 +21,10 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
use ProcessMaker\Plugins\PluginRegistry;
/** @var RBAC $RBAC */
global $RBAC; global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' ); $RBAC->requirePermissions( 'PM_SETUP' );
@@ -29,7 +33,7 @@ $headPublisher->addExtJsScript( 'setup/pluginsMain', false );
$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN ); $headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign( "SYS_SKIN", SYS_SKIN ); $headPublisher->assign( "SYS_SKIN", SYS_SKIN );
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') && $oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') == "enabled") { if ($oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') && $oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') == "enabled") {
$headPublisher = $oPluginRegistry->executeMethod('pmWorkspaceManagement', 'disableButtonsPluginMain', $headPublisher); $headPublisher = $oPluginRegistry->executeMethod('pmWorkspaceManagement', 'disableButtonsPluginMain', $headPublisher);
} }

View File

@@ -451,7 +451,7 @@ class SkinEngine
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html'); $smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html');
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html'); $smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
if (class_exists('PMPluginRegistry')) { if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$oPluginRegistry = PluginRegistry::loadSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg'); $sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
} }
@@ -535,7 +535,7 @@ class SkinEngine
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html' ); $smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html' );
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html' ); $smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html' );
if (class_exists('PMPluginRegistry')) { if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$oPluginRegistry = PluginRegistry::loadSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo ( '/images/processmaker.logo.jpg' ); $sCompanyLogo = $oPluginRegistry->getCompanyLogo ( '/images/processmaker.logo.jpg' );
} }

View File

@@ -22,7 +22,7 @@ use IsoLocationPeer;
use IsoSubdivisionPeer; use IsoSubdivisionPeer;
use ListParticipatedLast; use ListParticipatedLast;
use PMmemcached; use PMmemcached;
use PMPluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Util\DateTime; use ProcessMaker\Util\DateTime;
use ProcessMaker\Util\System; use ProcessMaker\Util\System;
use Propel; use Propel;
@@ -869,7 +869,7 @@ class User
public function createUser($userData) public function createUser($userData)
{ {
$this->userObj = new RbacUsers(); $this->userObj = new RbacUsers();
if (class_exists('PMPluginRegistry')) { if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
$pluginRegistry = PluginRegistry::loadSingleton(); $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) { if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
try { try {

View File

@@ -826,8 +826,8 @@ class PluginRegistry
require_once($classFile); require_once($classFile);
$sClassName = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) . $sClassName = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
str_replace( str_replace(
'Plugin', 'plugin',
'Class', 'class',
substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1) substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1)
); );
$obj = new $sClassName(); $obj = new $sClassName();

View File

@@ -2,9 +2,16 @@
namespace ProcessMaker\Util; namespace ProcessMaker\Util;
use \ProcessMaker\Services\OAuth2\PmPdo; use Bootstrap;
use \ProcessMaker\Services\OAuth2\Server; use Exception;
use \OAuth2\Request; use Maveriks\Util\ClassLoader;
use PMPlugin;
use ProcessMaker\Plugins\Interfaces\PluginDetail;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services\OAuth2\PmPdo;
use ProcessMaker\Services\OAuth2\Server;
use OAuth2\Request;
use Propel;
class System class System
{ {
@@ -14,7 +21,7 @@ class System
* Get Time Zone * Get Time Zone
* *
* @return string Return Time Zone * @return string Return Time Zone
* @throws \Exception * @throws Exception
*/ */
public static function getTimeZone() public static function getTimeZone()
{ {
@@ -23,7 +30,7 @@ class System
//Return //Return
return $arraySystemConfiguration['time_zone']; return $arraySystemConfiguration['time_zone'];
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
@@ -37,26 +44,28 @@ class System
{ {
try { try {
//Update singleton file by workspace //Update singleton file by workspace
\Bootstrap::setConstantsRelatedWs($workspace->name); Bootstrap::setConstantsRelatedWs($workspace->name);
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton"; Propel::init(PATH_CORE . "config/databases.php");
$oPluginRegistry = \PMPluginRegistry::loadSingleton($pathSingleton); $oPluginRegistry = PluginRegistry::loadSingleton();
$items = \PMPlugin::getListAllPlugins($workspace->name); $items = PMPlugin::getListAllPlugins($workspace->name);
/** @var PluginDetail $item */
foreach ($items as $item) { foreach ($items as $item) {
if ($item->enabled === true) { if ($item->isEnabled()) {
require_once($item->sFilename); require_once($item->getFile());
$details = $oPluginRegistry->getPluginDetails(basename($item->sFilename)); /** @var PluginDetail $details */
$details = $oPluginRegistry->getPluginDetails(basename($item->getFile()));
//Only if the API directory structure is defined //Only if the API directory structure is defined
$pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api"; $pathApiDirectory = PATH_PLUGINS . $details->getFolder() . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
if (is_dir($pathApiDirectory)) { if (is_dir($pathApiDirectory)) {
$pluginSrcDir = PATH_PLUGINS . $details->sNamespace . PATH_SEP . 'src'; $pluginSrcDir = PATH_PLUGINS . $details->getNamespace() . PATH_SEP . 'src';
$loader = \Maveriks\Util\ClassLoader::getInstance(); $loader = ClassLoader::getInstance();
$loader->add($pluginSrcDir); $loader->add($pluginSrcDir);
$oPluginRegistry->registerRestService($details->sNamespace); $oPluginRegistry->registerRestService($details->getNamespace());
if (class_exists($details->sClassName)) { $className = $details->getClassName();
$oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename); if (class_exists($className)) {
$oPlugin = new $className($details->getNamespace(), $details->getFile());
$oPlugin->setup(); $oPlugin->setup();
} }
file_put_contents($pathSingleton, $oPluginRegistry->serializeInstance());
} }
} }
} }
@@ -71,8 +80,8 @@ class System
if (file_exists($workspace->path . '/routes.php')) { if (file_exists($workspace->path . '/routes.php')) {
unlink($workspace->path . '/routes.php'); unlink($workspace->path . '/routes.php');
} }
} catch (\Exception $e) { } catch (Exception $e) {
throw new \Exception("Error: cannot perform this task. " . $e->getMessage()); throw new Exception("Error: cannot perform this task. " . $e->getMessage());
} }
} }
@@ -87,7 +96,7 @@ class System
$authCode = self::getAuthorizationCodeUserLogged($client); $authCode = self::getAuthorizationCodeUserLogged($client);
$loader = \Maveriks\Util\ClassLoader::getInstance(); $loader = ClassLoader::getInstance();
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2"); $loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$request = array( $request = array(
@@ -117,7 +126,7 @@ class System
* Get client credentials * Get client credentials
* @return array * @return array
*/ */
protected function getClientCredentials() protected static function getClientCredentials()
{ {
$oauthQuery = new PmPdo(self::getDsn()); $oauthQuery = new PmPdo(self::getDsn());
return $oauthQuery->getClientDetails(self::CLIENT_ID); return $oauthQuery->getClientDetails(self::CLIENT_ID);
@@ -127,7 +136,7 @@ class System
* Get DNS of workspace * Get DNS of workspace
* @return array * @return array
*/ */
protected function getDsn() protected static function getDsn()
{ {
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, ''); list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$port = empty($port) ? '' : ";port=$port"; $port = empty($port) ? '' : ";port=$port";
@@ -141,7 +150,7 @@ class System
* @param $client * @param $client
* @return bool|string * @return bool|string
*/ */
protected function getAuthorizationCodeUserLogged($client) protected static function getAuthorizationCodeUserLogged($client)
{ {
Server::setDatabaseSource(self::getDsn()); Server::setDatabaseSource(self::getDsn());
Server::setPmClientId($client['CLIENT_ID']); Server::setPmClientId($client['CLIENT_ID']);