-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5233 from nanasess/feature/traverse-maintenance
管理者はメンテナンスモードを回避可能に変更
- Loading branch information
Showing
18 changed files
with
340 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of EC-CUBE | ||
* | ||
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
* | ||
* http://www.ec-cube.co.jp/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Page\Admin; | ||
|
||
class MaintenanceManagePage extends AbstractAdminPageStyleGuide | ||
{ | ||
public static $完了メッセージ = '#page_admin_content_maintenance > div.c-container > div.c-contentsArea > div.alert.alert-success.alert-dismissible.fade.show.m-3 > span'; | ||
|
||
/** | ||
* MaintenanceManagePage constructor. | ||
*/ | ||
public function __construct(\AcceptanceTester $I) | ||
{ | ||
parent::__construct($I); | ||
} | ||
|
||
public static function go($I) | ||
{ | ||
$page = new self($I); | ||
|
||
return $page->goPage('/content/maintenance', 'メンテナンス管理コンテンツ管理'); | ||
} | ||
|
||
public function メンテナンス有効無効() | ||
{ | ||
$this->tester->click('#page_admin_content_maintenance > div.c-container > div.c-contentsArea > form > div > div > div > div > div.card-body > div:nth-child(2) > div > button'); | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of EC-CUBE | ||
* | ||
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
* | ||
* http://www.ec-cube.co.jp/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Eccube\EventListener; | ||
|
||
use Eccube\Entity; | ||
use Eccube\Request\Context; | ||
use Eccube\Service\SystemService; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Symfony\Component\HttpFoundation\Cookie; | ||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent; | ||
use Symfony\Component\HttpKernel\KernelEvents; | ||
|
||
class MaintenanceListener implements EventSubscriberInterface | ||
{ | ||
|
||
/** @var Context */ | ||
protected $requestContext; | ||
|
||
/** @var SystemService */ | ||
protected $systemService; | ||
|
||
public function __construct(Context $requestContext, SystemService $systemService) | ||
{ | ||
$this->requestContext = $requestContext; | ||
$this->systemService = $systemService; | ||
} | ||
|
||
public static function getSubscribedEvents() | ||
{ | ||
return [ | ||
KernelEvents::RESPONSE => ['onResponse'], | ||
]; | ||
} | ||
|
||
public function onResponse(FilterResponseEvent $event) | ||
{ | ||
$response = $event->getResponse(); | ||
|
||
if (!$this->systemService->isMaintenanceMode()) { | ||
$response->headers->clearCookie(SystemService::MAINTENANCE_TOKEN_KEY); | ||
return; | ||
} | ||
|
||
$user = $this->requestContext->getCurrentUser(); | ||
if ($user instanceof Entity\Member && $this->requestContext->isAdmin()) { | ||
$cookie = new Cookie( | ||
SystemService::MAINTENANCE_TOKEN_KEY, | ||
$this->systemService->getMaintenanceToken() | ||
); | ||
$response->headers->setCookie($cookie); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.