allow to improve disabled modules too

This commit is contained in:
Jean-Christian Denis 2022-12-03 21:45:56 +01:00
parent 199c7ca664
commit 771d71231f
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -134,7 +134,7 @@ class index
} }
$combo_modules = []; $combo_modules = [];
$modules = $this->type == 'plugin' ? dcCore::app()->plugins->getModules() : dcCore::app()->themes->getModules(); $modules = self::getModules($this->type == 'plugin' ? 'plugins' : 'themes');
foreach ($modules as $id => $m) { foreach ($modules as $id => $m) {
if (!$m['root_writable'] || !$allow_distrib && in_array($id, $official[$this->type])) { if (!$m['root_writable'] || !$allow_distrib && in_array($id, $official[$this->type])) {
continue; continue;
@ -146,6 +146,21 @@ class index
return array_merge([__('Select a module') => '-'], $combo_modules); return array_merge([__('Select a module') => '-'], $combo_modules);
} }
public static function getModules(string $type, ?string $id = null): ?array
{
$type = $type == 'themes' ? 'themes' : 'plugins';
$modules = array_merge(dcCore::app()->{$type}->getDisabledModules(), dcCore::app()->{$type}->getModules());
if (empty($id)) {
return $modules;
} elseif (array_key_exists($id, $modules)) {
return $modules[$id];
}
return null;
}
private function doAction(): void private function doAction(): void
{ {
$log_id = ''; $log_id = '';
@ -161,7 +176,7 @@ class index
$time = $this->improve->fixModule( $time = $this->improve->fixModule(
$this->type, $this->type,
$this->module, $this->module,
$this->type == 'plugin' ? dcCore::app()->plugins->getModules($this->module) : dcCore::app()->themes->getModules($this->module), self::getModules($this->type == 'plugin' ? 'plugins' : 'themes',$this->module),
$_POST['actions'] $_POST['actions']
); );
$log_id = $this->improve->writeLogs(); $log_id = $this->improve->writeLogs();