Skip to content

Commit

Permalink
Merge pull request #1885 from chihiro-adachi/fix-trans-cache
Browse files Browse the repository at this point in the history
translatorのキャッシュを削除するように修正
  • Loading branch information
Yangsin authored Oct 27, 2016
2 parents bc1f947 + 30c84e9 commit 5dc55eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/Eccube/Controller/Admin/Store/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use Eccube\Common\Constant;
use Eccube\Controller\AbstractController;
use Eccube\Exception\PluginException;
use Eccube\Util\Cache;
use Eccube\Util\Str;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
Expand Down Expand Up @@ -200,8 +199,6 @@ public function update(Application $app, Request $request, $id)

$app->addSuccess('admin.plugin.update.complete', 'admin');

Cache::clear($app, false);

return $app->redirect($app->url('admin_store_plugin'));

} catch (PluginException $e) {
Expand Down Expand Up @@ -578,9 +575,6 @@ public function upgrade(Application $app, Request $request, $action, $id, $versi

$service->update($Plugin, $tmpDir.'/'.$tmpFile);
$app->addSuccess('admin.plugin.update.complete', 'admin');

Cache::clear($app, false);

}

$fs = new Filesystem();
Expand Down
5 changes: 5 additions & 0 deletions src/Eccube/Service/PluginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use Eccube\Common\Constant;
use Eccube\Exception\PluginException;
use Eccube\Util\Cache;
use Eccube\Util\Str;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Yaml\Yaml;
Expand All @@ -48,6 +49,7 @@ public function install($path, $source = 0)

try {
$this->app->removePluginConfigCache();
Cache::clear($this->app, false);
$tmp = $this->createTempDir();

$this->unpackPluginArchive($path, $tmp); //一旦テンポラリに展開
Expand Down Expand Up @@ -269,6 +271,7 @@ public function uninstall(\Eccube\Entity\Plugin $plugin)
{
$pluginDir = $this->calcPluginDir($plugin->getCode());
$this->app->removePluginConfigCache();
Cache::clear($this->app, false);
$this->callPluginManagerMethod(Yaml::parse(file_get_contents($pluginDir.'/'.self::CONFIG_YML)), 'disable');
$this->callPluginManagerMethod(Yaml::parse(file_get_contents($pluginDir.'/'.self::CONFIG_YML)), 'uninstall');
$this->unregisterPlugin($plugin);
Expand Down Expand Up @@ -308,6 +311,7 @@ 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);
Expand All @@ -330,6 +334,7 @@ public function update(\Eccube\Entity\Plugin $plugin, $path)
$tmp = null;
try {
$this->app->removePluginConfigCache();
Cache::clear($this->app, false);
$tmp = $this->createTempDir();

$this->unpackPluginArchive($path, $tmp); //一旦テンポラリに展開
Expand Down
4 changes: 4 additions & 0 deletions src/Eccube/Util/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public static function clear($app, $isAll, $isTwig = false)
$finder = Finder::create()->in($cacheDir.'/twig');
$filesystem->remove($finder);
}
if (is_dir($cacheDir.'/translator')) {
$finder = Finder::create()->in($cacheDir.'/translator');
$filesystem->remove($finder);
}
}

return true;
Expand Down

0 comments on commit 5dc55eb

Please sign in to comment.