Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1-beta3: SQLiteでプラグインの有効化ができない不具合の修正 #5108

Merged
merged 26 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ee74991
ajax経由でメンテナンス解除できるように
chihiro-adachi Jul 15, 2021
df06b5e
プラグイン管理のメンテナンス解除タイミングを調整
chihiro-adachi Jul 15, 2021
6923b04
キャッシュ管理でキャッシュ削除中はメンテナンス化するように対応
chihiro-adachi Jul 15, 2021
b87071d
キャッシュ削除中のメンテナンスモードをauto_maintenanceに変更
chihiro-adachi Jul 15, 2021
e909e84
不要なグループを削除
chihiro-adachi Jul 15, 2021
5363449
for -> if / 削除失敗時の制御を調整
chihiro-adachi Jul 21, 2021
0c9d973
失敗時のメンテナンスモード解除を削除
chihiro-adachi Jul 21, 2021
8fb10d3
Merge pull request #5092 from chihiro-adachi/fix-disable-maintenance
Jul 28, 2021
19737e3
未完成なのにもかかわらず、Skip されているテストを Incomplete に修正
nanasess Jul 30, 2021
c4d9f70
動作するため incomplete を削除
nanasess Jul 30, 2021
4226039
既に使用されていない実装のテストを削除
nanasess Jul 30, 2021
b3b46b5
利用していないルーティングの削除
kiy0taka Aug 6, 2021
e7ca9c4
Merge pull request #5100 from kiy0taka/dev/remove-unused-route
okazy Aug 11, 2021
90c0ee8
Merge remote-tracking branch 'origin/4.0' into 4.1-beta3
okazy Aug 12, 2021
bbf330f
Merge remote-tracking branch 'origin/4.1-feature' into 4.1-beta3
okazy Aug 12, 2021
bad05a6
インストーラでのプラグイン有効化時にも初期化処理を追加
okazy Aug 12, 2021
123d0d8
UnitTest の $container を static に変更
okazy Aug 12, 2021
03c7277
php-cs-fixer を実行
okazy Aug 12, 2021
1255323
バージョンを 4.1-beta3 に変更
okazy Aug 12, 2021
9a71bc4
Merge pull request #5097 from nanasess/fix-skip-testing
okazy Aug 13, 2021
2e1413a
Merge pull request #5102 from okazy/4.1-beta3-merge
chihiro-adachi Aug 13, 2021
2dfe1e1
Merge pull request #5104 from okazy/fix-plugin-install
chihiro-adachi Aug 13, 2021
3a04811
Merge pull request #5105 from okazy/4.1beta3-csfix
chihiro-adachi Aug 13, 2021
e4e7513
Merge pull request #5106 from okazy/bump-4.1-beta3
chihiro-adachi Aug 13, 2021
16005a3
Merge remote-tracking branch 'upstream/4.1' into beta3
chihiro-adachi Aug 13, 2021
7c87baf
sqliteでプラグインの有効化に失敗する不具合を修正
chihiro-adachi Aug 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Pre Install Plugins
env:
PGPASSWORD: 'password'
run: psql eccube_db -h 127.0.0.1 -U postgres -c "select * from dtb_plugin;" -A -F, --pset footer > src/Eccube/Resource/doctrine/import_csv/ja/dtb_plugin.csv
run: psql eccube_db -h 127.0.0.1 -U postgres -c "select id,name,code,0 as enabled,version,source,0 as initialized,'2021-08-13 00:00:00' as create_date,'2021-08-13 00:00:00' as update_date,discriminator_type from dtb_plugin;" -A -F, --pset footer > src/Eccube/Resource/doctrine/import_csv/ja/dtb_plugin.csv

- name: Packaging
working-directory: ../
Expand Down
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