HOR-4408
This commit is contained in:
@@ -132,12 +132,13 @@ try {
|
||||
|
||||
if (is_dir(PATH_DB . $workspace) && file_exists(PATH_DB . $workspace . PATH_SEP . 'db.php')) {
|
||||
define('SYS_SYS', $workspace);
|
||||
config(["system.workspace" => $workspace]);
|
||||
|
||||
include_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
|
||||
include_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
//PM Paths DATA
|
||||
define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/');
|
||||
define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
|
||||
define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
|
||||
define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
|
||||
@@ -418,7 +419,7 @@ function executePlugins()
|
||||
}
|
||||
|
||||
if ($handle = opendir($pathCronPlugins)) {
|
||||
setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . SYS_SYS);
|
||||
setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . config("system.workspace"));
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (strpos($file, '.php',1) && is_file($pathCronPlugins . $file)) {
|
||||
$filename = str_replace('.php' , '', $file);
|
||||
@@ -438,7 +439,7 @@ function executePlugins()
|
||||
|
||||
// -> Execute functions
|
||||
if (!empty($cronFiles)) {
|
||||
setExecutionMessage('Executing registered cron files for Workspace: ' . SYS_SYS);
|
||||
setExecutionMessage('Executing registered cron files for Workspace: ' . config("system.workspace"));
|
||||
foreach($cronFiles as $cronFile) {
|
||||
executeCustomCronFunction(PATH_PLUGINS . $cronFile->namespace . PATH_SEP . 'bin' . PATH_SEP . $cronFile->cronFile . '.php', $cronFile->cronFile);
|
||||
}
|
||||
@@ -820,7 +821,7 @@ function executeCaseSelfService()
|
||||
unset($appFields['APP_PIN']);
|
||||
$case->updateCase($appFields["APP_UID"], $appFields);
|
||||
|
||||
saveLog("unassignedCase", "action", "OK Executed tigger to the case $appcacheAppNumber");
|
||||
saveLog("unassignedCase", "action", "OK Executed trigger to the case $appcacheAppNumber");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ print "PATH_DB: " . PATH_DB . "\n";
|
||||
print "PATH_CORE: " . PATH_CORE . "\n";
|
||||
|
||||
// define the site name (instance name)
|
||||
if (! defined ('SYS_SYS')) {
|
||||
if (empty(config("system.workspace"))) {
|
||||
$sObject = $workspaceName;
|
||||
$sNow = ''; // $argv[2];
|
||||
$sFilter = '';
|
||||
@@ -144,11 +144,12 @@ if (! defined ('SYS_SYS')) {
|
||||
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
|
||||
|
||||
define ('SYS_SYS', $sObject);
|
||||
config(["system.workspace" => $sObject]);
|
||||
|
||||
// ****************************************
|
||||
// read initialize file
|
||||
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
$config = System::getSystemConfiguration ('', '', SYS_SYS);
|
||||
$config = System::getSystemConfiguration ('', '', config("system.workspace"));
|
||||
define ('MEMCACHED_ENABLED', $config ['memcached']);
|
||||
define ('MEMCACHED_SERVER', $config ['memcached_server']);
|
||||
define ('TIME_ZONE', $config ['time_zone']);
|
||||
@@ -170,7 +171,7 @@ if (! defined ('SYS_SYS')) {
|
||||
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
// ***************** PM Paths DATA **************************
|
||||
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/');
|
||||
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
|
||||
define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
|
||||
define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
|
||||
@@ -264,7 +265,7 @@ function processWorkspace()
|
||||
|
||||
try {
|
||||
|
||||
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
|
||||
if (($solrConf = System::solrEnv (config("system.workspace"))) !== false) {
|
||||
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
|
||||
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
|
||||
print "solr_host: " . $solrConf ['solr_host'] . "\n";
|
||||
|
||||
@@ -46,11 +46,12 @@ function run_addon_core_install($args)
|
||||
$storeId = $args[1];
|
||||
$addonName = $args[2];
|
||||
|
||||
if (!defined("SYS_SYS")) {
|
||||
if (empty(config("system.workspace"))) {
|
||||
define("SYS_SYS", $workspace);
|
||||
config(["system.workspace" => $workspace]);
|
||||
}
|
||||
if (!defined("PATH_DATA_SITE")) {
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/");
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/");
|
||||
}
|
||||
if (!defined("DB_ADAPTER")) {
|
||||
define("DB_ADAPTER", $args[3]);
|
||||
@@ -102,11 +103,12 @@ function change_hash($command, $opts)
|
||||
$response = new stdclass();
|
||||
$response->workspace = $workspace;
|
||||
$response->hash = $hash;
|
||||
if (!defined("SYS_SYS")) {
|
||||
if (empty(config("system.workspace"))) {
|
||||
define("SYS_SYS", $workspace->name);
|
||||
config(["system.workspace" => $workspace->name]);
|
||||
}
|
||||
if (!defined("PATH_DATA_SITE")) {
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/");
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/");
|
||||
}
|
||||
$_SESSION['__sw__'] = '';
|
||||
if (!$workspace->changeHashPassword($workspace->name, $response)) {
|
||||
|
||||
@@ -132,12 +132,13 @@ function run_upgrade($command, $args)
|
||||
$flagUpdateXml = !array_key_exists('noxml', $args);
|
||||
|
||||
foreach ($workspaces as $index => $workspace) {
|
||||
if (!defined("SYS_SYS")) {
|
||||
if (empty(config("system.workspace"))) {
|
||||
define("SYS_SYS", $workspace->name);
|
||||
config(["system.workspace" => $workspace->name]);
|
||||
}
|
||||
|
||||
if (!defined("PATH_DATA_SITE")) {
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP);
|
||||
}
|
||||
|
||||
if(!defined('DB_ADAPTER')) {
|
||||
|
||||
@@ -315,6 +315,17 @@ CLI::taskOpt("lang", "", "lLANG", "lang=LANG");
|
||||
CLI::taskArg('workspace');
|
||||
CLI::taskRun("cliListIds");
|
||||
|
||||
/**
|
||||
* Upgrade the CONTENT table
|
||||
*/
|
||||
CLI::taskName('upgrade-content');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Upgrade the content table
|
||||
EOT
|
||||
);
|
||||
CLI::taskArg('workspace');
|
||||
CLI::taskRun("run_upgrade_content");
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -345,28 +356,61 @@ function run_info($args, $opts)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we need to execute the workspace-upgrade
|
||||
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
|
||||
*
|
||||
* @param string $args, workspace name that we need to apply the database-upgrade
|
||||
* @param string $opts, additional arguments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function run_workspace_upgrade($args, $opts)
|
||||
{
|
||||
$filter = new InputFilter();
|
||||
$opts = $filter->xssFilterHard($opts);
|
||||
$args = $filter->xssFilterHard($args);
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
//Read the additional parameters for this command
|
||||
$parameters = '';
|
||||
$parameters .= array_key_exists('buildACV', $opts) ? '--buildACV ' : '';
|
||||
$parameters .= array_key_exists('noxml', $opts) ? '--no-xml ' : '';
|
||||
$parameters .= array_key_exists("lang", $opts) ? 'lang=' . $opts['lang'] : 'lang=' . SYS_LANG;
|
||||
|
||||
//Check if the command is executed by a specific workspace
|
||||
if (count($args) === 1) {
|
||||
workspace_upgrade($args, $opts);
|
||||
} else {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru('./processmaker upgrade ' . $parameters . ' ' . $workspace->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is executed only by one workspace, for the command workspace-upgrade
|
||||
*
|
||||
* @param array $args, workspace name for to apply the upgrade
|
||||
* @param array $opts, specify additional arguments for language, flag for buildACV, flag for noxml
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function workspace_upgrade($args, $opts) {
|
||||
$first = true;
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||
$buildCacheView = array_key_exists('buildACV', $opts);
|
||||
$flagUpdateXml = !array_key_exists('noxml', $opts);
|
||||
|
||||
$wsName = $workspaces[key($workspaces)]->name;
|
||||
Bootstrap::setConstantsRelatedWs($wsName);
|
||||
//Loop, read all the attributes related to the one workspace
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
if (!defined("SYS_SYS")) {
|
||||
define("SYS_SYS", $workspace->name);
|
||||
}
|
||||
|
||||
if (!defined("PATH_DATA_SITE")) {
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
|
||||
}
|
||||
|
||||
$workspace->upgrade($buildCacheView, $workspace->name, false, $lang, ['updateXml' => $flagUpdateXml, 'updateMafe' => $first]);
|
||||
$workspace->upgrade(
|
||||
$buildCacheView,
|
||||
$workspace->name,
|
||||
false,
|
||||
$lang,
|
||||
['updateXml' => $flagUpdateXml, 'updateMafe' => $first]
|
||||
);
|
||||
$first = false;
|
||||
$flagUpdateXml = false;
|
||||
} catch (Exception $e) {
|
||||
@@ -375,6 +419,56 @@ function run_workspace_upgrade($args, $opts)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We will upgrade the CONTENT table
|
||||
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
|
||||
* @param string $args, workspaceName that we need to apply the upgrade-content
|
||||
* @param string $opts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function run_upgrade_content($args, $opts)
|
||||
{
|
||||
//Check if the command is executed by a specific workspace
|
||||
if (count($args) === 1) {
|
||||
upgradeContent($args, $opts);
|
||||
} else {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru('./processmaker upgrade-content ' . $workspace->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function will upgrade the CONTENT table for a workspace
|
||||
* This function is executed only for one workspace
|
||||
* @param array $args, workspaceName that we will to apply the command
|
||||
* @param array $opts, we can send additional parameters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function upgradeContent($args, $opts)
|
||||
{
|
||||
try {
|
||||
//Load the attributes for the workspace
|
||||
$arrayWorkspace = get_workspaces_from_args($args);
|
||||
//Loop, read all the attributes related to the one workspace
|
||||
$wsName = $arrayWorkspace[key($arrayWorkspace)]->name;
|
||||
Bootstrap::setConstantsRelatedWs($wsName);
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
G::outRes("Upgrading content for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||
$workspace->upgradeContent($workspace->name, true);
|
||||
} catch (Exception $e) {
|
||||
G::outRes("Errors upgrading content of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
G::outRes(CLI::error($e->getMessage()) . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We will repair the translation in the languages defined in the workspace
|
||||
* Verify if we need to execute an external program for each workspace
|
||||
|
||||
@@ -98,7 +98,7 @@ print "PATH_DB: " . PATH_DB . "\n";
|
||||
print "PATH_CORE: " . PATH_CORE . "\n";
|
||||
|
||||
// define the site name (instance name)
|
||||
if (! defined ('SYS_SYS')) {
|
||||
if (empty(config("system.workspace"))) {
|
||||
$sObject = $workspaceName;
|
||||
$sNow = ''; // $argv[2];
|
||||
/*
|
||||
@@ -115,11 +115,12 @@ if (! defined ('SYS_SYS')) {
|
||||
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
|
||||
|
||||
define ('SYS_SYS', $sObject);
|
||||
config(["system.workspace" => $sObject]);
|
||||
|
||||
// ****************************************
|
||||
// read initialize file
|
||||
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
$config = System::getSystemConfiguration ('', '', SYS_SYS);
|
||||
$config = System::getSystemConfiguration ('', '', config("system.workspace"));
|
||||
define ('MEMCACHED_ENABLED', $config ['memcached']);
|
||||
define ('MEMCACHED_SERVER', $config ['memcached_server']);
|
||||
define ('TIME_ZONE', $config ['time_zone']);
|
||||
@@ -142,7 +143,7 @@ if (! defined ('SYS_SYS')) {
|
||||
print "MEMCACHED_SERVER: " . $MEMCACHED_SERVER . "\n";
|
||||
|
||||
// ***************** PM Paths DATA **************************
|
||||
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/');
|
||||
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
|
||||
define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
|
||||
define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
|
||||
@@ -337,7 +338,7 @@ function displayMissingCases($aAppUidsDB, $aAppUidsSolr)
|
||||
|
||||
function getListUids($usrUid, $action)
|
||||
{
|
||||
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
|
||||
if (($solrConf = System::solrEnv (config("system.workspace"))) !== false) {
|
||||
|
||||
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
|
||||
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
|
||||
|
||||
Reference in New Issue
Block a user