1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
6
|
|
|
* |
7
|
|
|
* http://www.lockon.co.jp/ |
8
|
|
|
* |
9
|
|
|
* This program is free software; you can redistribute it and/or |
10
|
|
|
* modify it under the terms of the GNU General Public License |
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
12
|
|
|
* of the License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU General Public License |
20
|
|
|
* along with this program; if not, write to the Free Software |
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22
|
|
|
*/ |
23
|
|
|
namespace Eccube\Controller\Install; |
24
|
|
|
use Doctrine\DBAL\Migrations\Configuration\Configuration; |
25
|
|
|
use Doctrine\DBAL\Migrations\Migration; |
26
|
|
|
use Doctrine\DBAL\Migrations\MigrationException; |
27
|
|
|
use Doctrine\ORM\EntityManager; |
28
|
|
|
use Doctrine\ORM\Tools\SchemaTool; |
29
|
|
|
use Eccube\Common\Constant; |
30
|
|
|
use Eccube\Form\Type\Install\Step1Type; |
31
|
|
|
use Eccube\Form\Type\Install\Step3Type; |
32
|
|
|
use Eccube\Form\Type\Install\Step4Type; |
33
|
|
|
use Eccube\Form\Type\Install\Step5Type; |
34
|
|
|
use Eccube\InstallApplication; |
35
|
|
|
use Eccube\Plugin\ConfigManager as PluginConfigManager; |
36
|
|
|
use Eccube\Util\Str; |
37
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
38
|
|
|
use Symfony\Component\Finder\Finder; |
39
|
|
|
use Symfony\Component\Form\Form; |
40
|
|
|
use Symfony\Component\HttpFoundation\Request; |
41
|
|
|
|
42
|
|
|
class InstallController |
|
|
|
|
43
|
|
|
{ |
44
|
|
|
const MCRYPT = 'mcrypt'; |
45
|
|
|
private $app; |
46
|
|
|
private $PDO; |
47
|
|
|
private $config_path; |
48
|
|
|
private $dist_path; |
49
|
|
|
private $cache_path; |
50
|
|
|
private $session_data; |
51
|
|
|
private $required_modules = array('pdo', 'phar', 'mbstring', 'zlib', 'ctype', 'session', 'JSON', 'xml', 'libxml', 'OpenSSL', 'zip', 'cURL', 'fileinfo'); |
52
|
|
|
private $recommended_module = array('hash', self::MCRYPT); |
53
|
|
|
const SESSION_KEY = 'eccube.session.install'; |
54
|
7 |
|
public function __construct() |
|
|
|
|
55
|
|
|
{ |
56
|
7 |
|
$this->config_path = __DIR__ . '/../../../../app/config/eccube'; |
|
|
|
|
57
|
7 |
|
$this->dist_path = __DIR__ . '/../../Resource/config'; |
|
|
|
|
58
|
7 |
|
$this->cache_path = __DIR__ . '/../../../../app/cache'; |
|
|
|
|
59
|
|
|
} |
60
|
4 |
|
private function isValid(Request $request, Form $form) |
61
|
|
|
{ |
62
|
4 |
|
$session = $request->getSession(); |
63
|
4 |
|
if ('POST' === $request->getMethod()) { |
64
|
|
|
$form->handleRequest($request); |
65
|
|
|
if ($form->isValid()) { |
66
|
|
|
$sessionData = $session->get(self::SESSION_KEY) ?: array(); |
67
|
|
|
$formData = array_replace_recursive($sessionData, $form->getData()); |
68
|
|
|
$session->set(self::SESSION_KEY, $formData); |
69
|
|
|
return true; |
|
|
|
|
70
|
|
|
} |
71
|
|
|
} |
72
|
4 |
|
return false; |
|
|
|
|
73
|
|
|
} |
74
|
5 |
|
private function getSessionData(Request $request) |
75
|
|
|
{ |
76
|
5 |
|
return $this->session_data = $request->getSession()->get(self::SESSION_KEY); |
77
|
|
|
} |
78
|
|
|
// 最初からやり直す場合、SESSION情報をクリア |
79
|
1 |
|
public function index(InstallApplication $app, Request $request) |
|
|
|
|
80
|
|
|
{ |
81
|
1 |
|
$request->getSession()->remove(self::SESSION_KEY); |
82
|
1 |
|
return $app->redirect($app->path('install_step1')); |
|
|
|
|
83
|
|
|
} |
84
|
|
|
// ようこそ |
85
|
1 |
|
public function step1(InstallApplication $app, Request $request) |
|
|
|
|
86
|
|
|
{ |
87
|
1 |
|
$form = $app['form.factory'] |
88
|
1 |
|
->createBuilder(Step1Type::class) |
89
|
1 |
|
->getForm(); |
90
|
1 |
|
$sessionData = $this->getSessionData($request); |
91
|
1 |
|
$form->setData($sessionData); |
92
|
1 |
|
if ($this->isValid($request, $form)) { |
93
|
|
|
return $app->redirect($app->path('install_step2')); |
94
|
|
|
} |
95
|
1 |
|
$this->checkModules($app); |
96
|
1 |
|
return $app['twig']->render('step1.twig', array( |
|
|
|
|
97
|
1 |
|
'form' => $form->createView(), |
98
|
1 |
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
99
|
|
|
)); |
100
|
|
|
} |
101
|
|
|
// 権限チェック |
102
|
1 |
|
public function step2(InstallApplication $app, Request $request) |
|
|
|
|
103
|
|
|
{ |
104
|
1 |
|
$this->getSessionData($request); |
105
|
1 |
|
$protectedDirs = $this->getProtectedDirs(); |
106
|
|
|
// 権限がある場合, キャッシュディレクトリをクリア |
107
|
1 |
|
if (empty($protectedDirs)) { |
108
|
1 |
|
$finder = Finder::create() |
109
|
1 |
|
->in($this->cache_path) |
110
|
1 |
|
->notName('.gitkeep') |
111
|
1 |
|
->files(); |
112
|
1 |
|
$fs = new Filesystem(); |
113
|
1 |
|
$fs->remove($finder); |
114
|
|
|
} |
115
|
1 |
|
return $app['twig']->render('step2.twig', array( |
|
|
|
|
116
|
1 |
|
'protectedDirs' => $protectedDirs, |
117
|
1 |
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
118
|
|
|
)); |
119
|
|
|
} |
120
|
|
|
// サイトの設定 |
121
|
1 |
|
public function step3(InstallApplication $app, Request $request) |
|
|
|
|
122
|
|
|
{ |
123
|
1 |
|
$form = $app['form.factory'] |
124
|
1 |
|
->createBuilder(Step3Type::class) |
125
|
1 |
|
->getForm(); |
126
|
1 |
|
$sessionData = $this->getSessionData($request); |
127
|
1 |
|
if (empty($sessionData['shop_name'])) { |
128
|
1 |
|
$config_file = $this->config_path . '/config.php'; |
|
|
|
|
129
|
1 |
|
$fs = new Filesystem(); |
130
|
1 |
|
if ($fs->exists($config_file)) { |
131
|
|
|
// すでに登録されていた場合、登録データを表示 |
132
|
1 |
|
$this->setPDO(); |
133
|
1 |
|
$stmt = $this->PDO->query("SELECT shop_name, email01 FROM dtb_base_info WHERE id = 1;"); |
134
|
1 |
|
foreach ($stmt as $row) { |
135
|
1 |
|
$sessionData['shop_name'] = $row['shop_name']; |
136
|
1 |
|
$sessionData['email'] = $row['email01']; |
137
|
|
|
} |
138
|
|
|
// セキュリティの設定 |
139
|
1 |
|
$config_file = $this->config_path . '/path.php'; |
|
|
|
|
140
|
1 |
|
$config = require $config_file; |
141
|
1 |
|
$sessionData['admin_dir'] = $config['admin_route']; |
142
|
1 |
|
$config_file = $this->config_path . '/config.php'; |
|
|
|
|
143
|
1 |
|
$config = require $config_file; |
144
|
1 |
|
$allowHost = $config['admin_allow_host']; |
145
|
1 |
View Code Duplication |
if (count($allowHost) > 0) { |
146
|
|
|
$sessionData['admin_allow_hosts'] = Str::convertLineFeed(implode("\n", $allowHost)); |
147
|
|
|
} |
148
|
1 |
|
$sessionData['admin_force_ssl'] = (bool) $config['force_ssl']; |
149
|
|
|
// ロードバランサー、プロキシサーバ設定 |
150
|
1 |
|
if (isset($config['trusted_proxies_connection_only'])) { |
151
|
|
|
$sessionData['trusted_proxies_connection_only'] = (bool)$config['trusted_proxies_connection_only']; |
|
|
|
|
152
|
|
|
} |
153
|
1 |
|
if (isset($config['trusted_proxies'])) { |
154
|
|
|
$trustedProxies = $config['trusted_proxies']; |
155
|
|
View Code Duplication |
if (count($trustedProxies) > 0) { |
156
|
|
|
$sessionData['trusted_proxies'] = Str::convertLineFeed(implode("\n", $trustedProxies)); |
157
|
|
|
} |
158
|
|
|
} |
159
|
|
|
// メール設定 |
160
|
1 |
|
$config_file = $this->config_path . '/mail.php'; |
|
|
|
|
161
|
1 |
|
$config = require $config_file; |
162
|
1 |
|
$mail = $config['mail']; |
163
|
1 |
|
$sessionData['mail_backend'] = $mail['transport']; |
164
|
1 |
|
$sessionData['smtp_host'] = $mail['host']; |
165
|
1 |
|
$sessionData['smtp_port'] = $mail['port']; |
166
|
1 |
|
$sessionData['smtp_username'] = $mail['username']; |
167
|
1 |
|
$sessionData['smtp_password'] = $mail['password']; |
168
|
|
|
} else { |
169
|
|
|
// 初期値にmailを設定 |
170
|
|
|
$sessionData['mail_backend'] = 'mail'; |
171
|
|
|
} |
172
|
|
|
} |
173
|
1 |
|
$form->setData($sessionData); |
174
|
1 |
|
if ($this->isValid($request, $form)) { |
175
|
|
|
$data = $form->getData(); |
|
|
|
|
176
|
|
|
return $app->redirect($app->path('install_step4')); |
|
|
|
|
177
|
|
|
} |
178
|
1 |
|
return $app['twig']->render('step3.twig', array( |
|
|
|
|
179
|
1 |
|
'form' => $form->createView(), |
180
|
1 |
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
181
|
|
|
)); |
182
|
|
|
} |
183
|
|
|
// データベースの設定 |
184
|
1 |
|
public function step4(InstallApplication $app, Request $request) |
|
|
|
|
185
|
|
|
{ |
186
|
1 |
|
$form = $app['form.factory'] |
187
|
1 |
|
->createBuilder(Step4Type::class) |
188
|
1 |
|
->getForm(); |
189
|
1 |
|
$sessionData = $this->getSessionData($request); |
190
|
1 |
|
if (empty($sessionData['database'])) { |
191
|
1 |
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
192
|
1 |
|
$fs = new Filesystem(); |
193
|
1 |
|
if ($fs->exists($config_file)) { |
194
|
|
|
// すでに登録されていた場合、登録データを表示 |
195
|
|
|
// データベース設定 |
196
|
1 |
|
$config = require $config_file; |
197
|
1 |
|
$database = $config['database']; |
198
|
1 |
|
$sessionData['database'] = $database['driver']; |
199
|
1 |
|
if ($database['driver'] != 'pdo_sqlite') { |
200
|
1 |
|
$sessionData['database_host'] = $database['host']; |
201
|
1 |
|
$sessionData['database_port'] = $database['port']; |
202
|
1 |
|
$sessionData['database_name'] = $database['dbname']; |
203
|
1 |
|
$sessionData['database_user'] = $database['user']; |
204
|
1 |
|
$sessionData['database_password'] = $database['password']; |
205
|
|
|
} |
206
|
|
|
} |
207
|
|
|
} |
208
|
1 |
|
$form->setData($sessionData); |
209
|
1 |
|
if ($this->isValid($request, $form)) { |
210
|
|
|
return $app->redirect($app->path('install_step5')); |
211
|
|
|
} |
212
|
1 |
|
return $app['twig']->render('step4.twig', array( |
|
|
|
|
213
|
1 |
|
'form' => $form->createView(), |
214
|
1 |
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
215
|
|
|
)); |
216
|
|
|
} |
217
|
|
|
// データベースの初期化 |
218
|
1 |
|
public function step5(InstallApplication $app, Request $request) |
|
|
|
|
219
|
|
|
{ |
220
|
1 |
|
set_time_limit(0); |
221
|
1 |
|
$this->app = $app; |
222
|
1 |
|
$form = $app['form.factory'] |
223
|
1 |
|
->createBuilder(Step5Type::class) |
224
|
1 |
|
->getForm(); |
225
|
1 |
|
$sessionData = $this->getSessionData($request); |
226
|
1 |
|
$form->setData($sessionData); |
227
|
1 |
|
if ($this->isValid($request, $form)) { |
228
|
|
|
$this |
229
|
|
|
->createDatabaseYamlFile($sessionData) |
230
|
|
|
->createMailYamlFile($sessionData) |
231
|
|
|
->createPathYamlFile($sessionData, $request); |
232
|
|
|
if (!$form['no_update']->getData()) { |
233
|
|
|
set_time_limit(0); |
234
|
|
|
$this->createConfigYamlFile($sessionData); |
235
|
|
|
$this |
236
|
|
|
->setPDO() |
237
|
|
|
->dropTables() |
238
|
|
|
->createTables() |
239
|
|
|
->importCsv() |
240
|
|
|
->doMigrate() |
241
|
|
|
->insert(); |
242
|
|
|
} else { |
243
|
|
|
// データベースを初期化しない場合、auth_magicは初期化しない |
244
|
|
|
$this->createConfigYamlFile($sessionData, false); |
245
|
|
|
$this |
246
|
|
|
->setPDO() |
247
|
|
|
->update(); |
248
|
|
|
} |
249
|
|
|
if (isset($sessionData['agree']) && $sessionData['agree'] == '1') { |
250
|
|
|
$host = $request->getSchemeAndHttpHost(); |
251
|
|
|
$basePath = $request->getBasePath(); |
252
|
|
|
$params = array( |
253
|
|
|
'http_url' => $host . $basePath, |
|
|
|
|
254
|
|
|
'shop_name' => $sessionData['shop_name'], |
255
|
|
|
); |
256
|
|
|
$this->sendAppData($params); |
257
|
|
|
} |
258
|
|
|
$this->addInstallStatus(); |
259
|
|
|
$request->getSession()->remove(self::SESSION_KEY); |
260
|
|
|
return $app->redirect($app->path('install_complete')); |
|
|
|
|
261
|
|
|
} |
262
|
1 |
|
return $app['twig']->render('step5.twig', array( |
|
|
|
|
263
|
1 |
|
'form' => $form->createView(), |
264
|
1 |
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
265
|
|
|
)); |
266
|
|
|
} |
267
|
|
|
// インストール完了 |
268
|
1 |
|
public function complete(InstallApplication $app, Request $request) |
|
|
|
|
269
|
|
|
{ |
270
|
1 |
|
$config_yml = $this->config_path . '/config.php'; |
|
|
|
|
271
|
1 |
|
$config = require $config_yml; |
272
|
1 |
|
$config_path = $this->config_path . '/path.php'; |
|
|
|
|
273
|
1 |
|
$path_yml = require $config_path; |
274
|
1 |
|
$config = array_replace_recursive($path_yml, $config); |
275
|
1 |
|
if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) { |
276
|
|
|
Request::setTrustedProxies(array_merge(array($request->server->get('REMOTE_ADDR')), $config['trusted_proxies'])); |
277
|
1 |
View Code Duplication |
} elseif (isset($config['trusted_proxies']) && !empty($config['trusted_proxies'])) { |
278
|
|
|
Request::setTrustedProxies($config['trusted_proxies']); |
279
|
|
|
} |
280
|
1 |
|
$host = $request->getSchemeAndHttpHost(); |
281
|
1 |
|
$basePath = $request->getBasePath(); |
282
|
1 |
|
$adminUrl = $host . $basePath . '/' . $config['admin_dir']; |
|
|
|
|
283
|
1 |
|
return $app['twig']->render('complete.twig', array( |
|
|
|
|
284
|
1 |
|
'admin_url' => $adminUrl, |
285
|
1 |
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
286
|
|
|
)); |
287
|
|
|
} |
288
|
|
|
private function resetNatTimer() |
289
|
|
|
{ |
290
|
|
|
// NATの無通信タイマ対策(仮) |
291
|
|
|
echo str_repeat(' ', 4 * 1024); |
292
|
|
|
ob_flush(); |
293
|
|
|
flush(); |
294
|
|
|
} |
295
|
1 |
|
private function checkModules($app) |
|
|
|
|
296
|
|
|
{ |
297
|
1 |
|
foreach ($this->required_modules as $module) { |
298
|
1 |
|
if (!extension_loaded($module)) { |
299
|
1 |
|
$app->addDanger('[必須] ' . $module . ' 拡張モジュールが有効になっていません。', 'install'); |
|
|
|
|
300
|
|
|
} |
301
|
|
|
} |
302
|
1 |
|
if (!extension_loaded('pdo_mysql') && !extension_loaded('pdo_pgsql')) { |
303
|
|
|
$app->addDanger('[必須] ' . 'pdo_pgsql又はpdo_mysql 拡張モジュールを有効にしてください。', 'install'); |
|
|
|
|
304
|
|
|
} |
305
|
1 |
|
foreach ($this->recommended_module as $module) { |
306
|
1 |
|
if (!extension_loaded($module)) { |
307
|
|
|
if ($module == self::MCRYPT && PHP_VERSION_ID >= 70100) { |
308
|
|
|
//The mcrypt extension has been deprecated in PHP 7.1.x |
309
|
|
|
//http://php.net/manual/en/migration71.deprecated.php |
310
|
|
|
continue; |
311
|
|
|
} |
312
|
1 |
|
$app->addInfo('[推奨] '.$module.' 拡張モジュールが有効になっていません。', 'install'); |
313
|
|
|
} |
314
|
|
|
} |
315
|
1 |
|
if ('\\' === DIRECTORY_SEPARATOR) { // for Windows |
316
|
|
|
if (!extension_loaded('wincache')) { |
317
|
|
|
$app->addInfo('[推奨] WinCache 拡張モジュールが有効になっていません。', 'install'); |
318
|
|
|
} |
319
|
|
|
} else { |
320
|
1 |
|
if (!extension_loaded('apc')) { |
321
|
1 |
|
$app->addInfo('[推奨] APC 拡張モジュールが有効になっていません。', 'install'); |
322
|
|
|
} |
323
|
|
|
} |
324
|
1 |
|
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos('Apache', $_SERVER['SERVER_SOFTWARE']) !== false) { |
325
|
|
|
if (!function_exists('apache_get_modules')) { |
326
|
|
|
$app->addWarning('mod_rewrite が有効になっているか不明です。', 'install'); |
327
|
|
|
} elseif (!in_array('mod_rewrite', apache_get_modules())) { |
328
|
|
|
$app->addDanger('[必須] ' . 'mod_rewriteを有効にしてください。', 'install'); |
|
|
|
|
329
|
|
|
} |
330
|
1 |
|
} elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos('Microsoft-IIS', $_SERVER['SERVER_SOFTWARE']) !== false) { |
|
|
|
|
331
|
|
|
// iis |
332
|
1 |
|
} elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos('nginx', $_SERVER['SERVER_SOFTWARE']) !== false) { |
|
|
|
|
333
|
|
|
// nginx |
334
|
|
|
} |
335
|
|
|
} |
336
|
1 |
|
private function setPDO() |
337
|
|
|
{ |
338
|
1 |
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
339
|
1 |
|
$config = require $config_file; |
340
|
|
|
try { |
341
|
1 |
|
$this->PDO = \Doctrine\DBAL\DriverManager::getConnection($config['database'], new \Doctrine\DBAL\Configuration()); |
342
|
1 |
|
$this->PDO->connect(); |
343
|
|
|
} catch (\Exception $e) { |
344
|
|
|
$this->PDO->close(); |
345
|
|
|
throw $e; |
346
|
|
|
} |
347
|
1 |
|
return $this; |
|
|
|
|
348
|
|
|
} |
349
|
|
View Code Duplication |
private function dropTables() |
|
|
|
|
350
|
|
|
{ |
351
|
|
|
$this->resetNatTimer(); |
352
|
|
|
$em = $this->getEntityManager(); |
353
|
|
|
$metadatas = $em->getMetadataFactory()->getAllMetadata(); |
354
|
|
|
$schemaTool = new SchemaTool($em); |
355
|
|
|
$schemaTool->dropSchema($metadatas); |
356
|
|
|
$em->getConnection()->executeQuery('DROP TABLE IF EXISTS doctrine_migration_versions'); |
357
|
|
|
return $this; |
|
|
|
|
358
|
|
|
} |
359
|
|
|
/** |
360
|
|
|
* @return EntityManager |
361
|
|
|
*/ |
362
|
|
|
private function getEntityManager() |
363
|
|
|
{ |
364
|
|
|
if (!isset($this->app['orm.em'])) { |
365
|
|
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
366
|
|
|
$database = require $config_file; |
367
|
|
|
$this->app->register(new \Silex\Provider\DoctrineServiceProvider(), array( |
|
|
|
|
368
|
|
|
'db.options' => $database['database'] |
369
|
|
|
)); |
370
|
|
|
$ormMappings = array( |
|
|
|
|
371
|
|
|
array( |
372
|
|
|
'type' => 'annotation', |
373
|
|
|
'namespace' => 'Eccube\Entity', |
374
|
|
|
'path' => array( |
375
|
|
|
__DIR__ . '/../../Entity', |
|
|
|
|
376
|
|
|
), |
377
|
|
|
'use_simple_annotation_reader' => false, |
378
|
|
|
), |
379
|
|
|
array( // TODO 暫定 |
380
|
|
|
'type' => 'annotation', |
381
|
|
|
'namespace' => 'Acme\Entity', |
382
|
|
|
'path' => array( |
383
|
|
|
__DIR__.'/../../../../app/Acme/Entity', |
384
|
|
|
), |
385
|
|
|
'use_simple_annotation_reader' => false, |
386
|
|
|
) |
387
|
|
|
); |
388
|
|
|
// XXX 同梱したプラグインがエラーになるため暫定 |
389
|
|
|
$pluginConfigs = PluginConfigManager::getPluginConfigAll(); |
390
|
|
|
foreach ($pluginConfigs as $code) { |
391
|
|
|
$config = $code['config']; |
392
|
|
|
// Doctrine Extend |
393
|
|
|
if (isset($config['orm.path']) && is_array($config['orm.path'])) { |
394
|
|
|
$paths = array(); |
395
|
|
View Code Duplication |
foreach ($config['orm.path'] as $path) { |
396
|
|
|
$paths[] = __DIR__.'/../../../../app/Plugin/'.$config['code'].$path; |
397
|
|
|
} |
398
|
|
|
$ormMappings[] = array( |
399
|
|
|
'type' => 'annotation', |
400
|
|
|
'namespace' => 'Plugin\\'.$config['code'].'\\Entity', |
401
|
|
|
'path' => $paths, |
402
|
|
|
'use_simple_annotation_reader' => false, |
403
|
|
|
); |
404
|
|
|
} |
405
|
|
|
} |
406
|
|
|
$this->app->register(new \Dflydev\Provider\DoctrineOrm\DoctrineOrmServiceProvider(), array( |
|
|
|
|
407
|
|
|
'orm.proxies_dir' => __DIR__ . '/../../app/cache/doctrine', |
|
|
|
|
408
|
|
|
'orm.em.options' => array( |
|
|
|
|
409
|
|
|
'mappings' => $ormMappings |
410
|
|
|
) |
411
|
|
|
)); |
412
|
|
|
} |
413
|
|
|
return $em = $this->app['orm.em']; |
|
|
|
|
414
|
|
|
} |
415
|
|
View Code Duplication |
private function createTables() |
|
|
|
|
416
|
|
|
{ |
417
|
|
|
$this->resetNatTimer(); |
418
|
|
|
$em = $this->getEntityManager(); |
419
|
|
|
$metadatas = $em->getMetadataFactory()->getAllMetadata(); |
420
|
|
|
$schemaTool = new SchemaTool($em); |
421
|
|
|
$schemaTool->createSchema($metadatas); |
422
|
|
|
return $this; |
|
|
|
|
423
|
|
|
} |
424
|
|
|
private function importCsv() { |
425
|
|
|
$em = $this->getEntityManager(); |
426
|
|
|
$loader = new \Eccube\Doctrine\Common\CsvDataFixtures\Loader(); |
427
|
|
|
$loader->loadFromDirectory(__DIR__.'/../../Resource/doctrine/import_csv'); |
428
|
|
|
$Executor = new \Eccube\Doctrine\Common\CsvDataFixtures\Executor\DbalExecutor($em); |
429
|
|
|
$fixtures = $loader->getFixtures(); |
430
|
|
|
$Executor->execute($fixtures); |
431
|
|
|
return $this; |
|
|
|
|
432
|
|
|
} |
433
|
|
|
private function insert() |
434
|
|
|
{ |
435
|
|
|
$this->resetNatTimer(); |
436
|
|
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
437
|
|
|
$database = require $config_file; |
438
|
|
|
$config['database'] = $database['database']; |
|
|
|
|
439
|
|
|
$config_file = $this->config_path . '/config.php'; |
|
|
|
|
440
|
|
|
$baseConfig = require $config_file; |
441
|
|
|
$config['config'] = $baseConfig; |
442
|
|
|
$this->PDO->beginTransaction(); |
443
|
|
|
try { |
444
|
|
|
$config = array( |
445
|
|
|
'auth_type' => '', |
446
|
|
|
'auth_magic' => $config['config']['auth_magic'], |
447
|
|
|
'password_hash_algos' => 'sha256', |
448
|
|
|
); |
449
|
|
|
$passwordEncoder = new \Eccube\Security\Core\Encoder\PasswordEncoder($config); |
450
|
|
|
$salt = \Eccube\Util\Str::random(32); |
451
|
|
|
$encodedPassword = $passwordEncoder->encodePassword($this->session_data['login_pass'], $salt); |
452
|
|
|
$sth = $this->PDO->prepare("INSERT INTO dtb_base_info ( |
453
|
|
|
id, |
454
|
|
|
shop_name, |
455
|
|
|
email01, |
456
|
|
|
email02, |
457
|
|
|
email03, |
458
|
|
|
email04, |
459
|
|
|
update_date, |
460
|
|
|
option_product_tax_rule, |
461
|
|
|
discriminator_type |
462
|
|
|
) VALUES ( |
463
|
|
|
1, |
464
|
|
|
:shop_name, |
465
|
|
|
:admin_mail, |
466
|
|
|
:admin_mail, |
467
|
|
|
:admin_mail, |
468
|
|
|
:admin_mail, |
469
|
|
|
current_timestamp, |
470
|
|
|
0, |
471
|
|
|
'baseinfo');"); |
472
|
|
|
$sth->execute(array( |
|
|
|
|
473
|
|
|
':shop_name' => $this->session_data['shop_name'], |
474
|
|
|
':admin_mail' => $this->session_data['email'] |
475
|
|
|
)); |
476
|
|
|
$sth = $this->PDO->prepare("INSERT INTO dtb_member (member_id, login_id, password, salt, work, del_flg, authority, creator_id, rank, update_date, create_date,name,department, discriminator_type) VALUES (2, :login_id, :admin_pass , :salt , '1', '0', '0', '1', '1', current_timestamp, current_timestamp,'管理者','EC-CUBE SHOP', 'member');"); |
477
|
|
|
$sth->execute(array(':login_id' => $this->session_data['login_id'], ':admin_pass' => $encodedPassword, ':salt' => $salt)); |
478
|
|
|
$this->PDO->commit(); |
479
|
|
|
} catch (\Exception $e) { |
480
|
|
|
$this->PDO->rollback(); |
481
|
|
|
throw $e; |
482
|
|
|
} |
483
|
|
|
return $this; |
|
|
|
|
484
|
|
|
} |
485
|
|
|
private function update() |
486
|
|
|
{ |
487
|
|
|
$this->resetNatTimer(); |
488
|
|
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
489
|
|
|
$database = require $config_file; |
490
|
|
|
$config['database'] = $database['database']; |
|
|
|
|
491
|
|
|
$config_file = $this->config_path . '/config.php'; |
|
|
|
|
492
|
|
|
$baseConfig = require $config_file; |
493
|
|
|
$config['config'] = $baseConfig; |
494
|
|
|
$this->PDO->beginTransaction(); |
495
|
|
|
try { |
496
|
|
|
$config = array( |
497
|
|
|
'auth_type' => '', |
498
|
|
|
'auth_magic' => $config['config']['auth_magic'], |
499
|
|
|
'password_hash_algos' => 'sha256', |
500
|
|
|
); |
501
|
|
|
$passwordEncoder = new \Eccube\Security\Core\Encoder\PasswordEncoder($config); |
502
|
|
|
$salt = \Eccube\Util\Str::random(32); |
503
|
|
|
$stmt = $this->PDO->prepare("SELECT member_id FROM dtb_member WHERE login_id = :login_id;"); |
504
|
|
|
$stmt->execute(array(':login_id' => $this->session_data['login_id'])); |
505
|
|
|
$rs = $stmt->fetch(); |
506
|
|
|
$encodedPassword = $passwordEncoder->encodePassword($this->session_data['login_pass'], $salt); |
507
|
|
|
if ($rs) { |
508
|
|
|
// 同一の管理者IDであればパスワードのみ更新 |
509
|
|
|
$sth = $this->PDO->prepare("UPDATE dtb_member set password = :admin_pass, salt = :salt, update_date = current_timestamp WHERE login_id = :login_id;"); |
510
|
|
|
$sth->execute(array(':admin_pass' => $encodedPassword, ':salt' => $salt, ':login_id' => $this->session_data['login_id'])); |
511
|
|
|
} else { |
512
|
|
|
// 新しい管理者IDが入力されたらinsert |
513
|
|
|
$sth = $this->PDO->prepare("INSERT INTO dtb_member (login_id, password, salt, work, del_flg, authority, creator_id, rank, update_date, create_date,name,department,discriminator_type) VALUES (:login_id, :admin_pass , :salt , '1', '0', '0', '1', '1', current_timestamp, current_timestamp,'管理者','EC-CUBE SHOP', 'member');"); |
514
|
|
|
$sth->execute(array(':login_id' => $this->session_data['login_id'], ':admin_pass' => $encodedPassword, ':salt' => $salt)); |
515
|
|
|
} |
516
|
|
|
$sth = $this->PDO->prepare('UPDATE dtb_base_info set |
517
|
|
|
shop_name = :shop_name, |
518
|
|
|
email01 = :admin_mail, |
519
|
|
|
email02 = :admin_mail, |
520
|
|
|
email03 = :admin_mail, |
521
|
|
|
email04 = :admin_mail, |
522
|
|
|
update_date = current_timestamp |
523
|
|
|
WHERE id = 1;'); |
524
|
|
|
$sth->execute(array( |
|
|
|
|
525
|
|
|
':shop_name' => $this->session_data['shop_name'], |
526
|
|
|
':admin_mail' => $this->session_data['email'] |
527
|
|
|
)); |
528
|
|
|
$this->PDO->commit(); |
529
|
|
|
} catch (\Exception $e) { |
530
|
|
|
$this->PDO->rollback(); |
531
|
|
|
throw $e; |
532
|
|
|
} |
533
|
|
|
return $this; |
|
|
|
|
534
|
|
|
} |
535
|
|
|
private function getMigration() |
536
|
|
|
{ |
537
|
|
|
$app = \Eccube\Application::getInstance(); |
538
|
|
|
$app->initialize(); |
539
|
|
|
$app->boot(); |
540
|
|
|
$config = new Configuration($app['db']); |
541
|
|
|
$config->setMigrationsNamespace('DoctrineMigrations'); |
542
|
|
|
$migrationDir = __DIR__ . '/../../Resource/doctrine/migration'; |
|
|
|
|
543
|
|
|
$config->setMigrationsDirectory($migrationDir); |
544
|
|
|
$config->registerMigrationsFromDirectory($migrationDir); |
545
|
|
|
$migration = new Migration($config); |
546
|
|
|
$migration->setNoMigrationException(true); |
547
|
|
|
return $migration; |
|
|
|
|
548
|
|
|
} |
549
|
|
|
private function doMigrate() |
550
|
|
|
{ |
551
|
|
|
try { |
552
|
|
|
$migration = $this->getMigration(); |
553
|
|
|
// DBとのコネクションを維持するためpingさせる |
554
|
|
|
if (is_null($this->PDO)) { |
555
|
|
|
$this->setPDO(); |
556
|
|
|
} |
557
|
|
|
$this->PDO->ping(); |
558
|
|
|
// nullを渡すと最新バージョンまでマイグレートする |
559
|
|
|
$migration->migrate(null, false); |
560
|
|
|
} catch (MigrationException $e) { |
|
|
|
|
561
|
|
|
|
562
|
|
|
} |
563
|
|
|
return $this; |
|
|
|
|
564
|
|
|
} |
565
|
1 |
|
private function getProtectedDirs() |
566
|
|
|
{ |
567
|
1 |
|
$protectedDirs = array(); |
568
|
1 |
|
$base = __DIR__ . '/../../../..'; |
|
|
|
|
569
|
|
|
$dirs = array( |
570
|
1 |
|
'/html', |
571
|
|
|
'/app', |
572
|
|
|
'/app/template', |
573
|
|
|
'/app/cache', |
574
|
|
|
'/app/config', |
575
|
|
|
'/app/config/eccube', |
576
|
|
|
'/app/log', |
577
|
|
|
'/app/Plugin', |
578
|
|
|
); |
579
|
1 |
|
foreach ($dirs as $dir) { |
580
|
1 |
|
if (!is_writable($base . $dir)) { |
|
|
|
|
581
|
1 |
|
$protectedDirs[] = $dir; |
582
|
|
|
} |
583
|
|
|
} |
584
|
1 |
|
return $protectedDirs; |
|
|
|
|
585
|
|
|
} |
586
|
|
|
private function createConfigYamlFile($data, $auth = true) |
587
|
|
|
{ |
588
|
|
|
$fs = new Filesystem(); |
589
|
|
|
$config_file = $this->config_path . '/config.php'; |
|
|
|
|
590
|
|
|
if ($fs->exists($config_file)) { |
591
|
|
|
$config = require $config_file; |
592
|
|
|
$fs->remove($config_file); |
593
|
|
|
} |
594
|
|
|
if ($auth) { |
595
|
|
|
$auth_magic = Str::random(32); |
596
|
|
|
} else { |
597
|
|
|
if (isset($config['auth_magic'])) { |
598
|
|
|
$auth_magic = $config['auth_magic']; |
599
|
|
|
} else { |
600
|
|
|
$auth_magic = Str::random(32); |
601
|
|
|
} |
602
|
|
|
} |
603
|
|
|
$allowHost = Str::convertLineFeed($data['admin_allow_hosts']); |
604
|
|
|
if (empty($allowHost)) { |
605
|
|
|
$adminAllowHosts = array(); |
606
|
|
|
} else { |
607
|
|
|
$adminAllowHosts = explode("\n", $allowHost); |
608
|
|
|
} |
609
|
|
|
$trustedProxies = Str::convertLineFeed($data['trusted_proxies']); |
610
|
|
|
if (empty($trustedProxies)) { |
611
|
|
|
$adminTrustedProxies = array(); |
612
|
|
|
} else { |
613
|
|
|
$adminTrustedProxies = explode("\n", $trustedProxies); |
614
|
|
|
// ループバックアドレスを含める |
615
|
|
|
$adminTrustedProxies = array_merge($adminTrustedProxies, array('127.0.0.1/8', '::1')); |
616
|
|
|
} |
617
|
|
|
if ($data['trusted_proxies_connection_only']) { |
618
|
|
|
// ループバックアドレスを含める |
619
|
|
|
$adminTrustedProxies = array('127.0.0.1/8', '::1'); |
620
|
|
|
} |
621
|
|
|
|
622
|
|
|
$config = require $this->dist_path . '/config.php'; |
|
|
|
|
623
|
|
|
$config['eccube_install'] = 0; |
624
|
|
|
$config['auth_magic'] = $auth_magic; |
625
|
|
|
$config['shop_name'] = $data['shop_name']; |
626
|
|
|
$config['force_ssl'] = $data['admin_force_ssl']; |
627
|
|
|
$config['admin_allow_host'] = $adminAllowHosts; |
628
|
|
|
$config['trusted_proxies_connection_only'] = $data['trusted_proxies_connection_only']; |
629
|
|
|
$config['trusted_proxies'] = $adminTrustedProxies; |
630
|
|
|
|
631
|
|
|
$this->createPhp($config_file, $config); |
632
|
|
|
|
633
|
|
|
return $this; |
634
|
|
|
} |
635
|
|
|
|
636
|
|
View Code Duplication |
private function createPhp($path, $config) |
|
|
|
|
637
|
|
|
{ |
638
|
|
|
$content = var_export($config, true); |
639
|
|
|
$content = '<?php return '.$content.';'.PHP_EOL; |
640
|
|
|
$fs = new Filesystem(); |
641
|
|
|
$fs->dumpFile($path, $content); |
642
|
|
|
} |
643
|
|
|
|
644
|
|
|
private function addInstallStatus() |
645
|
|
|
{ |
646
|
|
|
$config_file = $this->config_path . '/config.php'; |
|
|
|
|
647
|
|
|
$config = require $config_file; |
648
|
|
|
$config['eccube_install'] = 1; |
649
|
|
|
|
650
|
|
|
$this->createPhp($config_file, $config); |
651
|
|
|
|
652
|
|
|
return $this; |
653
|
|
|
} |
654
|
|
|
private function createDatabaseYamlFile($data) |
655
|
|
|
{ |
656
|
|
|
$fs = new Filesystem(); |
657
|
|
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
658
|
|
|
if ($fs->exists($config_file)) { |
659
|
|
|
$fs->remove($config_file); |
660
|
|
|
} |
661
|
|
|
if ($data['database'] != 'pdo_sqlite') { |
662
|
|
|
switch ($data['database']) |
663
|
|
|
{ |
664
|
|
|
case 'pdo_pgsql': |
665
|
|
|
if (empty($data['db_port'])) { |
666
|
|
|
$data['db_port'] = '5432'; |
667
|
|
|
} |
668
|
|
|
$data['db_driver'] = 'pdo_pgsql'; |
669
|
|
|
break; |
670
|
|
|
case 'pdo_mysql': |
671
|
|
|
if (empty($data['db_port'])) { |
672
|
|
|
$data['db_port'] = '3306'; |
673
|
|
|
} |
674
|
|
|
$data['db_driver'] = 'pdo_mysql'; |
675
|
|
|
break; |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
$config = $this->dist_path . '/database.php'; |
|
|
|
|
679
|
|
|
$config['database']['driver'] = $data['db_driver']; |
680
|
|
|
$config['database']['host'] = $data['database_host']; |
681
|
|
|
$config['database']['dbname'] = $data['database_name']; |
682
|
|
|
$config['database']['port'] = $data['database_port']; |
683
|
|
|
$config['database']['user'] = $data['database_user']; |
684
|
|
|
$config['database']['password'] = $data['database_password']; |
685
|
|
|
|
|
|
|
|
686
|
|
|
} else { |
687
|
|
|
$config = $this->dist_path . '/database_sqlite3.php'; |
|
|
|
|
688
|
|
|
$config['database']['driver'] = 'pdo_sqlite'; |
689
|
|
|
$config['database']['path'] = realpath($this->config_path . '/eccube.db'); |
|
|
|
|
690
|
|
|
} |
691
|
|
|
|
692
|
|
|
$this->createPhp($config_file, $config); |
693
|
|
|
|
694
|
|
|
return $this; |
695
|
|
|
} |
696
|
|
|
private function createMailYamlFile($data) |
697
|
|
|
{ |
698
|
|
|
$fs = new Filesystem(); |
699
|
|
|
$config_file = $this->config_path . '/mail.php'; |
|
|
|
|
700
|
|
|
if ($fs->exists($config_file)) { |
701
|
|
|
$fs->remove($config_file); |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
$config = $this->dist_path.'/mail.php'; |
705
|
|
|
$config['mail']['transport'] = $data['mail_backend']; |
706
|
|
|
$config['mail']['host'] = $data['smtp_host']; |
707
|
|
|
$config['mail']['port'] = $data['smtp_port']; |
708
|
|
|
$config['mail']['username'] = $data['smtp_username']; |
709
|
|
|
$config['mail']['password'] = $data['smtp_password']; |
710
|
|
|
|
711
|
|
|
$this->createPhp($config_file, $config); |
712
|
|
|
|
713
|
|
|
return $this; |
714
|
|
|
} |
715
|
|
|
private function createPathYamlFile($data, Request $request) |
716
|
|
|
{ |
717
|
|
|
$fs = new Filesystem(); |
718
|
|
|
$config_file = $this->config_path . '/path.php'; |
|
|
|
|
719
|
|
|
if ($fs->exists($config_file)) { |
720
|
|
|
$fs->remove($config_file); |
721
|
|
|
} |
722
|
|
|
$ADMIN_ROUTE = $data['admin_dir']; |
723
|
|
|
$TEMPLATE_CODE = 'default'; |
724
|
|
|
$USER_DATA_ROUTE = 'user_data'; |
725
|
|
|
$ROOT_DIR = '%ROOT_DIR%'; |
726
|
|
|
$ROOT_URLPATH = $request->getBasePath(); |
727
|
|
|
$ROOT_PUBLIC_URLPATH = $ROOT_URLPATH . RELATIVE_PUBLIC_DIR_PATH; |
|
|
|
|
728
|
|
|
$target = array('${ADMIN_ROUTE}', '${TEMPLATE_CODE}', '${USER_DATA_ROUTE}', '${ROOT_DIR}', '${ROOT_URLPATH}', '${ROOT_PUBLIC_URLPATH}'); |
729
|
|
|
$replace = array($ADMIN_ROUTE, $TEMPLATE_CODE, $USER_DATA_ROUTE, $ROOT_DIR, $ROOT_URLPATH, $ROOT_PUBLIC_URLPATH); |
730
|
|
|
|
731
|
|
|
$config = require $this->dist_path . '/path.php'; |
|
|
|
|
732
|
|
|
|
733
|
|
|
$this->createPhp($config_file, $config); |
734
|
|
|
|
735
|
|
|
return $this; |
736
|
|
|
} |
737
|
|
|
private function sendAppData($params) |
738
|
|
|
{ |
739
|
|
|
$config_file = $this->config_path . '/database.php'; |
|
|
|
|
740
|
|
|
$db_config = require $config_file; |
741
|
|
|
$this->setPDO(); |
742
|
|
|
$stmt = $this->PDO->query('select version() as v'); |
743
|
|
|
$version = ''; |
744
|
|
|
foreach ($stmt as $row) { |
745
|
|
|
$version = $row['v']; |
746
|
|
|
} |
747
|
|
|
if ($db_config['database']['driver'] === 'pdo_mysql') { |
748
|
|
|
$db_ver = 'MySQL:' . $version; |
|
|
|
|
749
|
|
|
} else { |
750
|
|
|
$db_ver = $version; |
751
|
|
|
} |
752
|
|
|
$data = http_build_query( |
753
|
|
|
array( |
754
|
|
|
'site_url' => $params['http_url'], |
755
|
|
|
'shop_name' => $params['shop_name'], |
756
|
|
|
'cube_ver' => Constant::VERSION, |
757
|
|
|
'php_ver' => phpversion(), |
758
|
|
|
'db_ver' => $db_ver, |
759
|
|
|
'os_type' => php_uname(), |
760
|
|
|
) |
761
|
|
|
); |
762
|
|
|
$header = array( |
763
|
|
|
'Content-Type: application/x-www-form-urlencoded', |
764
|
|
|
'Content-Length: ' . strlen($data), |
|
|
|
|
765
|
|
|
); |
766
|
|
|
$context = stream_context_create( |
767
|
|
|
array( |
|
|
|
|
768
|
|
|
'http' => array( |
769
|
|
|
'method' => 'POST', |
770
|
|
|
'header' => $header, |
771
|
|
|
'content' => $data, |
772
|
|
|
) |
773
|
|
|
) |
774
|
|
|
); |
775
|
|
|
file_get_contents('http://www.ec-cube.net/mall/use_site.php', false, $context); |
776
|
|
|
return $this; |
|
|
|
|
777
|
|
|
} |
778
|
|
|
/** |
779
|
|
|
* マイグレーション画面を表示する. |
780
|
|
|
* |
781
|
|
|
* @param InstallApplication $app |
782
|
|
|
* @param Request $request |
|
|
|
|
783
|
|
|
* |
784
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
785
|
|
|
*/ |
786
|
|
|
public function migration(InstallApplication $app, Request $request) |
|
|
|
|
787
|
|
|
{ |
788
|
|
|
return $app['twig']->render('migration.twig', array( |
789
|
|
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
790
|
|
|
)); |
791
|
|
|
} |
792
|
|
|
/** |
793
|
|
|
* インストール済プラグインの一覧を表示する. |
794
|
|
|
* プラグインがインストールされていない場合は, マイグレーション実行画面へリダイレクトする. |
795
|
|
|
* |
796
|
|
|
* @param InstallApplication $app |
797
|
|
|
* @param Request $request |
|
|
|
|
798
|
|
|
* |
799
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
800
|
|
|
*/ |
801
|
|
|
public function migration_plugin(InstallApplication $app, Request $request) |
|
|
|
|
802
|
|
|
{ |
803
|
|
|
$eccube = \Eccube\Application::getInstance(); |
804
|
|
|
$eccube->initialize(); |
805
|
|
|
$eccube->boot(); |
806
|
|
|
$pluginRepository = $eccube['orm.em']->getRepository('Eccube\Entity\Plugin'); |
807
|
|
|
$Plugins = $pluginRepository->findBy(array('del_flg' => Constant::DISABLED)); |
808
|
|
|
if (empty($Plugins)) { |
809
|
|
|
// インストール済プラグインがない場合はマイグレーション実行画面へリダイレクト. |
810
|
|
|
return $app->redirect($app->path('migration_end')); |
811
|
|
|
} else { |
812
|
|
|
return $app['twig']->render('migration_plugin.twig', array( |
813
|
|
|
'Plugins' => $Plugins, |
814
|
|
|
'version' => Constant::VERSION, |
815
|
|
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
816
|
|
|
)); |
817
|
|
|
} |
818
|
|
|
} |
819
|
|
|
/** |
820
|
|
|
* マイグレーションを実行し, 完了画面を表示させる |
821
|
|
|
* |
822
|
|
|
* @param InstallApplication $app |
823
|
|
|
* @param Request $request |
|
|
|
|
824
|
|
|
* |
825
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
826
|
|
|
*/ |
827
|
|
|
public function migration_end(InstallApplication $app, Request $request) |
|
|
|
|
828
|
|
|
{ |
829
|
|
|
$this->doMigrate(); |
830
|
|
|
$config_app = new \Eccube\Application(); // install用のappだとconfigが取れないので |
831
|
|
|
$config_app->initialize(); |
832
|
|
|
$config_app->boot(); |
833
|
|
|
\Eccube\Util\Cache::clear($config_app, true); |
834
|
|
|
return $app['twig']->render('migration_end.twig', array( |
|
|
|
|
835
|
|
|
'publicPath' => '..' . RELATIVE_PUBLIC_DIR_PATH . '/', |
|
|
|
|
836
|
|
|
)); |
837
|
|
|
} |
838
|
|
|
} |