+ after install, update the version seting.
* fix the bug of pdo. * fix the bug of webroot.
This commit is contained in:
@@ -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'));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user