mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 00:46:07 +02:00
ignore unpublished plugins - part 2
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user