From 48c4b88fec307c1f61ea70bedf504ba60d895901 Mon Sep 17 00:00:00 2001 From: plegall Date: Mon, 20 Mar 2017 11:58:52 +0100 Subject: [PATCH] fixes #638, improve speed on finding sub-categories --- admin/cat_list.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/admin/cat_list.php b/admin/cat_list.php index e57ff925f..9e061dd7d 100644 --- a/admin/cat_list.php +++ b/admin/cat_list.php @@ -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; } }