1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 06:35:55 +00:00

speed up plugin updating a bit, fix some phpstan warnings

This commit is contained in:
Andrew Dolgov
2021-02-28 21:50:05 +03:00
parent bf02afed45
commit b05d4e3d9f
4 changed files with 18 additions and 7 deletions

View File

@@ -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");