Skip to content

Commit

Permalink
Merge pull request #5107 from chihiro-adachi/beta3
Browse files Browse the repository at this point in the history
4.1-beta3: 4.1ブランチの変更点を4.1-beta3ブランチへ反映
  • Loading branch information
okazy authored Aug 16, 2021
2 parents eae94bc + 16005a3 commit cf1cb51
Show file tree
Hide file tree
Showing 46 changed files with 254 additions and 1,322 deletions.
2 changes: 2 additions & 0 deletions codeception/_support/Page/Admin/CategoryManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ public function 一覧_上に($rowNum)
{
$this->tester->dragAndDropBy("body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child($rowNum)", 0, -75);
$this->tester->wait(1);

return $this;
}

public function 一覧_下に($rowNum)
{
$this->tester->dragAndDropBy("body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child($rowNum)", 0, 75);
$this->tester->wait(1);

return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions codeception/acceptance/EA07BasicinfoCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function basicinfo_支払方法入れ替え(AcceptanceTester $I)

public function basicinfo_支払方法登録(AcceptanceTester $I)
{
$I->getScenario()->skip('EA0705-UC01-T01 支払方法 登録');
$I->getScenario()->incomplete('EA0705-UC01-T01 支払方法 登録');
$I->wantTo('EA0705-UC01-T01 支払方法 登録');

// 表示
Expand All @@ -105,7 +105,7 @@ public function basicinfo_支払方法登録(AcceptanceTester $I)

public function basicinfo_支払方法編集(AcceptanceTester $I)
{
$I->getScenario()->skip('EA0705-UC01-T01 支払方法 登録');
$I->getScenario()->incomplete('EA0705-UC01-T01 支払方法 登録');
$I->wantTo('EA0705-UC02-T01 支払方法 編集');

// 表示
Expand Down
2 changes: 1 addition & 1 deletion codeception/acceptance/EA08SysteminfoCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function systeminfo_セキュリティ管理SSL(AcceptanceTester $I)
{
$I->wantTo('EA0804-UC01-T04 セキュリティ管理 - SSL強制');

$I->getScenario()->skip('このテストを通すと以降のテストが通らなくなってしまっているので一時的にスキップ');
$I->getScenario()->incomplete('このテストを通すと以降のテストが通らなくなってしまっているので一時的にスキップ');

$httpBaseUrl = $I->getBaseUrl();
$I->amOnUrl($httpBaseUrl);
Expand Down
1 change: 1 addition & 0 deletions codeception/acceptance/EF02ProductCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function product_商品一覧初期表示(AcceptanceTester $I)

public function product_商品一覧ヘッダ以外のカテゴリリンク(AcceptanceTester $I)
{
$I->getScenario()->incomplete('テスト項目を要確認');
$I->wantTo('EF0201-UC01-T02 商品一覧ページ ヘッダ以外のカテゴリリンク');
$I->amOnPage('/');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eccube",
"version": "4.1-beta2",
"version": "4.1-beta3",
"description": "EC-CUBE EC open platform.",
"main": "index.js",
"directories": {
Expand Down
1 change: 1 addition & 0 deletions src/Eccube/Command/ComposerRemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
try {
/* @var Command $command */
$command = $this->getApplication()->get('cache:clear');

return $command->run(new ArrayInput([
'command' => 'cache:clear',
'--no-warmup' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Common/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Constant
/**
* EC-CUBE VERSION.
*/
const VERSION = '4.1-beta2';
const VERSION = '4.1-beta3';

/**
* Enable value.
Expand Down
7 changes: 6 additions & 1 deletion src/Eccube/Controller/Admin/Content/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Eccube\Controller\Admin\Content;

use Eccube\Controller\AbstractController;
use Eccube\Service\SystemService;
use Eccube\Util\CacheUtil;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Form\Extension\Core\Type\FormType;
Expand All @@ -26,15 +27,19 @@ class CacheController extends AbstractController
* @Route("/%eccube_admin_route%/content/cache", name="admin_content_cache", methods={"GET", "POST"})
* @Template("@admin/Content/cache.twig")
*/
public function index(Request $request, CacheUtil $cacheUtil)
public function index(Request $request, CacheUtil $cacheUtil, SystemService $systemService)
{
$builder = $this->formFactory->createBuilder(FormType::class);
$form = $builder->getForm();
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$systemService->switchMaintenance(true);

$cacheUtil->clearCache();

$this->addFlash('eccube.admin.disable_maintenance', '');

$this->addSuccess('admin.common.delete_complete', 'admin');
}

Expand Down
33 changes: 33 additions & 0 deletions src/Eccube/Controller/Admin/Content/MaintenanceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Routing\Annotation\Route;

class MaintenanceController extends AbstractController
Expand Down Expand Up @@ -70,4 +71,36 @@ public function index(Request $request)
'isMaintenance' => $isMaintenance,
];
}

/**
* メンテナンス解除
*
* キャッシュ管理やプラグインのインストール等の操作時にajax経由で解除する
* 権限管理設定でアクセス不可になるのを避けるため、ルーティングは/admin/disable_maintenanceで設定しています
*
* @Route("/%eccube_admin_route%/disable_maintenance/{mode}", requirements={"mode": "manual|auto_maintenance|auto_maintenance_update"}, name="admin_disable_maintenance", methods={"POST"})
*/
public function disableMaintenance(Request $request, $mode, SystemService $systemService)
{
$this->isTokenValid();

if (!$request->isXmlHttpRequest()) {
throw new BadRequestHttpException();
}

if ($mode === 'manual') {
$path = $this->container->getParameter('eccube_content_maintenance_file_path');
if (file_exists($path)) {
unlink($this->container->getParameter('eccube_content_maintenance_file_path'));
}
} else {
$maintenanceMode = [
'auto_maintenance' => SystemService::AUTO_MAINTENANCE,
'auto_maintenance_update' => SystemService::AUTO_MAINTENANCE_UPDATE
];
$systemService->disableMaintenance($maintenanceMode[$mode]);
}

return $this->json(['success' => true]);
}
}
2 changes: 2 additions & 0 deletions src/Eccube/Controller/Admin/Product/CsvImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,7 @@ private function makeProductCategory($Product, $Category, $sortNo)

/**
* @Route("/%eccube_admin_route%/product/csv_split", name="admin_product_csv_split", methods={"POST"})
*
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
Expand Down Expand Up @@ -1647,6 +1648,7 @@ public function splitCsv(Request $request)

/**
* @Route("/%eccube_admin_route%/product/csv_split_import", name="admin_product_csv_split_import", methods={"POST"})
*
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
Expand Down
18 changes: 0 additions & 18 deletions src/Eccube/Controller/Admin/Product/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,24 +874,6 @@ public function copy(Request $request, $id = null)
return $this->redirectToRoute('admin_product');
}

/**
* @Route("/%eccube_admin_route%/product/product/{id}/display", requirements={"id" = "\d+"}, name="admin_product_product_display")
*/
public function display(Request $request, $id = null)
{
$event = new EventArgs(
[],
$request
);
$this->eventDispatcher->dispatch(EccubeEvents::ADMIN_PRODUCT_DISPLAY_COMPLETE, $event);

if (!is_null($id)) {
return $this->redirectToRoute('product_detail', ['id' => $id, 'admin' => '1']);
}

return $this->redirectToRoute('admin_product');
}

/**
* 商品CSVの出力.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,16 @@

namespace Eccube\Controller\Admin\Setting\System;

use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Eccube\Controller\AbstractController;
use Eccube\Entity\Member;
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Eccube\Form\Type\Admin\MemberType;
use Eccube\Form\Type\Admin\TwoFactorAuthType;
use Eccube\Repository\MemberRepository;
use Eccube\Service\TwoFactorAuthService;

use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class TwoFactorAuthController extends AbstractController
{
Expand Down Expand Up @@ -94,9 +85,10 @@ public function auth(Request $request)
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
if ($Member->getTwoFactorAuthKey()) {
if ($this->twoFactorAuthService->verifyCode($Member->getTwoFactorAuthKey(),$form->get('device_token')->getData())) {
if ($this->twoFactorAuthService->verifyCode($Member->getTwoFactorAuthKey(), $form->get('device_token')->getData())) {
$response = new RedirectResponse($this->generateUrl('admin_homepage'));
$response->headers->setCookie($this->twoFactorAuthService->createAuthedCookie($Member));

return $response;
} else {
$error = trans('admin.setting.system.two_factor_auth.invalid_message__reinput');
Expand Down Expand Up @@ -126,6 +118,7 @@ public function set(Request $request)
return $this->redirectToRoute('admin_homepage');
}
$res = $this->createResponse($request);

return $res;
}

Expand All @@ -143,6 +136,7 @@ public function edit(Request $request)
if (is_array($res) && isset($res['error'])) {
$this->addError($res['error']);
}

return $res;
}

Expand All @@ -161,8 +155,7 @@ private function createResponse(Request $request)
$auth_key = $this->twoFactorAuthService->createSecret();
$builder->get('auth_key')->setData($auth_key);
$form = $builder->getForm();
}
else if ('POST' === $request->getMethod()) {
} elseif ('POST' === $request->getMethod()) {
$form = $builder->getForm();
$form->handleRequest($request);
$auth_key = $form->get('auth_key')->getData();
Expand All @@ -174,9 +167,10 @@ private function createResponse(Request $request)
$this->addSuccess('admin.setting.system.two_factor_auth.complete_message', 'admin');
$response = new RedirectResponse($this->generateUrl('admin_homepage'));
$response->headers->setCookie($this->twoFactorAuthService->createAuthedCookie($Member));

return $response;
} else {
$error = trans('admin.setting.system.two_factor_auth.invalid_message__reinput' );
$error = trans('admin.setting.system.two_factor_auth.invalid_message__reinput');
}
} else {
$error = trans('admin.setting.system.two_factor_auth.invalid_message__invalid');
Expand Down
9 changes: 0 additions & 9 deletions src/Eccube/Controller/Admin/Store/OwnerStoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,6 @@ public function apiInstall(Request $request)
// .maintenanceファイルを設置
$this->systemService->switchMaintenance(true);

// TERMINATE時のイベントを設定
$this->systemService->disableMaintenance(SystemService::AUTO_MAINTENANCE);

$this->cacheUtil->clearCache();

$pluginCode = $request->get('pluginCode');
Expand Down Expand Up @@ -295,9 +292,6 @@ public function apiUninstall(Plugin $Plugin)
// .maintenanceファイルを設置
$this->systemService->switchMaintenance(true);

// TERMINATE時のイベントを設定
$this->systemService->disableMaintenance(SystemService::AUTO_MAINTENANCE);

$this->cacheUtil->clearCache();

if ($Plugin->isEnabled()) {
Expand Down Expand Up @@ -427,9 +421,6 @@ public function apiUpdate(Request $request)
{
$this->isTokenValid();

// TERMINATE時のイベントを設定
$this->systemService->disableMaintenance(SystemService::AUTO_MAINTENANCE_UPDATE);

$this->cacheUtil->clearCache();

$pluginCode = $request->get('pluginCode');
Expand Down
17 changes: 9 additions & 8 deletions src/Eccube/Controller/Admin/Store/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,8 @@ public function enable(Plugin $Plugin, CacheUtil $cacheUtil, Request $request)
if (!$request->query->has('maintenance_mode')) {
// プラグイン管理の有効ボタンを押したとき
$this->systemService->switchMaintenance(true); // auto_maintenanceと設定されたファイルを生成
// TERMINATE時のイベントを設定
$this->systemService->disableMaintenance(SystemService::AUTO_MAINTENANCE);
} else {
// プラグイン管理のアップデートを実行したとき
// TERMINATE時のイベントを設定
$this->systemService->disableMaintenance(SystemService::AUTO_MAINTENANCE_UPDATE);
}

$cacheUtil->clearCache();

$log = null;
Expand Down Expand Up @@ -318,6 +313,8 @@ public function enable(Plugin $Plugin, CacheUtil $cacheUtil, Request $request)
} else {
$this->addError($message, 'admin');

$this->addFlash('eccube.admin.disable_maintenance', '');

return $this->redirectToRoute('admin_store_plugin');
}
}
Expand All @@ -344,6 +341,8 @@ public function enable(Plugin $Plugin, CacheUtil $cacheUtil, Request $request)
} else {
$this->addSuccess(trans('admin.store.plugin.enable.complete', ['%plugin_name%' => $Plugin->getName()]), 'admin');

$this->addFlash('eccube.admin.disable_maintenance', '');

return $this->redirectToRoute('admin_store_plugin');
}
}
Expand Down Expand Up @@ -372,8 +371,6 @@ public function disable(Request $request, Plugin $Plugin, CacheUtil $cacheUtil)
} else {
// プラグイン管理で無効ボタンを押したとき
$this->systemService->switchMaintenance(true); // auto_maintenanceと設定されたファイルを生成
// TERMINATE時のイベントを設定
$this->systemService->disableMaintenance(SystemService::AUTO_MAINTENANCE);
}

$cacheUtil->clearCache();
Expand All @@ -394,6 +391,8 @@ public function disable(Request $request, Plugin $Plugin, CacheUtil $cacheUtil)
} else {
$this->addError($message, 'admin');

$this->addFlash('eccube.admin.disable_maintenance', '');

return $this->redirectToRoute('admin_store_plugin');
}
}
Expand Down Expand Up @@ -422,6 +421,8 @@ public function disable(Request $request, Plugin $Plugin, CacheUtil $cacheUtil)
} else {
$this->addSuccess(trans('admin.store.plugin.disable.complete', ['%plugin_name%' => $Plugin->getName()]), 'admin');

$this->addFlash('eccube.admin.disable_maintenance', '');

return $this->redirectToRoute('admin_store_plugin');
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/Eccube/Controller/Install/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@
use Eccube\Doctrine\DBAL\Types\UTCDateTimeType;
use Eccube\Doctrine\DBAL\Types\UTCDateTimeTzType;
use Eccube\Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Eccube\Entity\Plugin;
use Eccube\Form\Type\Install\Step1Type;
use Eccube\Form\Type\Install\Step3Type;
use Eccube\Form\Type\Install\Step4Type;
use Eccube\Form\Type\Install\Step5Type;
use Eccube\Repository\PluginRepository;
use Eccube\Security\Core\Encoder\PasswordEncoder;
use Eccube\Util\CacheUtil;
use Eccube\Util\StringUtil;
Expand Down Expand Up @@ -509,7 +507,7 @@ public function complete(Request $request)
return [
'admin_url' => $adminUrl,
'is_sqlite' => strpos($databaseUrl, 'sqlite') !== false,
'token' => $token
'token' => $token,
];
}

Expand Down
Loading

0 comments on commit cf1cb51

Please sign in to comment.