Commit 477eb33d authored by Alexandre Delaunay's avatar Alexandre Delaunay Committed by Johan Cwiklinski

search softwares: fix bad performances

fix performance issue when summing licenses in software search
parent abcb711f
......@@ -358,7 +358,7 @@ class Search {
break;
case 'sort':
$p[$key] = intval($val);
if ($p[$key] <= 0) {
if ($p[$key] < 0) {
$p[$key] = 1;
}
break;
......
......@@ -1107,4 +1107,10 @@ class Software extends CommonDBTM {
}
static function getDefaultSearchRequest() {
return [
'sort' => 0
];
}
}
......@@ -8098,7 +8098,7 @@ CREATE TABLE `glpi_softwarelicenses` (
KEY `softwarelicensetypes_id` (`softwarelicensetypes_id`),
KEY `softwareversions_id_use` (`softwareversions_id_use`),
KEY `date_mod` (`date_mod`),
KEY `softwares_id_expire` (`softwares_id`,`expire`),
KEY `softwares_id_expire_number` (`softwares_id`,`expire`, `number`),
KEY `locations_id` (`locations_id`),
KEY `users_id_tech` (`users_id_tech`),
KEY `users_id` (`users_id`),
......
......@@ -105,6 +105,14 @@ function update94to95() {
$migration->addConfig(['timezone' => null]);
/** /Timezones */
// Fix search Softwares performance
$migration->dropKey('glpi_softwarelicenses', 'softwares_id_expire_number');
$migration->addKey('glpi_softwarelicenses', [
'softwares_id',
'expire',
'number'
], 'softwares_id_expire_number');
// ************ Keep it at the end **************
$migration->executeMigration();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment