diff options
author | Colin Smith <colin@pfsense.org> | 2005-03-13 23:32:26 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-03-13 23:32:26 +0000 |
commit | 5a0c39fe60c6ed4b4a2027165f106a7689a214dc (patch) | |
tree | af3c5028d579252c7c9f894450b90b226d884848 | |
parent | f01a0942fc6dad8e05885fccf95e4ac1dfd079c6 (diff) | |
download | pfsense-5a0c39fe60c6ed4b4a2027165f106a7689a214dc.zip pfsense-5a0c39fe60c6ed4b4a2027165f106a7689a214dc.tar.gz |
Update get_pkg_depends() to use pkgid code.
-rw-r--r-- | etc/inc/pfsense-utils.inc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 3d10a0b..18ab517 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -670,18 +670,18 @@ function reverse_strrchr($haystack, $needle) { */ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $return_nosync = 1) { global $config; - foreach($config['installedpackages']['package'] as $package) { - if ($package['name'] == $pkg_name) { - $package_xml = $package; - if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { // If the package's config file doesn't exist, log an error and fetch it. - log_error("Fetching missing configuration XML for " . $pkg_name); - mwexec("/usr/bin/fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationf -ile']); - } - break; - } + if(!is_numeric($pkg_name)) { + $pkg_name = get_pkg_id($pkg_name); + if($pkg_id == -1) return -1; // This package doesn't really exist - exit the function. + } else { + if(!isset($config['installedpackages'][$pkg_id])) return; // No package belongs to the pkg_id passed to this function. } - $pkg_xml = parse_xml_config_pkg("/usr/local/pkg/" . $package_xml['configurationfile'], "packagegui"); + $package = $config['installedpackages'][$pkg_id]; + if(!file_exists("/usr/local/pkg/" . $package['configurationfile'])) { // If the package's config file doesn't exist, log an error and fetch it. + log_error("Fetching missing configuration XML for " . $package['name']); + mwexec("/usr/bin/fetch -o /usr/local/pkg/" . $package['configurationfile'] . " http://www.pfsense.com/packages/config/" . $package['configurationfile']); + } + $pkg_xml = parse_xml_config_pkg("/usr/local/pkg/" . $package['configurationfile'], "packagegui"); if($pkg_xml['additional_files_needed'] != "") { foreach($pkg_xml['additional_files_needed'] as $item) { if (($return_nosync == 0) && (isset($item['nosync']))) continue; // Do not return depends with nosync set if not required. |