Eccube\Controller\Admin\Content\CacheController::index PHP Method

index() public method

public index ( Application $app, Request $request )
$app Eccube\Application
$request Symfony\Component\HttpFoundation\Request
    public function index(Application $app, Request $request)
    {
        $builder = $app['form.factory']->createBuilder('admin_cache');
        $form = $builder->getForm();
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $data = $form->get('cache')->getData();
            $cacheDir = $app['config']['root_dir'] . '/app/cache';
            $filesystem = new Filesystem();
            foreach ($data as $dir) {
                if (is_dir($cacheDir . '/' . $dir)) {
                    // 指定されたキャッシュディレクトリを削除
                    $finder = Finder::create()->in($cacheDir . '/' . $dir);
                    $filesystem->remove($finder);
                }
                if ($dir == 'doctrine') {
                    // doctrineが指定された場合は, cache driver経由で削除.
                    $config = $app['orm.em']->getConfiguration();
                    $this->deleteDoctrineCache($config->getMetadataCacheImpl());
                    $this->deleteDoctrineCache($config->getQueryCacheImpl());
                    $this->deleteDoctrineCache($config->getResultCacheImpl());
                    $this->deleteDoctrineCache($config->getHydrationCacheImpl());
                }
            }
            $app->addSuccess('admin.content.cache.save.complete', 'admin');
        }
        return $app->render('Content/cache.twig', array('form' => $form->createView()));
    }