Plugin dependency definitions no longer case sensitive

Dependency checking is disabled for the front end to increase performance
This commit is contained in:
Samuel Georges 2016-12-10 10:59:45 +11:00
parent 0a2b343047
commit e8ba7fef5b
1 changed files with 13 additions and 6 deletions

View File

@ -74,7 +74,10 @@ class PluginManager
$this->metaFile = storage_path('cms/disabled.json');
$this->loadDisabled();
$this->loadPlugins();
$this->loadDependencies();
if ($this->app->runningInBackend()) {
$this->loadDependencies();
}
}
/**
@ -311,6 +314,7 @@ class PluginManager
}
$classId = $this->getIdentifier($namespace);
return $this->plugins[$classId];
}
@ -336,6 +340,7 @@ class PluginManager
public function hasPlugin($namespace)
{
$classId = $this->getIdentifier($namespace);
return isset($this->plugins[$classId]);
}
@ -390,7 +395,7 @@ class PluginManager
}
/**
* Returns a plugin identifier from a Plugin class name or object
* Resolves a plugin identifier from a plugin class name or object.
* @param mixed Plugin class name or object
* @return string Identifier in format of Vendor.Plugin
*/
@ -488,9 +493,11 @@ class PluginManager
public function isDisabled($id)
{
$code = $this->getIdentifier($id);
if (array_key_exists($code, $this->disabledPlugins)) {
return true;
}
return false;
}
@ -499,8 +506,7 @@ class PluginManager
*/
protected function writeDisabled()
{
$path = $this->metaFile;
File::put($path, json_encode($this->disabledPlugins));
File::put($this->metaFile, json_encode($this->disabledPlugins));
}
/**
@ -595,11 +601,12 @@ class PluginManager
}
$disable = false;
foreach ($required as $require) {
if (!$this->hasPlugin($require)) {
if (!$pluginObj = $this->findByIdentifier($require)) {
$disable = true;
}
elseif (($pluginObj = $this->findByIdentifier($require)) && $pluginObj->disabled) {
elseif ($pluginObj->disabled) {
$disable = true;
}
}