From 3a1224eaf61daf781ca8d197f0fbda043d037f37 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Mon, 25 Jan 2010 08:59:24 +0000 Subject: [PATCH] + after install, update the version seting. * fix the bug of pdo. * fix the bug of webroot. --- trunk/module/install/control.php | 3 +++ trunk/module/install/model.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/trunk/module/install/control.php b/trunk/module/install/control.php index 7deb5a4620..8535c5c7cb 100644 --- a/trunk/module/install/control.php +++ b/trunk/module/install/control.php @@ -23,6 +23,8 @@ */ class install extends control { + const VERSION = '0.4 beta'; + /* 构造函数,检查是否是通过安装入口调用。*/ public function __construct() { @@ -95,6 +97,7 @@ class install extends control { $this->install->grantPriv(); if(dao::isError()) die(js::error(dao::getError())); + $this->loadModel('upgrade')->updateVersion(self::VERSION); echo (js::alert($this->lang->install->success)); unset($_SESSION['installing']); die(js::locate('index.php', 'parent')); diff --git a/trunk/module/install/model.php b/trunk/module/install/model.php index e33a98551f..fdbb2060fe 100644 --- a/trunk/module/install/model.php +++ b/trunk/module/install/model.php @@ -96,7 +96,7 @@ class installModel extends model /* 获得webRoot的地址。*/ public function getWebRoot() { - return rtrim(pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME), '/') . '/'; + return rtrim(str_replace('\\', '/', pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME)), '/') . '/'; } /* 检查配置。*/ @@ -157,7 +157,7 @@ class installModel extends model { $dbh = new PDO($dsn, $this->config->db->user, $this->config->db->password); $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); - $dbh->setAttribute(PDO::ATTR_ERRMODE, $this->config->db->errorMode); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->exec("SET NAMES {$this->config->db->encoding}"); return $dbh; }