PMC-1213 Set missing values
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Maveriks\WebApplication;
|
use Maveriks\WebApplication;
|
||||||
|
use ProcessMaker\Core\System;
|
||||||
|
|
||||||
trait AddParametersTrait
|
trait AddParametersTrait
|
||||||
{
|
{
|
||||||
@@ -33,6 +34,7 @@ trait AddParametersTrait
|
|||||||
{
|
{
|
||||||
$workspace = $this->option('workspace');
|
$workspace = $this->option('workspace');
|
||||||
if (!empty($workspace)) {
|
if (!empty($workspace)) {
|
||||||
|
System::readServerInfoFile($workspace);
|
||||||
$webApplication = new WebApplication();
|
$webApplication = new WebApplication();
|
||||||
$webApplication->setRootDir($this->option('processmakerPath'));
|
$webApplication->setRootDir($this->option('processmakerPath'));
|
||||||
$webApplication->loadEnvironment($workspace);
|
$webApplication->loadEnvironment($workspace);
|
||||||
|
|||||||
@@ -180,17 +180,17 @@ class System
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For distros with the lsb_release, this returns a one-line description of
|
/* For distros with the lsb_release, this returns a one-line description of
|
||||||
* the distro name, such as "CentOS release 5.3 (Final)" or "Ubuntu 10.10"
|
* the distro name, such as "CentOS release 5.3 (Final)" or "Ubuntu 10.10"
|
||||||
*/
|
*/
|
||||||
$distro = '';
|
$distro = '';
|
||||||
if (file_exists("/dev/")) { //Windows does not have this folder
|
if (file_exists("/dev/")) { //Windows does not have this folder
|
||||||
$distro = exec("lsb_release -d -s 2> /dev/null");
|
$distro = exec("lsb_release -d -s 2> /dev/null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For distros without lsb_release, we look for *release (such as
|
/* For distros without lsb_release, we look for *release (such as
|
||||||
* redhat-release, gentoo-release, SuSE-release, etc) or *version (such as
|
* redhat-release, gentoo-release, SuSE-release, etc) or *version (such as
|
||||||
* debian_version, slackware-version, etc)
|
* debian_version, slackware-version, etc)
|
||||||
*/
|
*/
|
||||||
if (empty($distro)) {
|
if (empty($distro)) {
|
||||||
foreach (glob("/etc/*release") as $filename) {
|
foreach (glob("/etc/*release") as $filename) {
|
||||||
$distro = trim(file_get_contents($filename));
|
$distro = trim(file_get_contents($filename));
|
||||||
@@ -209,8 +209,8 @@ class System
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* CentOS returns a string with quotes, remove them and append
|
/* CentOS returns a string with quotes, remove them and append
|
||||||
* the OS name (such as LINUX, WINNT, DARWIN, etc)
|
* the OS name (such as LINUX, WINNT, DARWIN, etc)
|
||||||
*/
|
*/
|
||||||
$distro = trim($distro, "\"") . " (" . PHP_OS . ")";
|
$distro = trim($distro, "\"") . " (" . PHP_OS . ")";
|
||||||
|
|
||||||
$Fields = [];
|
$Fields = [];
|
||||||
@@ -1001,16 +1001,16 @@ class System
|
|||||||
$arrayDataEmailServerConfig = array(
|
$arrayDataEmailServerConfig = array(
|
||||||
"MESS_ENGINE" => $arrayEmailServerDefault["MESS_ENGINE"],
|
"MESS_ENGINE" => $arrayEmailServerDefault["MESS_ENGINE"],
|
||||||
"MESS_SERVER" => $arrayEmailServerDefault["MESS_SERVER"],
|
"MESS_SERVER" => $arrayEmailServerDefault["MESS_SERVER"],
|
||||||
"MESS_PORT" => (int)($arrayEmailServerDefault["MESS_PORT"]),
|
"MESS_PORT" => (int) ($arrayEmailServerDefault["MESS_PORT"]),
|
||||||
"MESS_RAUTH" => (int)($arrayEmailServerDefault["MESS_RAUTH"]),
|
"MESS_RAUTH" => (int) ($arrayEmailServerDefault["MESS_RAUTH"]),
|
||||||
"MESS_ACCOUNT" => $arrayEmailServerDefault["MESS_ACCOUNT"],
|
"MESS_ACCOUNT" => $arrayEmailServerDefault["MESS_ACCOUNT"],
|
||||||
"MESS_PASSWORD" => $arrayEmailServerDefault["MESS_PASSWORD"],
|
"MESS_PASSWORD" => $arrayEmailServerDefault["MESS_PASSWORD"],
|
||||||
"MESS_FROM_MAIL" => $arrayEmailServerDefault["MESS_FROM_MAIL"],
|
"MESS_FROM_MAIL" => $arrayEmailServerDefault["MESS_FROM_MAIL"],
|
||||||
"MESS_FROM_NAME" => $arrayEmailServerDefault["MESS_FROM_NAME"],
|
"MESS_FROM_NAME" => $arrayEmailServerDefault["MESS_FROM_NAME"],
|
||||||
"SMTPSecure" => $arrayEmailServerDefault["SMTPSECURE"],
|
"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"],
|
"MAIL_TO" => $arrayEmailServerDefault["MAIL_TO"],
|
||||||
"MESS_DEFAULT" => (int)($arrayEmailServerDefault["MESS_DEFAULT"]),
|
"MESS_DEFAULT" => (int) ($arrayEmailServerDefault["MESS_DEFAULT"]),
|
||||||
"MESS_ENABLED" => 1,
|
"MESS_ENABLED" => 1,
|
||||||
"MESS_BACKGROUND" => "",
|
"MESS_BACKGROUND" => "",
|
||||||
"MESS_PASSWORD_HIDDEN" => "",
|
"MESS_PASSWORD_HIDDEN" => "",
|
||||||
@@ -1682,4 +1682,21 @@ class System
|
|||||||
}
|
}
|
||||||
return (object) $result;
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user