Skip to content

Commit ff2b1ca

Browse files
committed
Bump version
1 parent 5fd9d67 commit ff2b1ca

File tree

10 files changed

+166
-136
lines changed

10 files changed

+166
-136
lines changed

ocsinventoryng.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
<author>Walid Nouh</author>
2929
</authors>
3030
<versions>
31+
<version>
32+
<num>2.1.2</num>
33+
<compatibility>~11.0</compatibility>
34+
<download_url>https://github.com/pluginsGLPI/ocsinventoryng/releases/download/2.1.2/glpi-ocsinventoryng-2.1.2.tar.bz2</download_url>
35+
</version>
3136
<version>
3237
<num>2.1.1</num>
3338
<compatibility>~11.0</compatibility>

public/scripts/glpienv.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?php
22

33
define("GLPI_DIR_ROOT", "../../../..");
4+
require_once GLPI_DIR_ROOT . '/src/Glpi/Application/ResourcesChecker.php';
5+
(new \Glpi\Application\ResourcesChecker(GLPI_DIR_ROOT))->checkResources();
46

57
include GLPI_DIR_ROOT . '/vendor/autoload.php';
68
$kernel = new \Glpi\Kernel\Kernel($options['env'] ?? null);
9+
$application = new \Glpi\Console\Application($kernel);
710

811
echo "GLPI_LOG_DIR=" . GLPI_LOG_DIR . "\n";
912
echo "GLPI_LOCK_DIR=" . GLPI_LOCK_DIR . "\n";

public/scripts/ocsng_fullsync.php

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* @version $Id: HEADER 15930 2011-10-30 15:47:55Z tsmr $
45
-------------------------------------------------------------------------
@@ -34,6 +35,14 @@
3435
use GlpiPlugin\Ocsinventoryng\Server;
3536
use GlpiPlugin\Ocsinventoryng\Thread;
3637

38+
define("GLPI_DIR_ROOT", "../../../..");
39+
require_once GLPI_DIR_ROOT . '/src/Glpi/Application/ResourcesChecker.php';
40+
(new \Glpi\Application\ResourcesChecker(GLPI_DIR_ROOT))->checkResources();
41+
42+
include GLPI_DIR_ROOT . '/vendor/autoload.php';
43+
$kernel = new \Glpi\Kernel\Kernel($options['env'] ?? null);
44+
$application = new \Glpi\Console\Application($kernel);
45+
3746
set_time_limit(0);
3847
ini_set('mysql.connect_timeout', '0');
3948
ini_set("memory_limit", "-1");
@@ -55,13 +64,6 @@
5564
}
5665
}
5766

