mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 15:29:57 +01:00
Better error checking in bin/plugin for existence and enabled
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
* Improved `File::save()` to use a temporary file if file isn't locked
|
||||
* Improved `|t` filter to better support admin `|tu` style filter if in admin
|
||||
* Update all classes to rely on `PageInterface` instead of `Page` class
|
||||
* Better error checking in `bin/plugin` for existence and enabled
|
||||
1. [](#bugfix)
|
||||
* Grav 1.6: Fixed `FlexUser` loosing ACL information
|
||||
* Grav 1.6: Fixed `FlexUser::find()` breaking when nothing is found
|
||||
|
||||
15
bin/plugin
15
bin/plugin
@@ -58,7 +58,6 @@ $grav['users'];
|
||||
$grav['plugins']->init();
|
||||
$grav['themes']->init();
|
||||
|
||||
|
||||
$app = new Application('Grav Plugins Commands', GRAV_VERSION);
|
||||
$pattern = '([A-Z]\w+Command\.php)';
|
||||
|
||||
@@ -73,12 +72,26 @@ $argv = array_merge([$bin], $argv);
|
||||
|
||||
$input = new ArgvInput($argv);
|
||||
|
||||
/** @var \Grav\Common\Data\Data $plugin */
|
||||
$plugin = $grav['plugins']->get($name);
|
||||
|
||||
$output = new ConsoleOutput();
|
||||
$output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, array('bold')));
|
||||
$output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, array('bold')));
|
||||
|
||||
if (is_null($plugin)) {
|
||||
$output->writeln('');
|
||||
$output->writeln("<red>$name plugin not found</red>");
|
||||
die;
|
||||
}
|
||||
|
||||
if (!$plugin->enabled) {
|
||||
$output->writeln('');
|
||||
$output->writeln("<red>$name not enabled</red>");
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
if (!$name) {
|
||||
$output->writeln('');
|
||||
$output->writeln('<red>Usage:</red>');
|
||||
|
||||
Reference in New Issue
Block a user