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