Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
feat(install): set default user for cli_install
Browse files Browse the repository at this point in the history
Signed-off-by: Domingo Oropeza <[email protected]>
  • Loading branch information
DIOHz0r committed Sep 14, 2018
1 parent 38b8641 commit 9ab17b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions phpunit/0_Install/FusinvInstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public function testForceInstall() {
function install($force = false) {
$output = [];
$returncode = 0;
$command = "php -f ".FUSINV_ROOT. "/scripts/cli_install.php -- --as-user 'glpi'";
$command = "php -f ".FUSINV_ROOT. "/scripts/cli_install.php";
if ($force) {
$command.= " --force-install";
$command.= " -- --as-user 'glpi' --force-install";
}
exec($command, $output, $returncode);
$this->assertEquals(0, $returncode,
Expand Down
7 changes: 6 additions & 1 deletion scripts/cli_install.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@
die("GLPI not installed\n");
}

$user = new User();
if (!is_null($args['--as-user'])) {
$user = new User();
$user->getFromDBbyName($args['--as-user']);
} elseif(is_null($args['--as-user'])) {
$user->getFromDBbyName('glpi');
}

if(!$user->isNewItem()){
$auth = new Auth();
$auth->auth_succeded = true;
$auth->user = $user;
Expand Down

0 comments on commit 9ab17b5

Please sign in to comment.