up obserpations

This commit is contained in:
Ronald Quenta
2017-08-10 16:50:09 -04:00
parent b727f6567e
commit d8e9ab8844
18 changed files with 70 additions and 1368 deletions

View File

@@ -554,7 +554,7 @@ class headPublisher
//hook for registered javascripts from plugins
if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined('SYS_SYS')) {
$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
} else {
$pluginJavascripts = array();

View File

View File

@@ -25,6 +25,8 @@
*/
use ProcessMaker\Util\System;
CLI::taskName('flush-cache');
CLI::taskDescription(<<<EOT
Flush cache of all workspaces of a given workspace
@@ -72,7 +74,7 @@ function flush_cache($workspace)
echo " Update singleton in workspace " . $workspace->name . " ... ";
echo PHP_EOL;
echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL;
\ProcessMaker\Util\System::flushCache($workspace);
System::flushCache($workspace);
echo "DONE" . PHP_EOL;
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;

View File

@@ -4,6 +4,8 @@ require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php';
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php';
use ProcessMaker\Plugins\PluginRegistry;
function runBgProcessmaker($task, $log)
{
require_once (PATH_CORE . "bin/tasks/cliAddons.php");
@@ -80,7 +82,7 @@ try {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
//are all the plugins that are enabled in the workspace
$pluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {

View File

@@ -1,8 +1,10 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$pluginFile = $_GET['id'];
$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$folder = $details->getFolder();

View File

@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Plugins\PluginRegistry;
$inst = new PmInstaller();
$oProcess = new Processes();
@@ -57,7 +60,7 @@ foreach ($availablePlugins as $filename) {
}
//print "change to ENABLED";
$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) {

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/Users.php';
$oUser = new Users();
$aUser = $oUser->load($_SESSION['USER_LOGGED']);
@@ -50,7 +53,7 @@ if (class_exists('redirectDetail')) {
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$oPluginRegistry = PluginRegistry::loadSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset($aRedirectLogin)) {

View File

@@ -1,5 +1,7 @@
<?php
use ProcessMaker\Plugins\PluginRegistry;
$aInfoLoadFile = array();
$aInfoLoadFile['name'] = $_FILES['form']['name']['licenseFile'];
$aInfoLoadFile['tmp_name'] = $_FILES['form']['tmp_name']['licenseFile'];
@@ -37,7 +39,7 @@ if ($aux['extension'] != 'dat') {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
//are all the plugins that are enabled in the workspace
$pluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$pluginRegistry = PluginRegistry::loadSingleton();
/** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {

View File

@@ -2,6 +2,8 @@
namespace ProcessMaker\Plugins\Adapters;
use G;
use PluginsRegistry;
use PMPluginRegistry;
/**
@@ -111,7 +113,7 @@ class PluginAdapter
*/
public function migrate($PMPluginsSingleton)
{
$this->PMPluginRegistry = \G::json_decode(\G::json_encode($PMPluginsSingleton->getAttributes()), true);
$this->PMPluginRegistry = G::json_decode(G::json_encode($PMPluginsSingleton->getAttributes()), true);
$this->parserNameKey();
foreach ($this->PMPluginRegistry['_aPluginDetails'] as $nameSpace => $value) {
$this->saveInTable($nameSpace, $this->PMPluginRegistry);
@@ -157,8 +159,8 @@ class PluginAdapter
$newStructurePlugin = $this->getAllAttributes($Namespace, $PMPluginRegistry);
$plugin = $this->convertFieldTable($newStructurePlugin);
if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) {
$fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
\PluginsRegistry::update($fieldPlugin);
$fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
PluginsRegistry::update($fieldPlugin);
}
}
@@ -215,7 +217,7 @@ class PluginAdapter
$valueField = (array_key_exists($name, $fieldsInTable) && $fieldsInTable[$name]) ?
$fieldsInTable[$name] :
[];
$valueField = \G::json_encode($valueField);
$valueField = G::json_encode($valueField);
break;
case 'int':
$valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0;
@@ -233,7 +235,7 @@ class PluginAdapter
}
$fields[$property['name']] = $valueField;
}
$fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($extraAttributes);
$fields['PLUGIN_ATTRIBUTES'] = G::json_encode($extraAttributes);
return $fields;
}
}

View File

@@ -2,8 +2,15 @@
namespace ProcessMaker\Plugins;
use Archive_Tar;
use enterprisePlugin;
use Exception;
use G;
use InputFilter;
use Language;
use PEAR;
use PluginsRegistry;
use PmSystem;
use ProcessMaker\Plugins\Adapters\PluginAdapter;
use ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin;
use ProcessMaker\Plugins\Interfaces\CronFile;
@@ -24,6 +31,9 @@ use ProcessMaker\Plugins\Interfaces\ToolbarDetail;
use ProcessMaker\Plugins\Interfaces\TriggerDetail;
use ProcessMaker\Plugins\Traits\Attributes;
use ProcessMaker\Plugins\Traits\PluginStructure;
use Publisher;
use stdClass;
use System;
/**
* Class PluginRegistry
@@ -151,9 +161,9 @@ class PluginRegistry
} catch (Exception $e) {
global $G_PUBLISH;
$Message['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new \Publisher();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Message);
\G::RenderPage('publish');
G::RenderPage('publish');
die();
}
}
@@ -167,8 +177,8 @@ class PluginRegistry
$newStructurePlugin = $this->getAllAttributes($Namespace);
$plugin = $this->convertFieldTable($newStructurePlugin);
if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) {
$fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
\PluginsRegistry::update($fieldPlugin);
$fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
PluginsRegistry::update($fieldPlugin);
}
}
/**
@@ -323,8 +333,7 @@ class PluginRegistry
*/
public function installPluginArchive($Filename, $Namespace)
{
\G::LoadThirdParty("pear/Archive", "Tar");
$tar = new \Archive_Tar($Filename);
$tar = new Archive_Tar($Filename);
$files = $tar->listContent();
$plugins = array();
$namePlugin = array();
@@ -375,7 +384,7 @@ class PluginRegistry
}
$path = PATH_PLUGINS . $pluginFile;
$filter = new \InputFilter();
$filter = new InputFilter();
$path = $filter->validateInput($path, 'path');
require_once($path);
@@ -402,7 +411,7 @@ class PluginRegistry
}
if (isset($detail->sPluginFolder) && !empty($detail->sPluginFolder) && file_exists($pluginDir)) {
\G::rm_dir($pluginDir);
G::rm_dir($pluginDir);
}
///////
@@ -419,7 +428,7 @@ class PluginRegistry
*/
public function uninstallPluginWorkspaces($arrayPlugin)
{
$workspace = \System::listWorkspaces();
$workspace = PmSystem::listWorkspaces();
foreach ($workspace as $indexWS => $ws) {
$pluginRegistry = PluginRegistry::loadSingleton();
@@ -456,9 +465,9 @@ class PluginRegistry
} catch (Exception $e) {
global $G_PUBLISH;
$Message['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new \Publisher();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Message);
\G::RenderPage('publish');
G::RenderPage('publish');
die();
}
}
@@ -805,7 +814,6 @@ class PluginRegistry
*/
public function executeTriggers($TriggerId, $oData)
{
\G::LoadThirdParty("pear", "PEAR");
/** @var TriggerDetail $trigger */
foreach ($this->_aTriggers as $trigger) {
if ($trigger->equalTriggerId($TriggerId)) {
@@ -833,7 +841,7 @@ class PluginRegistry
$obj = new $sClassName();
$methodName = $trigger->getTriggerName();
$response = $obj->{$methodName}($oData);
if (\PEAR::isError($response)) {
if (PEAR::isError($response)) {
print $response->getMessage();
return;
}
@@ -1304,7 +1312,7 @@ class PluginRegistry
*/
public function verifyTranslation($Namespace)
{
$language = new \Language();
$language = new Language();
$pathPluginTranslations = PATH_PLUGINS . $Namespace . PATH_SEP . 'translations' . PATH_SEP;
if (file_exists($pathPluginTranslations . 'translations.php')) {
if (!file_exists($pathPluginTranslations . $Namespace . '.' . SYS_LANG . '.po')) {
@@ -1362,7 +1370,7 @@ class PluginRegistry
public function updatePluginAttributesInAllWorkspaces($Namespace)
{
try {
\G::LoadClass("wsTools");
G::LoadClass("wsTools");
//Set variables
$pluginFileName = $Namespace . ".php";
@@ -1384,7 +1392,7 @@ class PluginRegistry
) {
$arrayWorkspace = array();
foreach (\System::listWorkspaces() as $value) {
foreach (PmSystem::listWorkspaces() as $value) {
$workspaceTools = $value;
$arrayWorkspace[] = $workspaceTools->name;
@@ -1459,7 +1467,7 @@ class PluginRegistry
}
if (!$flagFound) {
$obj = new \stdClass();
$obj = new stdClass();
$obj->pluginName = $pluginName;
$obj->file = $file;
@@ -1606,7 +1614,7 @@ class PluginRegistry
*/
public function getPluginByCode($code)
{
$plugin = new \stdClass();
$plugin = new stdClass();
foreach ($this->_aPlugins as $plugin) {
$plugin = (array)$plugin;
if (strtoupper($plugin['sNamespace']) == $code) {
@@ -1655,7 +1663,7 @@ class PluginRegistry
}
if (!$flagFound) {
$obj = new \stdClass();
$obj = new stdClass();
$obj->pluginName = $pluginName;
$obj->pathFile = $pathFile;

View File

@@ -3,6 +3,7 @@
namespace ProcessMaker\Plugins\Traits;
use BasePeer;
use G;
use PluginsRegistry;
use ProcessMaker\Plugins\Interfaces\CssFile;
use ProcessMaker\Plugins\Interfaces\FolderDetail;
@@ -106,16 +107,16 @@ trait PluginStructure
foreach ($Plugins as $plugin) {
$this->_aPluginDetails[$plugin['PluginNamespace']] = $this->buildPluginDetails($plugin);
if ($plugin['PluginEnable']) {
$this->buildMenus(\G::json_decode($plugin['PluginMenus'], true));
$this->buildFolders(\G::json_decode($plugin['PluginFolders'], true));
$this->buildTriggers(\G::json_decode($plugin['PluginTriggers'], true));
$this->buildPmFunctions(\G::json_decode($plugin['PluginPmFunctions'], true));
$this->buildRedirectLogin(\G::json_decode($plugin['PluginRedirectLogin'], true));
$this->buildSteps(\G::json_decode($plugin['PluginSteps'], true));
$this->buildCss(\G::json_decode($plugin['PluginCss'], true));
$this->buildJs(\G::json_decode($plugin['PluginJs'], true));
$this->buildRestService(\G::json_decode($plugin['PluginRestService'], true));
$this->buildAttributes($plugin['PluginNamespace'], \G::json_decode($plugin['PluginAttributes']));
$this->buildMenus(G::json_decode($plugin['PluginMenus'], true));
$this->buildFolders(G::json_decode($plugin['PluginFolders'], true));
$this->buildTriggers(G::json_decode($plugin['PluginTriggers'], true));
$this->buildPmFunctions(G::json_decode($plugin['PluginPmFunctions'], true));
$this->buildRedirectLogin(G::json_decode($plugin['PluginRedirectLogin'], true));
$this->buildSteps(G::json_decode($plugin['PluginSteps'], true));
$this->buildCss(G::json_decode($plugin['PluginCss'], true));
$this->buildJs(G::json_decode($plugin['PluginJs'], true));
$this->buildRestService(G::json_decode($plugin['PluginRestService'], true));
$this->buildAttributes($plugin['PluginNamespace'], G::json_decode($plugin['PluginAttributes']));
}
}
}
@@ -137,7 +138,7 @@ trait PluginStructure
$plugin['PluginSetupPage'],
$plugin['PluginVersion'],
$plugin['PluginCompanyLogo'],
\G::json_decode($plugin['PluginWorkspaces']),
G::json_decode($plugin['PluginWorkspaces']),
$plugin['PluginEnable'],
$plugin['PluginPrivate']
);
@@ -288,7 +289,7 @@ trait PluginStructure
$PluginDetails = $PluginRegistry->_aPluginDetails[$Namespace];
unset($PluginRegistry->_aPluginDetails);
$Plugin = isset($PluginRegistry->_aPlugins[$Namespace]) ?
\G::json_decode(\G::json_encode($PluginRegistry->_aPlugins[$Namespace]), true) :
G::json_decode(G::json_encode($PluginRegistry->_aPlugins[$Namespace]), true) :
[];
unset($PluginRegistry->_aPlugins);
$newStructurePlugin = array_merge($Plugin, $PluginDetails->getAttributes());
@@ -339,7 +340,7 @@ trait PluginStructure
}
}
}
$valueField = \G::json_encode($valueField);
$valueField = G::json_encode($valueField);
break;
case 'int':
$valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0;
@@ -357,7 +358,7 @@ trait PluginStructure
}
$fields[$property['name']] = $valueField;
}
$fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($extraAttributes);
$fields['PLUGIN_ATTRIBUTES'] = G::json_encode($extraAttributes);
return $fields;
}
}