[22630] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
| 5 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
| 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
| 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 22 | */ |
---|
| 23 | class SC_Plugin_Installer { |
---|
| 24 | |
---|
| 25 | protected $arrPlugin; |
---|
| 26 | |
---|
| 27 | protected $arrInstallData; |
---|
| 28 | |
---|
| 29 | function __construct($arrPlugin) { |
---|
| 30 | $this->arrPlugin = $arrPlugin; |
---|
| 31 | } |
---|
| 32 | |
---|
[22633] | 33 | /** |
---|
| 34 | * |
---|
| 35 | */ |
---|
[22630] | 36 | function execInstall() { |
---|
| 37 | |
---|
| 38 | GC_Utils_Ex::gfPrintLog("start install"); |
---|
| 39 | |
---|
| 40 | $objQuery =& SC_Query::getSingletonInstance(); |
---|
| 41 | $objQuery->begin(); |
---|
| 42 | |
---|
| 43 | // テーブル作成SQLなどを実行 |
---|
| 44 | $arrSql = $this->arrInstallData["plugin_code"]['sql']; |
---|
| 45 | |
---|
| 46 | foreach ($arrSql as $sql) { |
---|
| 47 | GC_Utils_Ex::gfPrintLog("start install"); |
---|
| 48 | $objQuery->query($sql['sql'], $sql['params']); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | // プラグインのファイルコピー |
---|
| 52 | $arrCopyFiles = $this->arrInstallData["plugin_code"]['copy_file']; |
---|
| 53 | |
---|
| 54 | foreach ($arrCopyFiles as $file) { |
---|
| 55 | // ファイルコピー |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | $objQuery->commit(); |
---|
| 59 | GC_Utils_Ex::gfPrintLog("end install"); |
---|
| 60 | } |
---|
| 61 | |
---|
[22633] | 62 | |
---|
| 63 | function copyFile($src, $dist) { |
---|
[22630] | 64 | |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | function removeFile($dist) { |
---|
| 68 | |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | function sql($sql, array $params) { |
---|
| 72 | $plugin_code = $this->arrPlugin['plugin_code']; |
---|
| 73 | $this->arrInstallData[$plugin_code]['sql'] = array( |
---|
| 74 | 'sql' => $sql, |
---|
| 75 | 'params' => $params |
---|
| 76 | ); |
---|
| 77 | } |
---|
| 78 | } |
---|