+ after install, update the version seting.

* fix the bug of pdo.
 * fix the bug of webroot.
This commit is contained in:
wangchunsheng
2010-01-25 08:59:24 +00:00
parent 0d0fee4ef7
commit 3a1224eaf6
2 changed files with 5 additions and 2 deletions

View File

@@ -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'));

View File

@@ -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;
}