mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
Update the parameter of PluginManager::getUnsatisfiedRequirements method
This commit is contained in:
parent
967e1642d3
commit
4da044146f
@ -47,10 +47,10 @@ class PluginController extends Controller
|
||||
|
||||
switch ($request->get('action')) {
|
||||
case 'enable':
|
||||
if (! $plugins->isRequirementsSatisfied($name)) {
|
||||
if (! $plugins->isRequirementsSatisfied($plugin)) {
|
||||
$msg = '';
|
||||
|
||||
foreach ($plugins->getUnsatisfiedRequirements($name) as $name => $detail) {
|
||||
foreach ($plugins->getUnsatisfiedRequirements($plugin) as $name => $detail) {
|
||||
if (! $detail['version']) {
|
||||
$msg .= '<li>'.trans('admin.plugins.operations.unsatisfied.disabled', [
|
||||
'name' => "<code>$name</code>"
|
||||
@ -123,9 +123,9 @@ class PluginController extends Controller
|
||||
$plugins = app('plugins');
|
||||
|
||||
return [
|
||||
'isRequirementsSatisfied' => $plugins->isRequirementsSatisfied($plugin->name),
|
||||
'isRequirementsSatisfied' => $plugins->isRequirementsSatisfied($plugin),
|
||||
'requirements' => $plugin->getRequirements(),
|
||||
'unsatisfiedRequirements' => $plugins->getUnsatisfiedRequirements($plugin->name)
|
||||
'unsatisfiedRequirements' => $plugins->getUnsatisfiedRequirements($plugin)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class PluginServiceProvider extends ServiceProvider
|
||||
protected function disableRequirementsUnsatisfiedPlugins(PluginManager $manager)
|
||||
{
|
||||
foreach ($manager->getEnabledPlugins() as $plugin) {
|
||||
if (! $manager->isRequirementsSatisfied($plugin->name)) {
|
||||
if (! $manager->isRequirementsSatisfied($plugin)) {
|
||||
$manager->disable($plugin->name);
|
||||
}
|
||||
}
|
||||
|
@ -277,12 +277,14 @@ class PluginManager
|
||||
/**
|
||||
* Get the unsatisfied requirements of plugin.
|
||||
*
|
||||
* @param string $pluginName
|
||||
* @param string|Plugin $plugin
|
||||
* @return array
|
||||
*/
|
||||
public function getUnsatisfiedRequirements($pluginName)
|
||||
public function getUnsatisfiedRequirements($plugin)
|
||||
{
|
||||
$plugin = $this->getPlugin($pluginName);
|
||||
if (! $plugin instanceof Plugin) {
|
||||
$plugin = $this->getPlugin($plugin);
|
||||
}
|
||||
|
||||
if (! $plugin) {
|
||||
throw new \InvalidArgumentException('Plugin with given name does not exist.');
|
||||
@ -332,12 +334,12 @@ class PluginManager
|
||||
/**
|
||||
* Whether the plugin's requirements are satisfied.
|
||||
*
|
||||
* @param string $pluginName
|
||||
* @param string|Plugin $plugin
|
||||
* @return bool
|
||||
*/
|
||||
public function isRequirementsSatisfied($pluginName)
|
||||
public function isRequirementsSatisfied($plugin)
|
||||
{
|
||||
return empty($this->getUnsatisfiedRequirements($pluginName));
|
||||
return empty($this->getUnsatisfiedRequirements($plugin));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user