Skip to content

Commit

Permalink
Merge pull request #17 from chihiro-adachi/4.0.5-4.0.6
Browse files Browse the repository at this point in the history
4.0.5 - 4.0.6に対応
  • Loading branch information
okazy authored Jun 22, 2021
2 parents c0b8f32 + b10cdca commit 4686aef
Show file tree
Hide file tree
Showing 17 changed files with 3,515 additions and 3,892 deletions.
8 changes: 4 additions & 4 deletions Common/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* file that was distributed with this source code.
*/

namespace Plugin\EccubeUpdater404to405\Common;
namespace Plugin\EccubeUpdater405to406\Common;

class Constant
{
const FROM_VERSION = '4.0.4';
const TO_VERSION = '4.0.5';
const PLUGIN_CODE = 'EccubeUpdater404to405';
const FROM_VERSION = '4.0.5';
const TO_VERSION = '4.0.6';
const PLUGIN_CODE = 'EccubeUpdater405to406';
}
62 changes: 40 additions & 22 deletions Controller/Admin/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Plugin\EccubeUpdater404to405\Controller\Admin;
namespace Plugin\EccubeUpdater405to406\Controller\Admin;

use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
Expand All @@ -25,7 +25,7 @@
use Eccube\Service\Composer\ComposerApiService;
use Eccube\Service\PluginApiService;
use Eccube\Util\CacheUtil;
use Plugin\EccubeUpdater404to405\Common\Constant as UpdaterConstant;
use Plugin\EccubeUpdater405to406\Common\Constant as UpdaterConstant;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
Expand Down Expand Up @@ -111,15 +111,23 @@ public function __construct(
$this->pluginApiService = $pluginApiService;
$this->composerApiService = $composerApiService;
$this->eccubeConfig = $eccubeConfig;
$this->supported = version_compare(Constant::VERSION, UpdaterConstant::FROM_VERSION, '=');

// 4.0.5 もしくは 4.0.5-p1を対象とする
if (version_compare(Constant::VERSION, UpdaterConstant::FROM_VERSION, '=')
|| version_compare(Constant::VERSION, UpdaterConstant::FROM_VERSION.'-p1', '=')) {
$this->supported = true;
} else {
$this->supported = false;
}

$this->projectDir = realpath($eccubeConfig->get('kernel.project_dir'));
$this->dataDir = $this->projectDir.'/app/PluginData/eccube_update_plugin';
$this->updateFile = realpath(__DIR__.'/../../Resource/update_file.tar.gz');
}

/**
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/config", name="eccube_updater404to405_admin_config")
* @Template("@EccubeUpdater404to405/admin/config.twig")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/config", name="eccube_updater405to406_admin_config")
* @Template("@EccubeUpdater405to406/admin/config.twig")
*/
public function index(Request $request)
{
Expand All @@ -133,6 +141,16 @@ public function index(Request $request)
$this->supported = false;
$this->addError('xdebugが有効になっています。無効にしてください。', 'admin');
}

// 4.0.5-p1の場合は、ハッシュファイル・アップデートファイルを差し替え
if (version_compare(Constant::VERSION, UpdaterConstant::FROM_VERSION.'-p1', '=')) {
$fs = new Filesystem();
$dir = $this->eccubeConfig->get('plugin_realdir').'/'.UpdaterConstant::PLUGIN_CODE;
$fs->copy($dir.'/Resource/file_hash/405p1_file_hash.yaml', $dir.'/Resource/file_hash/file_hash.yaml', true);
$fs->copy($dir.'/Resource/file_hash/405p1_file_hash_crlf.yaml', $dir.'/Resource/file_hash/file_hash_crlf.yaml', true);
$fs->copy($dir.'/Resource/405p1_update_file.tar.gz', $dir.'/Resource/update_file.tar.gz', true);
}

