summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-05-11 15:36:32 -0300
committerRenato Botelho <renato@netgate.com>2016-05-11 15:36:32 -0300
commit24d2e48271a6b48227268de9216edd66572ed77c (patch)
treee4faa2b51ad4386d6ab326feaea54ac05fc4c8ae
parent1a543cea408ef1a019691b33f5c979052d1c2420 (diff)
downloadpfsense-24d2e48271a6b48227268de9216edd66572ed77c.zip
pfsense-24d2e48271a6b48227268de9216edd66572ed77c.tar.gz
Only execute remote search operation on first call of get_pkg_info(), this should fix #6177
-rw-r--r--src/etc/inc/pkg-utils.inc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index a8f35f0..d6c2ec9 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -382,12 +382,30 @@ function get_pkg_info($pkgs = 'all', $info = 'all', $only_local = false) {
$pkgs = $g['pkg_prefix'];
}
+ if (!function_exists('is_subsystem_dirty')) {
+ require_once("util.inc");
+ }
+
+ /* Do not run remote operations if pkg has a lock */
+ if (is_subsystem_dirty('pkg')) {
+ $only_local = true;
+ $lock = false;
+ } else {
+ $lock = true;
+ }
+
$extra_param = "";
if ($only_local) {
$extra_param = "-U ";
}
+ if ($lock) {
+ mark_subsystem_dirty('pkg');
+ }
$rc = pkg_exec("search {$extra_param}--raw-format json-compact " . $pkgs, $out, $err);
+ if ($lock) {
+ clear_subsystem_dirty('pkg');
+ }
if ($rc != 0) {
update_status("\n" . gettext(
OpenPOWER on IntegriCloud