58-
// Can't run on MySQL replicate
59-
$USEDBREPLICATE = 0;
60-
$DBCONNECTION_REQUIRED = 1;
61-
62-
// MASS IMPORT for OCSNG
63-
64-
6567
$_SESSION["glpicronuserrunning"] = $_SESSION["glpiname"] = 'ocsinventoryng';
6668
// Check PHP Version - sometime (debian) cli version != module version
6769
if (phpversion() < "5") {
@@ -82,7 +84,7 @@
8284
$thread_nbr = '';
8385
$threadid = '';
8486
$ocsservers_id = -1;
85-
$fields = array();
87+
$fields = [];
8688

8789
//Get script configuration
8890
$config = new Config();
@@ -218,11 +220,11 @@ function FirstPass($ocsservers_id)
218220
$ocsClient = OcsServer::getDBocs($ocsservers_id);
219221

220222
// Compute lastest new computer
221-
$ocsResult = $ocsClient->getComputers(array(
222-
'COMPLETE' => '0',
223-
'MAX_RECORDS' => 1,
224-
'ORDER' => 'ID DESC',
225-
));
223+
$ocsResult = $ocsClient->getComputers([
224+
'COMPLETE' => '0',
225+
'MAX_RECORDS' => 1,
226+
'ORDER' => 'ID DESC',
227+
]);
226228

227229
if (count($ocsResult['COMPUTERS'])) {
228230
$max_id = key($ocsResult['COMPUTERS']);
@@ -345,15 +347,15 @@ function plugin_ocsinventoryng_importFromOcsServer(
345347

346348
$ocsServerId = $cfg_ocs['id'];
347349
$ocsClient = OcsServer::getDBocs($ocsServerId);
348-
$ocsComputers = array();
350+
$ocsComputers = [];
349351

350352
// Build common options
351353
//$inventoriedBefore = new DateTime('@'.(time() - 180));
352354

353-
$computerOptions = array(
354-
'COMPLETE' => '0',
355-
'ORDER' => 'LASTDATE',
356-
);
355+
$computerOptions = [
356+
'COMPLETE' => '0',
357+
'ORDER' => 'LASTDATE',
358+
];
357359

358360
// Limit the number of imported records according to config
359361
if ($config->fields["import_limit"] > 0) {
@@ -372,7 +374,7 @@ function plugin_ocsinventoryng_importFromOcsServer(
372374
// Get newly inventoried computers
373375
$firstQueryOptions = $computerOptions;
374376
// if ($server->fields["max_glpidate"] != '0000-00-00 00:00:00') {
375-
// $firstQueryOptions['FILTER']['INVENTORIED_BEFORE'] = $server->fields["max_glpidate"];
377+
// $firstQueryOptions['FILTER']['INVENTORIED_BEFORE'] = $server->fields["max_glpidate"];
376378
// }
377379

378380
$firstQueryOptions['FILTER']['CHECKSUM'] = intval($cfg_ocs["checksum"]);
@@ -386,17 +388,17 @@ function plugin_ocsinventoryng_importFromOcsServer(
386388
// Some conditions can't be sent to OCS, so we have to do this in a loop
387389
// Maybe add this to SOAP ?
388390
// if (isset($ocsResult['COMPUTERS'])) {
389-
// $excludeIds = array();
390-
// foreach ($ocsResult['COMPUTERS'] as $ID => $computer) {
391-
// if ($ID <= intval($server->fields["max_ocsid"]) and (!$multiThread or ($ID % $thread_nbr) == ($threadid - 1))) {
392-
// $ocsComputers[$ID] = $computer;
393-
// }
394-
// $excludeIds [] = $ID;
395-
// }
396-
//
397-
// $secondQueryOptions['FILTER']['EXCLUDE_IDS'] = $excludeIds;
391+
// $excludeIds = array();
392+
// foreach ($ocsResult['COMPUTERS'] as $ID => $computer) {
393+
// if ($ID <= intval($server->fields["max_ocsid"]) and (!$multiThread or ($ID % $thread_nbr) == ($threadid - 1))) {
394+
// $ocsComputers[$ID] = $computer;
395+
// }
396+
// $excludeIds [] = $ID;
397+
// }
398+
//
399+
// $secondQueryOptions['FILTER']['EXCLUDE_IDS'] = $excludeIds;
398400
// }
399-
//
401+
//
400402
// $secondQueryOptions['FILTER']['CHECKSUM'] = intval($cfg_ocs["checksum"]);
401403

402404
// $ocsResult = $ocsClient->getComputers($secondQueryOptions);
@@ -461,9 +463,9 @@ function plugin_ocsinventoryng_importFromOcsServer(
461463
echo ".";
462464
$entities_id = 0;
463465
$process_params = ['ocsid' => $ID,
464-
'plugin_ocsinventoryng_ocsservers_id' => $ocsServerId,
465-
'lock' => 1,
466-
'force' => 1];
466+
'plugin_ocsinventoryng_ocsservers_id' => $ocsServerId,
467+
'lock' => 1,
468+
'force' => 1];
467469

468470
$action = OcsProcess::processComputer($process_params);
469471
OcsProcess::manageImportStatistics($fields, $action['status']);

public/scripts/ocsng_snmpfullsync.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
use GlpiPlugin\Ocsinventoryng\SnmpOcslink;
3535
use GlpiPlugin\Ocsinventoryng\Thread;
3636

37+
define("GLPI_DIR_ROOT", "../../../..");
38+
require_once GLPI_DIR_ROOT . '/src/Glpi/Application/ResourcesChecker.php';
39+
(new \Glpi\Application\ResourcesChecker(GLPI_DIR_ROOT))->checkResources();
40+
41+
include GLPI_DIR_ROOT . '/vendor/autoload.php';
42+
$kernel = new \Glpi\Kernel\Kernel($options['env'] ?? null);
43+
$application = new \Glpi\Console\Application($kernel);
44+
3745
ini_set("memory_limit", "-1");
3846
ini_set("max_execution_time", "0");
3947

public/scripts/ocsrollback.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
use GlpiPlugin\Ocsinventoryng\DBocs;
3636
use GlpiPlugin\Ocsinventoryng\OcsServer;
3737

38+
define("GLPI_DIR_ROOT", "../../../..");
39+
require_once GLPI_DIR_ROOT . '/src/Glpi/Application/ResourcesChecker.php';
40+
(new \Glpi\Application\ResourcesChecker(GLPI_DIR_ROOT))->checkResources();
41+
42+
include GLPI_DIR_ROOT . '/vendor/autoload.php';
43+
$kernel = new \Glpi\Kernel\Kernel($options['env'] ?? null);
44+
$application = new \Glpi\Console\Application($kernel);
45+
3846
ini_set("memory_limit", "-1");
3947
ini_set("max_execution_time", "0");
4048

public/scripts/run.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@echo off
22
echo Chemins php et du script a lancer
33

4-
SET path_php="D:\wamp64\bin\php\php7.2.4"
5-
SET plugin_glpi="D:\wamp64\www\glpi931\plugins\ocsinventoryng\scripts"
4+
SET path_php="C:\wamp\bin\php\php8.3.24"
5+
SET plugin_glpi="C:\wamp\www\glpi11\marketplace\ocsinventoryng\public\scripts"
66

77
echo Definition du path
88

@@ -22,4 +22,4 @@ GOTO FIN
2222
echo Le chemin vers run.php est incorrect
2323
pause
2424

25-
:FIN
25+
:FIN

0 commit comments

Comments
 (0)