Added a check for missing dependencies in two places
- System dashboard now lists missing dependencies - Installing a plugin with missing dependencies will also attempt to install those dependencies at the same time Fixes #36
This commit is contained in:
parent
c7eb965af8
commit
a40357cec9
|
|
@ -313,7 +313,8 @@ return [
|
|||
'tips' => 'System configuration tips',
|
||||
'tips_description' => 'There are issues you need to pay attention to in order to configure the system properly.',
|
||||
'permissions' => 'Directory :name or its subdirectories is not writable for PHP. Please set corresponding permissions for the webserver on this directory.',
|
||||
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.'
|
||||
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.',
|
||||
'plugin_missing' => 'The plugin :name is a dependency but is not installed. Please install this plugin.',
|
||||
],
|
||||
'editor' => [
|
||||
'menu_label' => 'Editor settings',
|
||||
|
|
|
|||
|
|
@ -565,8 +565,12 @@ class PluginManager
|
|||
//
|
||||
|
||||
/**
|
||||
* Scans the system plugins to locate any dependencies
|
||||
* that are not currently installed.
|
||||
* Scans the system plugins to locate any dependencies that are not currently
|
||||
* installed. Returns an array of plugin codes that are needed.
|
||||
*
|
||||
* PluginManager::instance()->findMissingDependencies();
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findMissingDependencies()
|
||||
{
|
||||
|
|
@ -592,6 +596,7 @@ class PluginManager
|
|||
/**
|
||||
* Cross checks all plugins and their dependancies, if not met plugins
|
||||
* are disabled and vice versa.
|
||||
* @return void
|
||||
*/
|
||||
protected function loadDependencies()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -661,6 +661,7 @@ class Updates extends Controller
|
|||
$name = $result['code'];
|
||||
$hash = $result['hash'];
|
||||
$plugins = [$name => $hash];
|
||||
$plugins = $this->appendRequiredPlugins($plugins, $result);
|
||||
|
||||
/*
|
||||
* Update steps
|
||||
|
|
@ -817,17 +818,7 @@ class Updates extends Controller
|
|||
$name = $result['code'];
|
||||
$hash = $result['hash'];
|
||||
$themes = [$name => $hash];
|
||||
$plugins = [];
|
||||
|
||||
foreach ((array) array_get($result, 'require') as $plugin) {
|
||||
if (
|
||||
($name = array_get($plugin, 'code')) &&
|
||||
($hash = array_get($plugin, 'hash')) &&
|
||||
!PluginManager::instance()->hasPlugin($name)
|
||||
) {
|
||||
$plugins[$name] = $hash;
|
||||
}
|
||||
}
|
||||
$plugins = $this->appendRequiredPlugins([], $result);
|
||||
|
||||
/*
|
||||
* Update steps
|
||||
|
|
@ -962,4 +953,25 @@ class Updates extends Controller
|
|||
{
|
||||
return str_replace(':', '.', $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds require plugin codes to the collection based on a result.
|
||||
* @param array $plugins
|
||||
* @param array $result
|
||||
* @return array
|
||||
*/
|
||||
protected function appendRequiredPlugins(array $plugins, array $result)
|
||||
{
|
||||
foreach ((array) array_get($result, 'require') as $plugin) {
|
||||
if (
|
||||
($name = array_get($plugin, 'code')) &&
|
||||
($hash = array_get($plugin, 'hash')) &&
|
||||
!PluginManager::instance()->hasPlugin($name)
|
||||
) {
|
||||
$plugins[$name] = $hash;
|
||||
}
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use Lang;
|
|||
use BackendAuth;
|
||||
use System\Models\Parameter;
|
||||
use System\Classes\UpdateManager;
|
||||
use System\Classes\PluginManager;
|
||||
use Backend\Classes\ReportWidgetBase;
|
||||
use System\Models\EventLog;
|
||||
use System\Models\RequestLog;
|
||||
|
|
@ -73,6 +74,8 @@ class Status extends ReportWidgetBase
|
|||
{
|
||||
$warnings = [];
|
||||
|
||||
$missingPlugins = PluginManager::instance()->findMissingDependencies();
|
||||
|
||||
$writablePaths = [
|
||||
temp_path(),
|
||||
themes_path(),
|
||||
|
|
@ -85,6 +88,7 @@ class Status extends ReportWidgetBase
|
|||
storage_path('cms/twig'),
|
||||
storage_path('cms/combiner'),
|
||||
];
|
||||
|
||||
$requiredExtensions = [
|
||||
'GD' => extension_loaded('gd'),
|
||||
'fileinfo' => extension_loaded('fileinfo'),
|
||||
|
|
@ -98,12 +102,17 @@ class Status extends ReportWidgetBase
|
|||
$warnings[] = Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>'.$path.'</strong>']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($requiredExtensions as $extension => $installed) {
|
||||
if (!$installed) {
|
||||
$warnings[] = Lang::get('backend::lang.warnings.extension', ['name' => '<strong>'.$extension.'</strong>']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($missingPlugins as $pluginCode) {
|
||||
$warnings[] = Lang::get('backend::lang.warnings.plugin_missing', ['name' => '<strong>'.$pluginCode.'</strong>']);
|
||||
}
|
||||
|
||||
return $warnings;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue