Skip to content

Commit

Permalink
Fix issue with weird behaviour of array_diff when comparing arrays an…
Browse files Browse the repository at this point in the history
…d adjust this logic
  • Loading branch information
donhardman committed Dec 12, 2023
1 parent 979e36f commit a6c5de0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Lib/QueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,25 @@ public static function printPluginsInfo(): void {
* @return array<array{full:string,short:string,version:string}>
*/
public static function getCorePlugins(): array {
return array_filter(static::$corePlugins, fn ($v) => str_starts_with($v['full'], 'manticoresoftware/'));
return array_values(
array_filter(
static::$corePlugins,
fn ($v) => str_starts_with($v['full'], 'manticoresoftware/')
)
);
}

/**
* Get local plugins by getting diff
* @return array<array{full:string,short:string,version:string}>
*/
public static function getLocalPlugins(): array {
return array_diff(static::$corePlugins, static::getCorePlugins());
return array_values(
array_filter(
static::$corePlugins,
fn ($v) => !str_starts_with($v['full'], 'manticoresoftware/')
)
);
}

/**
Expand Down
1 change: 1 addition & 0 deletions test/Buddy/functional/DebugModeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function testDebugModeOn(): void {
// Checking the log part corresponding to the latest searchd start
$logUpdate = str_replace($this->searchdLog, '', (string)file_get_contents($this->searchdLogFilepath));
$this->assertStringContainsString('[BUDDY] memory usage:', $logUpdate);
self::setManticoreConfigFile('manticore.conf');
}

}

0 comments on commit a6c5de0

Please sign in to comment.