From fed5158ec50788026500a3e280b52e01e6cec883 Mon Sep 17 00:00:00 2001 From: wn_ Date: Mon, 8 Mar 2021 15:38:52 +0000 Subject: Default to null 'rv' for plugin update check. Previously 'rv' was returned as an empty JS array, causing 'p.rv.git_status != 0' to evaluate to true and a misleading 'Ready to update' appearing for certain plugins. --- classes/pref/prefs.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'classes') diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 77b57b4d8..16c41df9d 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -1057,7 +1057,7 @@ class Pref_Prefs extends Handler_Protected { private static function _plugin_needs_update($root_dir, $plugin_name) { $plugin_dir = "$root_dir/plugins.local/" . basename($plugin_name); - $rv = []; + $rv = null; if (is_dir($plugin_dir) && is_dir("$plugin_dir/.git")) { $pipes = []; @@ -1071,9 +1071,11 @@ class Pref_Prefs extends Handler_Protected { $proc = proc_open("git fetch -q origin -a && git log HEAD..origin/master --oneline", $descriptorspec, $pipes, $plugin_dir); if (is_resource($proc)) { - $rv["stdout"] = stream_get_contents($pipes[1]); - $rv["stderr"] = stream_get_contents($pipes[2]); - $rv["git_status"] = proc_close($proc); + $rv = [ + "stdout" => stream_get_contents($pipes[1]), + "stderr" => stream_get_contents($pipes[2]), + "git_status" => proc_close($proc), + ]; $rv["need_update"] = !empty($rv["stdout"]); } } -- cgit v1.2.3