allow to improve disabled modules too
This commit is contained in:
parent
199c7ca664
commit
771d71231f
1 changed files with 17 additions and 2 deletions
19
index.php
19
index.php
|
@ -134,7 +134,7 @@ class index
|
|||
}
|
||||
|
||||
$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) {
|
||||
if (!$m['root_writable'] || !$allow_distrib && in_array($id, $official[$this->type])) {
|
||||
continue;
|
||||
|
@ -146,6 +146,21 @@ class index
|
|||
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
|
||||
{
|
||||
$log_id = '';
|
||||
|
@ -161,7 +176,7 @@ class index
|
|||
$time = $this->improve->fixModule(
|
||||
$this->type,
|
||||
$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']
|
||||
);
|
||||
$log_id = $this->improve->writeLogs();
|
||||
|
|
Loading…
Reference in a new issue