From b05d4e3d9ff2803b28dd68d807b57500f8c3078f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 28 Feb 2021 21:50:05 +0300 Subject: speed up plugin updating a bit, fix some phpstan warnings --- classes/api.php | 1 + classes/pref/prefs.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'classes') diff --git a/classes/api.php b/classes/api.php index a0ee773c1..31672575a 100755 --- a/classes/api.php +++ b/classes/api.php @@ -363,6 +363,7 @@ class API extends Handler { } $this->_wrap(self::STATUS_OK, $articles); + // @phpstan-ignore-next-line } else { $this->_wrap(self::STATUS_ERR, array("error" => self::E_INCORRECT_USAGE)); } diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 7f986858f..de03b34dc 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -1185,15 +1185,18 @@ class Pref_Prefs extends Handler_Protected { function updateLocalPlugins() { if ($_SESSION["access_level"] >= 10) { - $plugin_name = $_REQUEST["name"] ?? ""; + $plugins = explode(",", $_REQUEST["plugins"] ?? ""); # we're in classes/pref/ $root_dir = dirname(dirname(__DIR__)); $rv = []; - if (!empty($plugin_name)) { - array_push($rv, ["plugin" => $plugin_name, "rv" => $this->_update_plugin($root_dir, $plugin_name)]); + if (count($plugins) > 0) { + foreach ($plugins as $plugin_name) { + array_push($rv, ["plugin" => $plugin_name, "rv" => $this->_update_plugin($root_dir, $plugin_name)]); + } + // @phpstan-ignore-next-line } else { $plugin_dirs = array_filter(glob("$root_dir/plugins.local/*"), "is_dir"); -- cgit v1.2.3