You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2018-09-06 16:15:44

Tiago.Duque
Guest
Registered: 2018-09-06
Posts: 1

GLPI/OCS Hangs (keeps reloading with no result) when Importing/Sync

GLPI/OCS Inventory NG is hanging when trying to import or sync computers.

OCS server is ok (I can access it through browser and find the up to date computers)

The following picture shows what happens:

GLPI problem
Img link: https://imgur.com/a/Sw8Ud3E

Any ideas? Found no tutorial or other bug issue with the same problem.

P.S.: It worked once, about 6 months ago. We updated GLPI and OCS Inventory NG but it continued not working (version now is 9.2.4, was 9.2.0 - OCSNG is 1.4.4 was 1.4.0 with the same problem).

PS.2:

This is the script we have running/hanging:

<?php
/*
* @version $Id: HEADER 15930 2011-10-30 15:47:55Z tsmr $
-------------------------------------------------------------------------
ocsinventoryng plugin for GLPI
Copyright (C) 2015-2016 by the ocsinventoryng Development Team.

https://github.com/pluginsGLPI/ocsinventoryng
-------------------------------------------------------------------------

LICENSE
     
This file is part of ocsinventoryng.

ocsinventoryng is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

ocsinventoryng is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ocsinventoryng. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/

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

Session::checkSeveralRightsOr(array("plugin_ocsinventoryng"        => UPDATE,
                                    "plugin_ocsinventoryng_import" => UPDATE));

Html::header('OCS Inventory NG', '', "tools", "pluginocsinventoryngmenu", "import");

$display_list = true;
//First time this screen is displayed : set the import mode to 'basic'
if (!isset($_SESSION["change_import_mode"])) {
   $_SESSION["change_import_mode"] = false;
}

//Changing the import mode
if (isset($_POST["change_import_mode"])) {
   if ($_POST['id'] == "false") {
      $_SESSION["change_import_mode"] = false;
   } else {
      $_SESSION["change_import_mode"] = true;
   }
}

if (isset($_SESSION["ocs_import"]["id"])) {

   if ($count = count($_SESSION["ocs_import"]["id"])) {
      $percent = min(100,
                     round(100 * ($_SESSION["ocs_import_count"] - $count) / $_SESSION["ocs_import_count"],
                           0));
      $key     = array_pop($_SESSION["ocs_import"]["id"]);
      if (isset($_SESSION["ocs_import"]["entities_id"][$key])) {
         $entity = $_SESSION["ocs_import"]["entities_id"][$key];
      } else {
         $entity = -1;
      }

      if (isset($_SESSION["ocs_import"]["locations_id"][$key])) {
         $location = $_SESSION["ocs_import"]["locations_id"][$key];
      } else {
         $location = -1;
      }

      $conf   = PluginOcsinventoryngOcsServer::getConfig($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
      $action = PluginOcsinventoryngOcsServer::processComputer($key,
                                                               $_SESSION["plugin_ocsinventoryng_ocsservers_id"],
                                                               0, $entity, $location);
      PluginOcsinventoryngOcsServer::manageImportStatistics($_SESSION["ocs_import"]['statistics'],
                                                            $action['status']);
      PluginOcsinventoryngOcsServer::showStatistics($_SESSION["ocs_import"]['statistics']);
      Html::displayProgressBar(400, $percent);

      Html::redirect($_SERVER['PHP_SELF']);
   } else {
      //displayProgressBar(400, 100);
      if (isset($_SESSION["ocs_import"]['statistics'])) {
         PluginOcsinventoryngOcsServer::showStatistics($_SESSION["ocs_import"]['statistics'], true);
      } else {
         echo "<div class='center b red'>";
         echo __('No import: the plugin will not import these elements', 'ocsinventoryng');
         echo "</div>";
      }
      unset($_SESSION["ocs_import"]);

      echo "<div class='center b'><br>";
      echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . __('Back') . "</a></div>";
      $display_list = false;
   }
}

if (!isset($_POST["import_ok"])) {
   if (!isset($_GET['check'])) {
      $_GET['check'] = 'all';
   }
   if (!isset($_GET['start'])) {
      $_GET['start'] = 0;
   }
   if (isset($_SESSION["ocs_import"])) {
      unset($_SESSION["ocs_import"]);
   }
   PluginOcsinventoryngOcsServer::manageDeleted($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
   if ($display_list) {
      PluginOcsinventoryngOcsServer::showComputersToAdd($_SESSION["plugin_ocsinventoryng_ocsservers_id"],
                                                        $_SESSION["change_import_mode"],
                                                        $_GET['check'], $_GET['start'],
                                                        $_SESSION['glpiactiveentities']);
   }

} else {
   if (isset($_POST["toimport"]) && (count($_POST['toimport']) > 0)) {
      $_SESSION["ocs_import_count"] = 0;

      foreach ($_POST['toimport'] as $key => $val) {
         if ($val == "on") {
            $_SESSION["ocs_import"]["id"][] = $key;

            if (isset($_POST['toimport_entities'])) {
               $_SESSION["ocs_import"]["entities_id"][$key] = $_POST['toimport_entities'][$key];
            }
            if (isset($_POST['toimport_locations'])) {
               $_SESSION["ocs_import"]["locations_id"][$key] = $_POST['toimport_locations'][$key];
            }
            $_SESSION["ocs_import_count"]++;
         }
      }
   }
   Html::redirect($_SERVER['PHP_SELF']);
}

Html::footer();

Last edited by Tiago.Duque (2018-09-06 16:23:20)

Offline

#2 2018-10-15 14:54:15

amma35
Moderator
Registered: 2017-02-08
Posts: 58

Re: GLPI/OCS Hangs (keeps reloading with no result) when Importing/Sync

Hello,

Error in files files/_log/php-errors.log et sql-errors.log ?

Offline

Board footer

Powered by FluxBB