function plugin_fusioninventory_install()
{
    ini_set("max_execution_time", "0");
    if (basename($_SERVER['SCRIPT_NAME']) != "cli_install.php") {
        Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugins");
        $migrationname = 'Migration';
    } else {
        $migrationname = 'CliMigration';
    }
    require_once GLPI_ROOT . "/plugins/fusioninventory/install/update.php";
    $version_detected = pluginFusioninventoryGetCurrentVersion();
    if (isset($version_detected) and (defined('FORCE_UPGRADE') or $version_detected != PLUGIN_FUSIONINVENTORY_VERSION and $version_detected != '0')) {
        pluginFusioninventoryUpdate($version_detected, $migrationname);
    } else {
        if (isset($version_detected) && $version_detected == PLUGIN_FUSIONINVENTORY_VERSION) {
            //Same version : Nothing to do
        } else {
            require_once GLPI_ROOT . "/plugins/fusioninventory/install/install.php";
            pluginFusioninventoryInstall(PLUGIN_FUSIONINVENTORY_VERSION, $migrationname);
        }
    }
    return TRUE;
}
$CFG_GLPI["use_log_in_files"] = 1;
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
//set_error_handler('userErrorHandlerDebug');
$DB = new DB();
if (!$DB->connected) {
    die("No DB connection\n");
}
/*---------------------------------------------------------------------*/
if (!TableExists("glpi_configs")) {
    die("GLPI not installed\n");
}
$plugin = new Plugin();
require_once GLPI_ROOT . "/plugins/fusioninventory/install/climigration.class.php";
include GLPI_ROOT . "/plugins/fusioninventory/install/update.php";
$current_version = pluginFusioninventoryGetCurrentVersion();
$migration = new CliMigration($current_version);
if (!isset($current_version)) {
    $current_version = 0;
}
if ($current_version == '0') {
    $migration->displayWarning("***** Install process of plugin FUSIONINVENTORY *****");
} else {
    $migration->displayWarning("***** Update process of plugin FUSIONINVENTORY *****");
}
$migration->displayWarning("Current FusionInventory version: {$current_version}");
$migration->displayWarning("Version to update: " . PLUGIN_FUSIONINVENTORY_VERSION);
// To prevent problem of execution time
ini_set("max_execution_time", "0");
ini_set("memory_limit", "-1");
ini_set("session.use_cookies", "0");