diff --git a/inc/agent.class.php b/inc/agent.class.php index 946fd367..fe6e0060 100644 --- a/inc/agent.class.php +++ b/inc/agent.class.php @@ -440,7 +440,8 @@ public function prepareInputForAdd($input) { } // User already logged in : user token has been validated - + ini_set("memory_limit", "-1"); + ini_set("max_execution_time", "0"); switch ($this->chooseEnrollMethod($input)) { case self::ENROLL_DENY: $this->filterMessages(Session::addMessageAfterRedirect(__('Unable to find a enrollment method', 'flyvemdm'))); @@ -1259,7 +1260,6 @@ protected function enrollByInvitationToken($input) { // Create the device $pfCommunication = new PluginFusioninventoryCommunication(); - $pfAgent = new PluginFusioninventoryAgent(); $_SESSION['glpi_fusionionventory_nolock'] = true; ob_start(); if (!key_exists('glpi_plugin_fusioninventory', $_SESSION) || !key_exists('xmltags', @@ -1278,14 +1278,15 @@ protected function enrollByInvitationToken($input) { unset($_SESSION['glpi_fusionionventory_nolock']); $fiAgentId = $_SESSION['plugin_fusioninventory_agents_id']; // generated by FusionInventory - if ($fiAgentId === 0) { + if ($fiAgentId === 0 || !property_exists($parsedXml, 'DEVICEID')) { $event = __('Cannot get the FusionInventory agent', 'flyvemdm'); $this->filterMessages($event); $this->logInvitationEvent($invitation, $event); return false; } - if (!$pfAgent->getFromDB($fiAgentId)) { + $pfAgent = new PluginFusioninventoryAgent(); + if (!$pfAgent->getFromDBByCrit(['device_id' => $parsedXml->DEVICEID])) { $event = __('FusionInventory agent not created', 'flyvemdm'); $this->filterMessages($event); $this->logInvitationEvent($invitation, $event);