This commit is contained in:
Netkas 2022-09-11 14:44:28 -04:00
parent b60963fe47
commit 88e92f82c4
2 changed files with 20 additions and 17 deletions

View file

@ -23,8 +23,8 @@
use ncc\ThirdParty\Symfony\Filesystem\Exception\IOException;
use ncc\ThirdParty\Symfony\Filesystem\Filesystem;
use ncc\ThirdParty\Symfony\Process\Exception\ProcessFailedException;
use ncc\ThirdParty\Symfony\Process\ExecutableFinder;
use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
use ncc\ThirdParty\Symfony\Process\ExecutableFinder;
use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\ThirdParty\Symfony\Yaml\Yaml;
use ncc\Utilities\Console;
@ -37,7 +37,7 @@ use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
# Global Variables
$NCC_INSTALL_PATH=DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'ncc';
$NCC_DATA_PATH=DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'ncc';
$NCC_UPDATE_SOURCE='https://updates.nosial.com/ncc/check_updates?current_version=$VERSION'; # Unused
$NCC_COMPOSER_UPDATE_SOURCE='https://getcomposer.org/installer';
$NCC_CHECKSUM=__DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin';
$NCC_AUTOLOAD=__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
$NCC_PHP_EXECUTABLE=null;
@ -154,6 +154,12 @@ use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
}
// Check if running as root
if(function_exists('posix_getuid') == false)
{
Console::outError('The function posix_getuid() is not available on your system, please make sure the extension `php-common` is installed');
exit(1);
}
if (posix_getuid() !== 0)
{
Console::outError('You must be running as root');
@ -463,7 +469,7 @@ use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
$fp = fopen($NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'composer-setup.php', 'w+');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://getcomposer.org/installer');
curl_setopt($ch, CURLOPT_URL, $NCC_COMPOSER_UPDATE_SOURCE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
curl_setopt($ch, CURLOPT_FILE, $fp);
@ -491,7 +497,7 @@ use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
}
catch(ProcessFailedException $e)
{
Console::outError('Cannot install compos)er, ' . $e->getMessage());
Console::outError('Cannot install composer, ' . $e->getMessage());
exit(1);
}
@ -619,11 +625,11 @@ use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
{
if(isset($config_obj[$section]))
{
foreach($value as $section_item)
foreach($value as $section_item => $section_value)
{
if(!isset($config_obj[$section][$section_item]))
{
$config_obj[$section][$section_item] = $value;
$config_obj[$section][$section_item] = $section_value;
}
}
}