com web/bugs: $pseudo_pkgs now has an array of children as a third element.: include/functions .php

From: Date: Wed, 08 Aug 2018 23:15:56 +0000
Subject: com web/bugs: $pseudo_pkgs now has an array of children as a third element.: include/functions .php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-27227@lists.php.net to get a copy of this message
Commit: 5b2a3b2ddfc3972e1b21ca02f5d1ab7b85970eea Author: zrhoffman <zrhoffman@ku.edu> Wed, 8 Aug 2018 18:15:56 -0500 Parents: 400e87a4be176c78a735cb741e2d399f21118679 Branches: master Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=5b2a3b2ddfc3972e1b21ca02f5d1ab7b85970eea Log: $pseudo_pkgs now has an array of children as a third element. If parent = '0' in the database, $pseudo_pkgs[2] is an array. If it is nonzero (refers to a valid id of another row), $pseudo_pkgs[2] is a child and is null. We no longer need &nbsp;&nbsp;&nbsp;&nbsp; to distinguish between parents and children. Nowhere do we count the length of $pseudo_pkgs, so the extra element should not break anything.. Changed paths: M include/functions.php Diff: diff --git a/include/functions.php b/include/functions.php index 0ba7b75..35af0c6 100644 --- a/include/functions.php +++ b/include/functions.php @@ -235,7 +235,8 @@ function get_pseudo_packages($project, $return_disabled = true) foreach ($tree as $data) { if (isset($data['children'])) { - $pseudo_pkgs[$data['name']] = array($data['long_name'], $data['disabled']); + $pseudo_pkgs[$data['name']] = array($data['long_name'], $data['disabled'], array()); + $children = &$pseudo_pkgs[$data['name']][2]; $long_names = array(); foreach ($data['children'] as $k => $v) { $long_names[$k] = strtolower($v['long_name']); @@ -243,11 +244,12 @@ function get_pseudo_packages($project, $return_disabled = true) array_multisort($long_names, SORT_ASC, SORT_STRING, $data['children']); foreach ($data['children'] as $child) { - $pseudo_pkgs[$child['name']] = array("&nbsp;&nbsp;&nbsp;&nbsp;{$child['long_name']}", $child['disabled']); + $pseudo_pkgs[$child['name']] = array("{$child['long_name']}", $child['disabled'], null); + $children[] = $child['name']; } } elseif (!isset($pseudo_pkgs[$data['name']])) { - $pseudo_pkgs[$data['name']] = array($data['long_name'], $data['disabled']); + $pseudo_pkgs[$data['name']] = array($data['long_name'], $data['disabled'], null); } }

« previous php.webmaster (#27227) next »