ignore unpublished plugins - part 2

This commit is contained in:
Andy Miller
2025-10-19 11:04:18 -06:00
parent cd5f3842ed
commit 269bf78084

View File

@@ -445,6 +445,14 @@ class SafeUpgradeService
continue;
}
if ($type === 'plugins' && !$this->isPluginEnabled($slug)) {
continue;
}
if ($type === 'themes' && !$this->isThemeEnabled($slug)) {
continue;
}
$pending[$slug] = [
'type' => $type,
'current' => $package->version ?? null,
@@ -567,6 +575,37 @@ class SafeUpgradeService
return true;
}
protected function isThemeEnabled(string $slug): bool
{
if ($this->config) {
try {
$active = $this->config->get('system.pages.theme');
if ($active !== null) {
return $active === $slug;
}
} catch (Throwable $e) {
// ignore
}
}
$configPath = $this->rootPath . '/user/config/system.yaml';
if (is_file($configPath)) {
try {
$data = Yaml::parseFile($configPath);
if (is_array($data)) {
$active = $data['pages']['theme'] ?? ($data['system']['pages']['theme'] ?? null);
if ($active !== null) {
return $active === $slug;
}
}
} catch (Throwable $e) {
// ignore parse errors and assume current theme
}
}
return true;
}
/**
* Detect usage of deprecated Monolog `add*` methods removed in newer releases.
*