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

Commit

Permalink
fix(install): set missing agent base url on 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 Oct 2, 2018
1 parent 0799368 commit d577775
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ before_install:
before_script:
- phpenv version-name | grep ^5.[34] && echo "extension=apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; true
- phpenv version-name | grep ^5.[34] && echo "apc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; true
- php -S localhost:8088 -t glpi > /dev/null 2>&1 &
- php -S localhost:8000 -t glpi > /dev/null 2>&1 &

script:
- composer install
Expand Down
2 changes: 1 addition & 1 deletion inc/inventorycomputerlib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function updateComputer($a_computerinventory, $computers_id, $no_history, $setdy
//OS exists, check for updates
$same = true;
foreach ($input_os as $key => $value) {
if ($ios->fields[$key] != $value) {
if (isset($ios->fields[$key]) && $ios->fields[$key] != $value) {
$same = false;
break;
}
Expand Down
25 changes: 9 additions & 16 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,22 +337,15 @@ function pluginFusioninventoryInstall($version, $migrationname = 'Migration') {
/*
* Define when install agent_base_url in glpi_plugin_fusioninventory_entities
*/
$full_url = filter_input(INPUT_SERVER, "PHP_SELF");
$https = filter_input(INPUT_SERVER, "HTTPS");
$http_host = filter_input(INPUT_SERVER, "HTTP_HOST");
if (!empty($full_url) && !strstr($full_url, 'cli_install.php')) {
if (!empty($https)) {
$agent_base_url = 'https://'.$http_host.$full_url;
} else {
$agent_base_url = 'http://'.$http_host.$full_url;
}
$agent_base_url = str_replace('/front/plugin.form.php', '', $agent_base_url);
$DB->update(
'glpi_plugin_fusioninventory_entities', [
'agent_base_url' => $agent_base_url
], [
'id' => 1
]
$iterator = $DB->request([
'SELECT' => 'value',
'FROM' => Config::getTable(),
'WHERE' => ['name' => 'url_base'],
]);
if ($row = $iterator->next()) {
$DB->update('glpi_plugin_fusioninventory_entities',
['agent_base_url' => rtrim($row['value'], '/')],
['id' => 1]
);
}

Expand Down
4 changes: 4 additions & 0 deletions phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

include('./glpi/inc/includes.php');

Config::setConfigurationValues('core', [
'url_base' => 'http://localhost:8000'
]);

if (!defined('FUSINV_ROOT')) {
define('FUSINV_ROOT', GLPI_ROOT . DIRECTORY_SEPARATOR . '/plugins/fusioninventory');
set_include_path(
Expand Down

0 comments on commit d577775

Please sign in to comment.