resolv conflict
This commit is contained in:
@@ -36,12 +36,23 @@ EOT
|
||||
CLI::taskArg('workspace', true, true);
|
||||
CLI::taskRun('run_flush_cache');
|
||||
|
||||
/**
|
||||
* Flush the cache files for the specified workspace.
|
||||
* If no workspace is specified, then the cache will be flushed in all available
|
||||
* workspaces.
|
||||
*
|
||||
* @param array $args
|
||||
* @param array $opts
|
||||
*/
|
||||
function run_flush_cache($args, $opts)
|
||||
{
|
||||
if (!defined("PATH_C")) {
|
||||
die("ERROR: seems processmaker is not properly installed (System constants are missing)." . PHP_EOL);
|
||||
}
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
if (count($args) === 1) {
|
||||
flush_cache($args, $opts);
|
||||
flush_cache($workspaces[0]);
|
||||
} else {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru("./processmaker flush-cache " . $workspace->name);
|
||||
}
|
||||
@@ -49,67 +60,21 @@ function run_flush_cache($args, $opts)
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the cache files for the specified workspace(s).
|
||||
* If no workspace is specified, then the cache will be flushed in all available
|
||||
* workspaces.
|
||||
* Flush the cache files for the specified workspace.
|
||||
*
|
||||
* @param type $args
|
||||
* @param type $opts
|
||||
* @param object $workspace
|
||||
*/
|
||||
function flush_cache($args, $opts)
|
||||
function flush_cache($workspace)
|
||||
{
|
||||
$rootDir = realpath(__DIR__ . "/../../../../");
|
||||
$app = new Maveriks\WebApplication();
|
||||
$app->setRootDir($rootDir);
|
||||
$loadConstants = false;
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
|
||||
if (!defined("PATH_C")) {
|
||||
die("ERROR: seems processmaker is not properly installed (System constants are missing)." . PHP_EOL);
|
||||
}
|
||||
|
||||
//Update singleton file by workspace
|
||||
foreach ($workspaces as $workspace) {
|
||||
eprint("Update singleton in workspace " . $workspace->name . " ... ");
|
||||
Bootstrap::setConstantsRelatedWs($workspace->name);
|
||||
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton";
|
||||
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
|
||||
$items = \PMPlugin::getlist($workspace->name);
|
||||
foreach ($items as $item) {
|
||||
if ($item["sStatusFile"] === true) {
|
||||
$path = PATH_PLUGINS . $item["sFile"];
|
||||
require_once($path);
|
||||
$details = $oPluginRegistry->getPluginDetails($item["sFile"]);
|
||||
//Only if the API directory structure is defined
|
||||
$pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
|
||||
if (is_dir($pathApiDirectory)) {
|
||||
if (class_exists($details->sClassName)) {
|
||||
$oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename);
|
||||
$oPlugin->setup();
|
||||
file_put_contents($pathSingleton, $oPluginRegistry->serializeInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
eprintln("DONE");
|
||||
}
|
||||
|
||||
//flush the cache files
|
||||
CLI::logging("Flush " . pakeColor::colorize("system", "INFO") . " cache ... ");
|
||||
G::rm_dir(PATH_C);
|
||||
G::mk_dir(PATH_C, 0777);
|
||||
echo "DONE" . PHP_EOL;
|
||||
|
||||
foreach ($workspaces as $workspace) {
|
||||
echo "Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... ";
|
||||
|
||||
G::rm_dir($workspace->path . "/cache");
|
||||
G::mk_dir($workspace->path . "/cache", 0777);
|
||||
G::rm_dir($workspace->path . "/cachefiles");
|
||||
G::mk_dir($workspace->path . "/cachefiles", 0777);
|
||||
if (file_exists($workspace->path . '/routes.php')) {
|
||||
unlink($workspace->path . '/routes.php');
|
||||
}
|
||||
try {
|
||||
CLI::logging("Flush " . pakeColor::colorize("system", "INFO") . " cache ... ");
|
||||
echo PHP_EOL;
|
||||
echo " Update singleton in workspace " . $workspace->name . " ... ";
|
||||
echo PHP_EOL;
|
||||
echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL;
|
||||
$status = \ProcessMaker\Util\System::flushCache($workspace);
|
||||
echo "DONE" . PHP_EOL;
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ class PMPlugin
|
||||
* @param string $workspace
|
||||
* @return array
|
||||
*/
|
||||
public static function getList($workspace)
|
||||
public static function getListPluginsManager($workspace)
|
||||
{
|
||||
$items = Array();
|
||||
$aPluginsPP = array();
|
||||
@@ -576,6 +576,34 @@ class PMPlugin
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a general list of all plugins within processmaker per workspace.
|
||||
*
|
||||
* @param string $workspace
|
||||
* @return array
|
||||
*/
|
||||
public static function getListAllPlugins($workspace)
|
||||
{
|
||||
PMPluginRegistry::saveState();
|
||||
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP . "plugin.singleton";
|
||||
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
|
||||
$items = [];
|
||||
if ($handle = opendir(PATH_PLUGINS)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
|
||||
include_once (PATH_PLUGINS . $file);
|
||||
$detail = $oPluginRegistry->getPluginDetails($file);
|
||||
if ($detail !== null) {
|
||||
$items[] = $detail;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
PMPluginRegistry::restoreState();
|
||||
return $items;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ class PMPluginRegistry
|
||||
private $_restServiceEnabled = array();
|
||||
|
||||
private static $instance = null;
|
||||
private static $stateSaved = null;
|
||||
|
||||
/**
|
||||
* This function is the constructor of the PMPluginRegistry class
|
||||
@@ -1946,4 +1947,28 @@ class PMPluginRegistry
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the state of instance, in the private property 'stateSaved'.
|
||||
* Use the 'restoreState()' method to put the instance in the saved state.
|
||||
*/
|
||||
public static function saveState()
|
||||
{
|
||||
$pluginRegistry = PMPluginRegistry::getSingleton();
|
||||
self::$stateSaved = $pluginRegistry->serializeInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the state of the instance that is in the private variable 'stateSaved'.
|
||||
* You must save the state of the instacia with the method 'saveState()'
|
||||
* before being called.
|
||||
*/
|
||||
public static function restoreState()
|
||||
{
|
||||
if (self::$stateSaved !== null) {
|
||||
$pluginRegistry = PMPluginRegistry::getSingleton();
|
||||
self::$instance = $pluginRegistry->unSerializeInstance(self::$stateSaved);
|
||||
self::$stateSaved = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,10 @@ G::LoadClass( 'pmScript' );
|
||||
G::LoadClass( 'case' );
|
||||
G::LoadClass( 'derivation' );
|
||||
|
||||
//require_once 'classes/model/Event.php';
|
||||
//If no variables are submitted and the $_POST variable is empty
|
||||
if (!isset($_POST['form'])) {
|
||||
$_POST['form'] = array();
|
||||
}
|
||||
|
||||
/* GET , POST & $_SESSION Vars */
|
||||
/* Process the info */
|
||||
|
||||
@@ -57,7 +57,12 @@ if (isset( $_SESSION['STEP_POSITION'] )) {
|
||||
unset( $_SESSION['STEP_POSITION'] );
|
||||
}
|
||||
|
||||
/* Process */
|
||||
//If no variables are submitted and the $_POST variable is empty
|
||||
if (!isset($_POST['form'])) {
|
||||
$_POST['form'] = array();
|
||||
}
|
||||
|
||||
/* Process */
|
||||
try {
|
||||
$oCase = new Cases();
|
||||
$aData = $oCase->startCase( $_POST['form']['TAS_UID'], $_SESSION['USER_LOGGED'] );
|
||||
|
||||
@@ -103,6 +103,11 @@ try {
|
||||
|
||||
$arrayVariableDocumentToDelete = [];
|
||||
|
||||
//If no variables are submitted and the $_POST variable is empty
|
||||
if (!isset($_POST['form'])) {
|
||||
$_POST['form'] = array();
|
||||
}
|
||||
|
||||
if (array_key_exists('__VARIABLE_DOCUMENT_DELETE__', $_POST['form'])) {
|
||||
if (is_array($_POST['form']['__VARIABLE_DOCUMENT_DELETE__']) && !empty($_POST['form']['__VARIABLE_DOCUMENT_DELETE__'])) {
|
||||
$arrayVariableDocumentToDelete = $_POST['form']['__VARIABLE_DOCUMENT_DELETE__'];
|
||||
|
||||
@@ -27,6 +27,11 @@ $dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
|
||||
|
||||
$flagDynaFormNewVersion = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
|
||||
|
||||
//If no variables are submitted and the $_POST variable is empty
|
||||
if (!isset($_POST['form'])) {
|
||||
$_POST['form'] = array();
|
||||
}
|
||||
|
||||
if ($flagDynaFormNewVersion) {
|
||||
$dataForm = $_POST["form"];
|
||||
}
|
||||
@@ -205,8 +210,9 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Define the STEP_POSITION
|
||||
$ex = isset($_GET['ex']) ? $_GET['ex'] : 0;
|
||||
//go to the next step
|
||||
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
|
||||
G::header( 'Location: cases_StepToRevise?type=DYNAFORM&ex=' . $_GET['ex'] . '&PRO_UID=' . $_SESSION['PROCESS'] . '&DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&position=' . $aNextStep['POSITION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );
|
||||
G::header( 'Location: cases_StepToRevise?type=DYNAFORM&ex=' . $ex . '&PRO_UID=' . $_SESSION['PROCESS'] . '&DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&position=' . $aNextStep['POSITION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );
|
||||
die();
|
||||
@@ -43,6 +43,11 @@ try {
|
||||
$Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], G::getSystemConstants() );
|
||||
$Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $_POST["form"] );
|
||||
|
||||
//If no variables are submitted and the $_POST variable is empty
|
||||
if (!isset($_POST['form'])) {
|
||||
$_POST['form'] = array();
|
||||
}
|
||||
|
||||
//save data in PM Tables if necessary
|
||||
$newValues = array ();
|
||||
foreach ($_POST['form'] as $sField => $sAux) {
|
||||
|
||||
@@ -25,5 +25,5 @@
|
||||
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
||||
|
||||
G::LoadClass('plugin');
|
||||
$items = \PMPlugin::getlist(SYS_SYS);
|
||||
$items = \PMPlugin::getListPluginsManager(SYS_SYS);
|
||||
echo G::json_encode($items);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Util;
|
||||
|
||||
use \ProcessMaker\Services\OAuth2\PmPdo;
|
||||
@@ -27,6 +28,54 @@ class System
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the cache files for the specified workspace.
|
||||
*
|
||||
* @param object $workspace
|
||||
*/
|
||||
public static function flushCache($workspace)
|
||||
{
|
||||
try {
|
||||
//Update singleton file by workspace
|
||||
\Bootstrap::setConstantsRelatedWs($workspace->name);
|
||||
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton";
|
||||
$oPluginRegistry = \PMPluginRegistry::loadSingleton($pathSingleton);
|
||||
$items = \PMPlugin::getListAllPlugins($workspace->name);
|
||||
foreach ($items as $item) {
|
||||
if ($item->enabled === true) {
|
||||
require_once($item->sFilename);
|
||||
$details = $oPluginRegistry->getPluginDetails(basename($item->sFilename));
|
||||
//Only if the API directory structure is defined
|
||||
$pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
|
||||
if (is_dir($pathApiDirectory)) {
|
||||
$pluginSrcDir = PATH_PLUGINS . $details->sNamespace . PATH_SEP . 'src';
|
||||
$loader = \Maveriks\Util\ClassLoader::getInstance();
|
||||
$loader->add($pluginSrcDir);
|
||||
$oPluginRegistry->registerRestService($details->sNamespace);
|
||||
if (class_exists($details->sClassName)) {
|
||||
$oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename);
|
||||
$oPlugin->setup();
|
||||
}
|
||||
file_put_contents($pathSingleton, $oPluginRegistry->serializeInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//flush the cache files
|
||||
\G::rm_dir(PATH_C);
|
||||
\G::mk_dir(PATH_C, 0777);
|
||||
\G::rm_dir($workspace->path . "/cache");
|
||||
\G::mk_dir($workspace->path . "/cache", 0777);
|
||||
\G::rm_dir($workspace->path . "/cachefiles");
|
||||
\G::mk_dir($workspace->path . "/cachefiles", 0777);
|
||||
if (file_exists($workspace->path . '/routes.php')) {
|
||||
unlink($workspace->path . '/routes.php');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception("Error: cannot perform this task. " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Token with USER_LOGGED saved in $_SESSION
|
||||
*
|
||||
|
||||
@@ -35,6 +35,12 @@ try {
|
||||
$a->next();
|
||||
$row = $a->getRow();
|
||||
$swpmdynaform = isset($row) && $row["DYN_VERSION"] == 2;
|
||||
|
||||
//If no variables are submitted and the $_POST variable is empty
|
||||
if (!isset($_POST['form'])) {
|
||||
$_POST['form'] = array();
|
||||
}
|
||||
|
||||
if ($swpmdynaform) {
|
||||
$pmdynaform = $_POST["form"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user