* move the isCentOS to helper.
This commit is contained in:
@@ -323,6 +323,21 @@ class helper
|
||||
chdir($cwd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge the os is centos or not.
|
||||
*
|
||||
* @access private
|
||||
* @return bool
|
||||
*/
|
||||
static public function isCentOS()
|
||||
{
|
||||
if(PHP_OS != 'Linux') return false;
|
||||
$issueFile = '/etc/issue';
|
||||
if(!file_exists($issueFile) or !is_readable($issueFile)) return false;
|
||||
return stripos(file_get_contents($issueFile), 'centos') !== false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1464,7 +1464,7 @@ class router
|
||||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbh->exec("SET NAMES {$config->db->encoding}");
|
||||
if(isset($config->db->strictMode) and $config->db->strictMode == false) $dbh->exec("SET @@sql_mode= ''");
|
||||
if($this->isCentOS()) $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
|
||||
if(helper::isCentOS()) $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
|
||||
$this->dbh = $dbh;
|
||||
return $dbh;
|
||||
}
|
||||
@@ -1473,20 +1473,6 @@ class router
|
||||
self::error($exception->getMessage(), __FILE__, __LINE__, $exit = true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge the os is centos or not.
|
||||
*
|
||||
* @access private
|
||||
* @return bool
|
||||
*/
|
||||
private function isCentOS()
|
||||
{
|
||||
if(PHP_OS != 'Linux') return false;
|
||||
$issueFile = '/etc/issue';
|
||||
if(!file_exists($issueFile) or !is_readable($issueFile)) return false;
|
||||
return stripos(file_get_contents($issueFile), 'centos') !== false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user