Fix repository indexing.

This commit is contained in:
2023-05-22 15:06:43 +02:00
parent 407a8aa345
commit 0d5597e37f
7 changed files with 81 additions and 77 deletions

View File

@@ -232,9 +232,18 @@ class Infusion
array(&$context, &$path, &$key, &$powers)
);
// we add and all missing powers
if (isset($this->power->old_superpowers[$path]))
{
$this->mergePowers($powers, $this->power->old_superpowers[$path]);
}
// POWERREADME
$this->content->set_($key, 'POWERREADME', $this->reposreadme->get($powers));
// sort all powers
$this->sortPowers($powers);
// POWERINDEX
$this->content->set_($key, 'POWERINDEX', $this->index($powers));
@@ -247,6 +256,34 @@ class Infusion
}
}
/**
* Merge the old missing powers found in local repository back into the index
*
* @return void
* @since 3.2.0
*/
private function mergePowers(array &$powers, array &$old)
{
foreach ($old as $guid => $values)
{
if (!isset($powers[$guid]))
{
$powers[$guid] = $values;
}
}
}
/**
* Sort Powers
*
* @return void
* @since 3.2.0
*/
private function sortPowers(array &$powers)
{
ksort($powers, SORT_STRING);
}
/**
* Set the Powers code
*