MINOR Revert r111850 to MySQLDatabase::getVersion as version comparisons need to happen, and this will strip out non-numeric characters e.g. "ubuntu1" or "lenny4" which are prefixed on some Linux distros (from r111852)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112932 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 05:02:42 +00:00
parent 4af7d7aa34
commit 429434811f

View File

@ -100,11 +100,7 @@ class MySQLDatabase extends SS_Database {
*/ */
public function getVersion() { public function getVersion() {
if(!$this->mysqlVersion) { if(!$this->mysqlVersion) {
$this->mysqlVersion = @mysql_get_server_info($this->dbConn); $this->mysqlVersion = (float)substr(trim(ereg_replace("([A-Za-z-])", "", $this->query("SELECT VERSION()")->value())), 0, 3);
// fallback to query if function doesn't give anything
if(!$this->mysqlVersion) {
$this->mysqlVersion = (float)substr(trim(ereg_replace("([A-Za-z-])", "", $this->query("SELECT VERSION()")->value())), 0, 3);
}
} }
return $this->mysqlVersion; return $this->mysqlVersion;
} }