fixes #638, improve speed on finding sub-categories

This commit is contained in:
plegall
2017-03-20 11:58:52 +01:00
parent 5a80c0a604
commit 48c4b88fec

View File

@@ -390,14 +390,11 @@ SELECT
$all_categories = query2array($query, 'id', 'uppercats');
$subcats_of = array();
foreach (array_keys($categories) as $cat_id)
foreach ($all_categories as $id => $uppercats)
{
foreach ($all_categories as $id => $uppercats)
foreach (array_slice(explode(',', $uppercats), 0, -1) as $uppercat_id)
{
if (preg_match('/(^|,)'.$cat_id.',/', $uppercats))
{
@$subcats_of[$cat_id][] = $id;
}
@$subcats_of[$uppercat_id][] = $id;
}
}