source: branches/version-2_5-dev/data/class/pages/admin/plugin/LC_Page_Admin_Plugin_Install.php @ 20534

Revision 20534, 3.9 KB checked in by Seasoft, 13 years ago (diff)

#627(ソース整形・ソースコメントの改善)
#628(未使用処理・定義などの削除)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 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
24require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
25
26/**
27 * プラグインのインストールのページクラス
28 *
29 * FIXME インストール直後のレンダリング時点では、上部ナビに反映されない
30 * TODO Transaction Token を使用する
31 *
32 * @package Page
33 * @author Seasoft 塚田将久
34 * @version $Id$
35 */
36class LC_Page_Admin_Plugin_Install extends LC_Page_Admin_Ex {
37
38    /**
39     * Page を初期化する.
40     *
41     * @return void
42     */
43    function init() {
44        if (DEBUG_LOAD_PLUGIN !== true) SC_Utils_Ex::sfDispException('プラグインは有効化されていない'); // XXX 開発途上対応
45        parent::init();
46
47        $this->tpl_mainpage = 'plugin/install.tpl';
48        $this->tpl_mainno   = 'plugin';
49        $this->tpl_subno    = 'install';
50        $this->tpl_subtitle = 'プラグインのインストール';
51    }
52
53    /**
54     * Page のプロセス.
55     *
56     * @return void
57     */
58    function process() {
59        $this->action();
60        $this->sendResponse();
61    }
62
63    /**
64     * Page のアクション.
65     *
66     * @return void
67     */
68    function action() {
69        // パラメータ管理クラス
70        $this->objFormParam = new SC_FormParam_Ex();
71        // パラメータ情報の初期化
72        $this->lfInitParam();
73        // POST値の取得
74        $this->objFormParam->setParam($_REQUEST);
75        // 入力情報を渡す
76        $this->arrForm = $this->objFormParam->getHashArray();
77        $this->arrErr = $this->objFormParam->checkError();
78        if (count($this->arrErr) == 0) {
79        // インストール
80            $this->lfInstall($this->arrForm['path']);
81            $this->tpl_result = '完了しました。';
82        } else {
83            SC_Utils_Ex::sfDispException();
84        }
85    }
86
87    /**
88     * デストラクタ.
89     *
90     * @return void
91     */
92    function destroy() {
93        parent::destroy();
94    }
95
96    /**
97     * インストール
98     *
99     * @return void
100     */
101    function lfInstall($path) {
102
103        // アンインストール SQL を実行 (クリーンアップ)
104        SC_Helper_DB_Ex::sfExecSqlByFile(PLUGIN_REALDIR . "$path/sql/uninstall.sql");
105
106        // インストール SQL を実行
107        SC_Helper_DB_Ex::sfExecSqlByFile(PLUGIN_REALDIR . "$path/sql/install.sql");
108
109        // プラグイン XML に追加
110        $this->lfAddToPluginsXml($path);
111    }
112
113    /**
114     * プラグイン XML に追加
115     *
116     * @return void
117     */
118    function lfAddToPluginsXml($path) {
119        $pluginsXml = SC_Utils_Ex::sfGetPluginsXml();
120        $addPluginXml = $pluginsXml->addChild('plugin');
121        $addPluginXml->addChild('path', $path);
122        $arrPluginInfo = SC_Utils_Ex::sfGetPluginInfoArray($path);
123        $addPluginXml->addChild('name', $arrPluginInfo['name']);
124        SC_Utils_Ex::sfPutPluginsXml($pluginsXml);
125    }
126
127    /**
128     * パラメータ情報の初期化
129     *
130     * @return void
131     */
132    function lfInitParam() {
133        $this->objFormParam->addParam('プラグインのパス', 'path', STEXT_LEN, '', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK'));
134    }
135}
136?>
Note: See TracBrowser for help on using the repository browser.