pluginsGLPI / ocsinventoryng

Plugin ocsinventoryng for GLPI
GNU General Public License v2.0
68 stars 52 forks source link

When update GLPI to 10.0.3 - ocsng_fullsync.sh - SQL Error "1064" #13077 #334

Closed NilsBay closed 1 year ago

NilsBay commented 1 year ago

Hello,

the following for your information.

After update GLPI to 10.0.3 (and OCS plugin to 2.0.2) and OCS to 2.11.0,

When I launch the script : /var/www/glpplugins/ocsinventoryng/scripts/ocsng_fullsync.sh

with the command (in crontab or manually) : /var/www/glpplugins/ocsinventoryng/scripts/ocsng_fullsync.sh --thread_nbr=10 --server_id=1 --nolog > /dev/pts/0

I have the following SQL Error (once I did not have it) : SQL Error "1064": You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY is_dynamic' at line 5 in query "SELECT id, name, is_dynamic, mainitems_id FROM glpi_ipaddresses WHERE itemtype = 'NetworkName' AND items_id = ORDER BY is_dynamic"

With find /var/www/glpi -type f -exec grep -H 'SELECT id, name, is_dynamic, mainitems_id' {} ;

I found the file /var/www/glpi/plugins/ocsinventoryng/inc/networkport.class.php

In this file I found the query $query = "SELECT id, is_dynamic FROM glpi_networknames WHERE itemtype = 'NetworkPort' AND items_id = $networkports_id ORDER BY is_dynamic";


glpi/files/_log/sql-errors.log

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY is_dynamic' at line 5 Backtrace : src/DBmysqlIterator.php:110
src/DBmysql.php:1048 DBmysqlIterator->execute() ...ns/ocsinventoryng/inc/networkport.class.php:209 DBmysql->request() ...ns/ocsinventoryng/inc/networkport.class.php:451 PluginOcsinventoryngNetworkPort::updateNetworkPort() plugins/ocsinventoryng/inc/device.class.php:546 PluginOcsinventoryngNetworkPort::importNetwork() ...ns/ocsinventoryng/inc/ocsprocess.class.php:1292 PluginOcsinventoryngDevice::updateDevices() ...ins/ocsinventoryng/inc/ocsprocess.class.php:471 PluginOcsinventoryngOcsProcess::synchronizeComputer() ...s/ocsinventoryng/scripts/ocsng_fullsync.php:448 PluginOcsinventoryngOcsProcess::processComputer() ...s/ocsinventoryng/scripts/ocsng_fullsync.php:297 plugin_ocsinventoryng_importFromOcsServer() ...s/ocsinventoryng/scripts/ocsng_fullsync.php:166 SecondPass() {"user":"@inventaire.local","mem_usage":"1.889\", 31.96Mio)"}


I cannot help much. Nils.

tsmr commented 1 year ago

fixed here https://github.com/pluginsGLPI/ocsinventoryng/commit/c438b60d034a9b7ab01a1e0805d356a35909d9c4

NilsBay commented 1 year ago

Thank you very much !