PMC-1213 Set missing values

This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-09-17 17:22:39 -04:00
parent 9cd74bb6be
commit 0a19bbb366
2 changed files with 44 additions and 25 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use Maveriks\WebApplication;
use ProcessMaker\Core\System;
trait AddParametersTrait
{
@@ -33,6 +34,7 @@ trait AddParametersTrait
{
$workspace = $this->option('workspace');
if (!empty($workspace)) {
System::readServerInfoFile($workspace);
$webApplication = new WebApplication();
$webApplication->setRootDir($this->option('processmakerPath'));
$webApplication->loadEnvironment($workspace);

View File

@@ -1001,16 +1001,16 @@ class System
$arrayDataEmailServerConfig = array(
"MESS_ENGINE" => $arrayEmailServerDefault["MESS_ENGINE"],
"MESS_SERVER" => $arrayEmailServerDefault["MESS_SERVER"],
"MESS_PORT" => (int)($arrayEmailServerDefault["MESS_PORT"]),
"MESS_RAUTH" => (int)($arrayEmailServerDefault["MESS_RAUTH"]),
"MESS_PORT" => (int) ($arrayEmailServerDefault["MESS_PORT"]),
"MESS_RAUTH" => (int) ($arrayEmailServerDefault["MESS_RAUTH"]),
"MESS_ACCOUNT" => $arrayEmailServerDefault["MESS_ACCOUNT"],
"MESS_PASSWORD" => $arrayEmailServerDefault["MESS_PASSWORD"],
"MESS_FROM_MAIL" => $arrayEmailServerDefault["MESS_FROM_MAIL"],
"MESS_FROM_NAME" => $arrayEmailServerDefault["MESS_FROM_NAME"],
"SMTPSecure" => $arrayEmailServerDefault["SMTPSECURE"],
"MESS_TRY_SEND_INMEDIATLY" => (int)($arrayEmailServerDefault["MESS_TRY_SEND_INMEDIATLY"]),
"MESS_TRY_SEND_INMEDIATLY" => (int) ($arrayEmailServerDefault["MESS_TRY_SEND_INMEDIATLY"]),
"MAIL_TO" => $arrayEmailServerDefault["MAIL_TO"],
"MESS_DEFAULT" => (int)($arrayEmailServerDefault["MESS_DEFAULT"]),
"MESS_DEFAULT" => (int) ($arrayEmailServerDefault["MESS_DEFAULT"]),
"MESS_ENABLED" => 1,
"MESS_BACKGROUND" => "",
"MESS_PASSWORD_HIDDEN" => "",
@@ -1682,4 +1682,21 @@ class System
}
return (object) $result;
}
/**
* This read the server information file and set the missing values to $_SERVER.
* @param string $workspace
*/
public static function readServerInfoFile(string $workspace)
{
$path = PATH_DATA . "sites" . DIRECTORY_SEPARATOR . $workspace . DIRECTORY_SEPARATOR;
if (is_file($path . '.server_info')) {
$string = file_get_contents($path . '.server_info');
$result = unserialize($string);
$_SERVER['SERVER_NAME'] = $result['SERVER_NAME'];
$_SERVER['SERVER_PORT'] = $result['SERVER_PORT'];
} else {
eprintln('WARNING! No server info found!', 'red');
}
}
}