PMC-1213 Set missing values
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user