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 777b04a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
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 777b04a

Please sign in to comment.