Clear routes from cache when a plugin becomes initialized or non-initialized for the first time

Fixes #143
This commit is contained in:
Fedor A. Fetisov 2016-12-29 02:56:33 +03:00
parent 15dbe153f5
commit 7f6b193656

View File

@ -208,7 +208,10 @@ class PluginManager implements
if (!$plugin_info->isInitialized()) {
$plugin_info->getState()->initialized = true;
$plugin_info->getState()->save();
# TODO: clear cache
// Plugins can have own routing files and when the plugin becomes
// initialized after non-initialized state its routes should be
// reset. So the cache is cleared to make sure the routes set is up to date.
$this->getCache()->getItem('routing/resources')->clear();
}
} else {
// The plugin cannot be loaded. Just skip it.
@ -219,7 +222,10 @@ class PluginManager implements
if ($plugin_info->isInitialized()) {
$plugin_info->getState()->initialized = false;
$plugin_info->getState()->save();
# TODO: clear cache
// Plugins can have own routing files and when the plugin becomes
// non-initialized after initialized state its routes should be
// removed. So the cache is cleared to make sure the routes set is up to date.
$this->getCache()->getItem('routing/resources')->clear();
}
}
}