3 * ウィジェットインストールコンテナ作成用ベースクラス
7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
9 * @package Magic3 Framework
10 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11 * @copyright Copyright 2006-2010 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: baseInstallWidgetContainer.php 3187 2010-06-06 06:35:07Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getContainerPath() . '/baseWidgetContainer.php');
18 class BaseInstallWidgetContainer extends BaseWidgetContainer
23 function __construct()
26 parent::__construct();
29 * 起動マネージャから呼ばれる唯一のメソッド
31 * @param RequestManager $request HTTPリクエスト処理クラス
32 * @param int $install インストール種別(0=インストール、1=アンインストール、2=アップグレード)
35 function process($request, $install)
38 if (!$this->gEnv->isSystemAdmin()) return;
41 if (method_exists($this, '_preScript')) $this->_preScript($request, $install);
44 if (method_exists($this, '_doScript')){
45 // 初期化フラグがオフの場合のみスクリプト処理を実行
46 $widgetId = $this->gEnv->getCurrentWidgetId();
47 $ret = $this->_db->getWidgetInfo($widgetId, $row);
49 $version = $row['wd_version']; // ウィジェットのバージョン
50 if ($row['wd_initialized']){ // 初期化完了済み(再初期化禁止)
51 $this->setMsg(self::MSG_GUIDANCE, 'データの再初期化が禁止されているため、スクリプトは実行できません');
54 $scriptFiles = $this->_doScript($request, $install, $version);
55 for ($i = 0; $i < count($scriptFiles); $i++){
56 $scriptPath = $this->gEnv->getCurrentWidgetSqlPath() . '/' . $scriptFiles[$i];
59 if ($this->gInstance->getDbManager()->execScriptWithConvert($scriptPath, $errors)){// 正常終了の場合
60 $this->setMsg(self::MSG_GUIDANCE, 'スクリプト実行完了しました(ファイル名=' . $scriptFiles[$i] . ')');
62 $this->setMsg(self::MSG_APP_ERR, 'スクリプト実行に失敗しました(ファイル名=' . $scriptFiles[$i] . ')');
65 foreach ($errors as $error) {
66 $this->setMsg(self::MSG_APP_ERR, $error);
75 if (method_exists($this, '_postScript')) $this->_postScript($request, $install);
77 // 出力メッセージをメッセージマネージャに設定
78 $this->addMsgToGlobal();
81 * メッセージテーブルにグローバルメッセージを追加する
85 function addMsgToGlobal()
87 $this->gInstance->getMessageManager()->addMessage($this->errorMessage, $this->warningMessage, $this->guidanceMessage);