public function enable(\Eccube\Entity\Plugin $plugin, $enable = true)
{
$em = $this->app['orm.em'];
try {
$this->app->removePluginConfigCache();
Cache::clear($this->app, false);
$pluginDir = $this->calcPluginDir($plugin->getCode());
$em->getConnection()->beginTransaction();
$plugin->setEnable($enable ? Constant::ENABLED : Constant::DISABLED);
$em->persist($plugin);
$this->callPluginManagerMethod(Yaml::parse(file_get_contents($pluginDir . '/' . self::CONFIG_YML)), $enable ? 'enable' : 'disable');
$em->flush();
$em->getConnection()->commit();
$this->app->writePluginConfigCache();
} catch (\Exception $e) {
$em->getConnection()->rollback();
throw $e;
}
return true;
}