return [
'supported' => $this->supported,
];
Expand All @@ -141,8 +159,8 @@ public function index(Request $request)
/**
* プラグインのEC-CUBE対応バージョンのチェックを行う.
*
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/check_plugin_version", name="eccube_updater404to405_admin_check_plugin_version")
* @Template("@EccubeUpdater404to405/admin/check_plugin_vesrion.twig")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/check_plugin_version", name="eccube_updater405to406_admin_check_plugin_version")
* @Template("@EccubeUpdater405to406/admin/check_plugin_vesrion.twig")
*/
public function checkPluginVersion(Request $request)
{
Expand Down Expand Up @@ -170,8 +188,8 @@ public function checkPluginVersion(Request $request)
/**
* ファイルの書き込み権限チェックを行う.
*
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/check_permission", name="eccube_updater404to405_admin_check_permission", methods={"POST"})
* @Template("@EccubeUpdater404to405/admin/check_permission.twig")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/check_permission", name="eccube_updater405to406_admin_check_permission", methods={"POST"})
* @Template("@EccubeUpdater405to406/admin/check_permission.twig")
*/
public function checkPermission(Request $request, Filesystem $fs)
{
Expand Down Expand Up @@ -223,8 +241,8 @@ public function checkPermission(Request $request, Filesystem $fs)
/**
* 更新ファイルの競合を確認する.
*
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/check_source", name="eccube_updater404to405_admin_check_source", methods={"POST"})
* @Template("@EccubeUpdater404to405/admin/check_source.twig")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/check_source", name="eccube_updater405to406_admin_check_source", methods={"POST"})
* @Template("@EccubeUpdater405to406/admin/check_source.twig")
*/
public function checkSource(Request $request)
{
Expand Down Expand Up @@ -280,7 +298,7 @@ public function checkSource(Request $request)
/**
* ファイルを上書きする.
*
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/update_files", name="eccube_updater404to405_admin_update_files", methods={"POST"})
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/update_files", name="eccube_updater405to406_admin_update_files", methods={"POST"})
*/
public function updateFiles(Request $request, CacheUtil $cacheUtil)
{
Expand Down Expand Up @@ -308,12 +326,12 @@ public function updateFiles(Request $request, CacheUtil $cacheUtil)

$cacheUtil->clearCache();

return $this->redirectToRoute('eccube_updater404to405_admin_dump_autoload');
return $this->redirectToRoute('eccube_updater405to406_admin_dump_autoload');
}

/**
* @see https://github.com/EC-CUBE/ec-cube/pull/4117
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/dump_autoload", name="eccube_updater404to405_admin_dump_autoload")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/dump_autoload", name="eccube_updater405to406_admin_dump_autoload")
*/
public function dumpAutoload(CacheUtil $cacheUtil)
{
Expand All @@ -331,12 +349,12 @@ public function dumpAutoload(CacheUtil $cacheUtil)

$cacheUtil->clearCache();

return $this->redirectToRoute('eccube_updater404to405_admin_gen_proxy');
return $this->redirectToRoute('eccube_updater405to406_admin_gen_proxy');
}

/**
* @see https://github.com/EC-CUBE/ec-cube/pull/4117
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/gen_proxy", name="eccube_updater404to405_admin_gen_proxy")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/gen_proxy", name="eccube_updater405to406_admin_gen_proxy")
*/
public function generateProxy(CacheUtil $cacheUtil)
{
Expand All @@ -352,7 +370,7 @@ public function generateProxy(CacheUtil $cacheUtil)

$cacheUtil->clearCache();

return $this->redirectToRoute('eccube_updater404to405_admin_update_data');
return $this->redirectToRoute('eccube_updater405to406_admin_update_data');
}

/**
Expand All @@ -365,8 +383,8 @@ public function generateProxy(CacheUtil $cacheUtil)
* - スキーマアップデート
* - マイグレーション
*
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/update_data", name="eccube_updater404to405_admin_update_data")
* @Template("@EccubeUpdater404to405/admin/update_data.twig")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/update_data", name="eccube_updater405to406_admin_update_data")
* @Template("@EccubeUpdater405to406/admin/update_data.twig")
*/
public function updateData(Request $request, CacheUtil $cacheUtil)
{
Expand Down Expand Up @@ -397,7 +415,7 @@ public function updateData(Request $request, CacheUtil $cacheUtil)

$cacheUtil->clearCache();

return $this->redirectToRoute('eccube_updater404to405_admin_complete');
return $this->redirectToRoute('eccube_updater405to406_admin_complete');
}

return [
Expand All @@ -408,8 +426,8 @@ public function updateData(Request $request, CacheUtil $cacheUtil)
/**
* 完了画面を表示.
*
* @Route("/%eccube_admin_route%/eccube_updater_404_to_405/complete", name="eccube_updater404to405_admin_complete")
* @Template("@EccubeUpdater404to405/admin/complete.twig")
* @Route("/%eccube_admin_route%/eccube_updater_405_to_406/complete", name="eccube_updater405to406_admin_complete")
* @Template("@EccubeUpdater405to406/admin/complete.twig")
*/
public function complete()
{
Expand Down
Binary file added Resource/405p1_update_file.tar.gz
Binary file not shown.
Loading

0 comments on commit 4686aef

Please sign in to comment.