Fixes #222 - Plugin commands are now case insensitive

This commit is contained in:
Sam Georges 2014-05-29 17:33:02 +10:00
parent 1488b40448
commit 3c84337da7
3 changed files with 20 additions and 1 deletions

View File

@ -254,7 +254,7 @@ class PluginManager
public function findByIdentifier($identifier)
{
if (!isset($this->plugins[$identifier]))
return null;
$identifier = $this->normalizeIdentifier($identifier);
return $this->plugins[$identifier];
}
@ -328,6 +328,21 @@ class PluginManager
return $namespace;
}
/**
* Takes a human plugin code (acme.blog) and makes it authentic (Acme.Blog)
* @param string $id
* @return string
*/
public function normalizeIdentifier($identifier)
{
foreach ($this->plugins as $id => $object) {
if (strtolower($id) == strtolower($identifier))
return $id;
}
return $identifier;
}
//
// Disability
//

View File

@ -2,6 +2,7 @@
use Illuminate\Console\Command;
use System\Classes\UpdateManager;
use System\Classes\PluginManager;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
@ -36,6 +37,8 @@ class PluginRefresh extends Command
public function fire()
{
$pluginName = $this->argument('name');
$pluginName = PluginManager::instance()->normalizeIdentifier($pluginName);
$manager = UpdateManager::instance()->resetNotes();
$manager->rollbackPlugin($pluginName);

View File

@ -39,6 +39,7 @@ class PluginRemove extends Command
{
if ($this->confirm('Are you sure you want to uninstall this plugin? [yes|no]')) {
$pluginName = $this->argument('name');
$pluginName = PluginManager::instance()->normalizeIdentifier($pluginName);
/*
* Rollback plugin