diff --git a/src/Eccube/Controller/Admin/Content/MaintenanceController.php b/src/Eccube/Controller/Admin/Content/MaintenanceController.php index 392f6ce4103..3c28fb11b3b 100644 --- a/src/Eccube/Controller/Admin/Content/MaintenanceController.php +++ b/src/Eccube/Controller/Admin/Content/MaintenanceController.php @@ -36,7 +36,7 @@ public function __construct(SystemService $systemService) { * メンテナンス管理ページを表示 * * @Route("/%eccube_admin_route%/content/maintenance", name="admin_content_maintenance") - * @Template("@admin/Content/maintenance.twig")* + * @Template("@admin/Content/maintenance.twig") */ public function index(Request $request) { @@ -53,6 +53,8 @@ public function index(Request $request) $isMaintenace = $this->systemService->isMaintenanceMode(); $this->addSuccess(($isMaintenace) ? 'admin.content.maintenance_switch__on_message' : 'admin.content.maintenance_switch__off_message', 'admin'); + + $this->redirectToRoute('admin_content_maintenance'); } return [ diff --git a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php index f5284192b89..7d5788b530e 100644 --- a/src/Eccube/Controller/Admin/Store/OwnerStoreController.php +++ b/src/Eccube/Controller/Admin/Store/OwnerStoreController.php @@ -31,6 +31,8 @@ use Knp\Component\Pager\Paginator; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; @@ -260,8 +262,16 @@ public function doConfirm(Request $request, $id) * * @return \Symfony\Component\HttpFoundation\JsonResponse */ - public function apiInstall(Request $request) + public function apiInstall(Request $request, EventDispatcherInterface $dispatcher) { + // .maintenanceファイルを設置 + $this->systemService->switchMaintenance(true); + + // TERMINATE時のイベントを設定 + $dispatcher->addListener(KernelEvents::TERMINATE, function () { + // .maintenanceファイルを削除 + $this->systemService->switchMaintenance(); + }); $this->isTokenValid(); $this->cacheUtil->clearCache(); @@ -290,8 +300,17 @@ public function apiInstall(Request $request) * * @return \Symfony\Component\HttpFoundation\JsonResponse */ - public function apiUninstall(Plugin $Plugin) + public function apiUninstall(Plugin $Plugin, EventDispatcherInterface $dispatcher) { + // .maintenanceファイルを設置 + $this->systemService->switchMaintenance(true); + + // TERMINATE時のイベントを設定 + $dispatcher->addListener(KernelEvents::TERMINATE, function () { + // .maintenanceファイルを削除 + $this->systemService->switchMaintenance(); + }); + $this->isTokenValid(); $this->cacheUtil->clearCache(); @@ -337,8 +356,17 @@ public function apiUninstall(Plugin $Plugin) * * @return \Symfony\Component\HttpFoundation\JsonResponse */ - public function apiUpgrade(Request $request) + public function apiUpgrade(Request $request, EventDispatcherInterface $dispatcher) { + // .maintenanceファイルを設置 + $this->systemService->switchMaintenance(true); + + // TERMINATE時のイベントを設定 + $dispatcher->addListener(KernelEvents::TERMINATE, function () { + // .maintenanceファイルを削除 + $this->systemService->switchMaintenance(); + }); + $this->isTokenValid(); $this->cacheUtil->clearCache(); diff --git a/src/Eccube/Controller/Admin/Store/PluginController.php b/src/Eccube/Controller/Admin/Store/PluginController.php index ae0147fe9d3..752cc24c558 100644 --- a/src/Eccube/Controller/Admin/Store/PluginController.php +++ b/src/Eccube/Controller/Admin/Store/PluginController.php @@ -436,17 +436,8 @@ public function disable(Request $request, Plugin $Plugin, CacheUtil $cacheUtil, * * @throws \Exception */ - public function uninstall(Plugin $Plugin, CacheUtil $cacheUtil, EventDispatcherInterface $dispatcher) + public function uninstall(Plugin $Plugin, CacheUtil $cacheUtil) { - die(); - // .maintenanceファイルを設置 - $this->systemService->switchMaintenance(true); - - // TERMINATE時のイベントを設定 - $dispatcher->addListener(KernelEvents::TERMINATE, function () { - // .maintenanceファイルを削除 - $this->systemService->switchMaintenance(); - }); $this->isTokenValid(); diff --git a/src/Eccube/Resource/locale/messages.ja.yaml b/src/Eccube/Resource/locale/messages.ja.yaml index 87f523e2948..9f355c4d235 100644 --- a/src/Eccube/Resource/locale/messages.ja.yaml +++ b/src/Eccube/Resource/locale/messages.ja.yaml @@ -1013,8 +1013,8 @@ admin.content.maintenance__card_title: メンテナンスモード admin.content.maintenance_message: | メンテナンスモードを有効にすると、SHOPの機能を一時的に停止し、管理画面のみアクセス可能な状態となります。 ※プラグインのインストール/有効/無効/削除時には、自動的にメンテナンスモードに切り替わります。 -admin.content.maintenance_switch__on: 有効 -admin.content.maintenance_switch__off: 無効 +admin.content.maintenance_switch__on: 有効にする +admin.content.maintenance_switch__off: 無効にする admin.content.maintenance_switch__on_message: メンテナンスモードを有効にしました。 admin.content.maintenance_switch__off_message: メンテナンスモードを無効にしました。 diff --git a/src/Eccube/Resource/template/admin/Content/maintenance.twig b/src/Eccube/Resource/template/admin/Content/maintenance.twig index bfc3e1251ce..199ac38456b 100644 --- a/src/Eccube/Resource/template/admin/Content/maintenance.twig +++ b/src/Eccube/Resource/template/admin/Content/maintenance.twig @@ -16,14 +16,6 @@ file that was distributed with this source code. {% block title %}{{ 'admin.content.maintenance_management'|trans }}{% endblock %} {% block sub_title %}{{ 'admin.content.contents_management'|trans }}{% endblock %} -{% block stylesheet %} - -{% endblock %} - {% block main %}