wip
This commit is contained in:
parent
394a74ee1b
commit
1ee55af5a0
|
|
@ -43,10 +43,11 @@ class Manager
|
|||
foreach ($existed as $dirname => $package) {
|
||||
$pluginPath = $this->getPluginsDir() . DIRECTORY_SEPARATOR . $dirname;
|
||||
$plugin = new Plugin($pluginPath, $package);
|
||||
$status = $plugin->getStatus();
|
||||
$plugin->setDirname($dirname);
|
||||
$plugin->setName(Arr::get($package, 'name'));
|
||||
$plugin->setInstalled(true);
|
||||
$plugin->setEnabled(false);
|
||||
$plugin->setEnabled($status);
|
||||
$plugin->setVersion(Arr::get($package, 'version'));
|
||||
$plugin->setColumns();
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,12 @@ class Plugin implements Arrayable, \ArrayAccess
|
|||
return admin_route('plugins.edit', ['code' => $this->code]);
|
||||
}
|
||||
|
||||
public function getStatus(): bool
|
||||
{
|
||||
return SettingRepo::getPluginStatus($this->code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取插件对应的设置字段, 并获取已存储在DB的字段值
|
||||
*
|
||||
|
|
|
|||
|
|
@ -39,6 +39,16 @@ class SettingRepo
|
|||
->keyBy('name');
|
||||
}
|
||||
|
||||
public static function getPluginStatus($pluginCode): bool
|
||||
{
|
||||
$status = Setting::query()
|
||||
->where('type', 'plugin')
|
||||
->where('space', $pluginCode)
|
||||
->where('name', 'status')
|
||||
->value('value');
|
||||
return (bool)$status;
|
||||
}
|
||||
|
||||
public static function update($type, $code, $fields)
|
||||
{
|
||||
Setting::query()->where('type', $type)->where('space', $code)->delete();
|
||||
|
|
|
|||
Loading…
Reference in New Issue