datainjection icon indicating copy to clipboard operation
datainjection copied to clipboard

Model::clean does no longer process DB criterias for filtering (e.g. "itemtype" => "PluginXyz")

Open flex-pgum opened this issue 4 months ago • 2 comments

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • [x] I have searched the existing issues

GLPI Version

11.0.1

Plugin version

2.15.1

Bug description

Since #477 the clean method of class PluginDatainjectionModel does no longer process $crit (db criterias for filtering). This causes problems when working with plugins (uninstall of plugins).

Relevant log output

[2025-10-28 11:06:59] glpi.CRITICAL:   *** Uncaught PHP Exception RuntimeException: "MySQL query error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'glpi_plugin_datainjection_models' at line 1 (1064) in SQL query "glpi_plugin_datainjection_models"." at DBmysql.php line 371
  Backtrace :
  .\src\DBmysql.php:371                              
  .\plugins\datainjection\inc\model.class.php:841    DBmysql->doQuery()
  .\plugins\simcard\inc\simcard.class.php:669        PluginDatainjectionModel::clean()
  .\plugins\simcard\hook.php:84                      PluginSimcardSimcard::uninstall()
  .\src\Plugin.php:1087                              plugin_simcard_uninstall()
  .\front\plugin.form.php:60                         Plugin->uninstall()
  ...Glpi\Controller\LegacyFileLoadController.php:64 require()
  .\vendor\symfony\http-kernel\HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  .\vendor\symfony\http-kernel\HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  .\vendor\symfony\http-kernel\Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  .\public\index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

flex-pgum avatar Oct 28 '25 10:10 flex-pgum

Since this was a large commit and github is really slow on showing the file diffs, here is a screenshot of the commit which introduced the problem:

Image

flex-pgum avatar Oct 28 '25 10:10 flex-pgum

Hi @flex-pgum

can you try https://github.com/pluginsGLPI/datainjection/pull/543

stonebuzz avatar Nov 03 '25 14:11 stonebuzz

Tested it with the latest change from #543 (using deleteByCriteria), everything wortks as expected: my plugin fully uninstalls and plugin-related models are cleared without any error. Thank you!

flex-pgum avatar Nov 06 '25 15:11 flex-pgum