From: <var...@us...> - 2021-10-06 08:34:20
|
Revision: 10616 http://sourceforge.net/p/phpwiki/code/10616 Author: vargenau Date: 2021-10-06 08:34:18 +0000 (Wed, 06 Oct 2021) Log Message: ----------- Assume recent MySQL Modified Paths: -------------- trunk/lib/WikiDB/backend/PDO.php trunk/lib/WikiDB/backend/PDO_mysql.php trunk/lib/WikiDB/backend/PearDB_mysqli.php Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2021-10-06 08:31:04 UTC (rev 10615) +++ trunk/lib/WikiDB/backend/PDO.php 2021-10-06 08:34:18 UTC (rev 10616) @@ -120,13 +120,10 @@ $this->_hasTransactions = true; try { $this->_dbh->beginTransaction(); + $this->commit(); } catch (PDOException $e) { $this->_hasTransactions = false; } - $sth = $this->_dbh->prepare("SELECT version()"); - $sth->execute(); - $this->_serverinfo['version'] = $sth->fetchColumn(); - $this->commit(); // required to match the try catch block above! $prefix = isset($dbparams['prefix']) ? $dbparams['prefix'] : ''; $this->_table_names Modified: trunk/lib/WikiDB/backend/PDO_mysql.php =================================================================== --- trunk/lib/WikiDB/backend/PDO_mysql.php 2021-10-06 08:31:04 UTC (rev 10615) +++ trunk/lib/WikiDB/backend/PDO_mysql.php 2021-10-06 08:34:18 UTC (rev 10616) @@ -33,20 +33,7 @@ function __construct($dbparams) { parent::__construct($dbparams); - - if (!empty($this->_serverinfo['version'])) { - $arr = explode('.', $this->_serverinfo['version']); - $this->_serverinfo['version'] = (string)(($arr[0] * 100) + $arr[1]) . "." . (integer)$arr[2]; - } - if ($this->_serverinfo['version'] < 323.0) { - // Older MySQL's don't have CASE WHEN ... END - $this->_expressions['maxmajor'] = "MAX(IF(minor_edit=0,version,0))"; - $this->_expressions['maxminor'] = "MAX(IF(minor_edit<>0,version,0))"; - } - - if ($this->_serverinfo['version'] > 401.0) { - $this->_dbh->query("SET NAMES 'UTF-8'"); - } + $this->_dbh->query("SET NAMES 'UTF-8'"); } function backendType() Modified: trunk/lib/WikiDB/backend/PearDB_mysqli.php =================================================================== --- trunk/lib/WikiDB/backend/PearDB_mysqli.php 2021-10-06 08:31:04 UTC (rev 10615) +++ trunk/lib/WikiDB/backend/PearDB_mysqli.php 2021-10-06 08:34:18 UTC (rev 10616) @@ -28,26 +28,6 @@ class WikiDB_backend_PearDB_mysqli extends WikiDB_backend_PearDB { - function __construct($dbparams) - { - parent::__construct($dbparams); - if (DB::isError($this->_dbh)) { - return; - } - //$this->_serverinfo = $this->_dbh->ServerInfo(); - $row = $this->_dbh->GetOne("SELECT version()"); - if (!DB::isError($row) and !empty($row)) { - $arr = explode('.', $row); - $this->_serverinfo['version'] = (string)(($arr[0] * 100) + $arr[1]) . - "." . (integer)$arr[2]; - if ($this->_serverinfo['version'] < 323.0) { - // Older MySQL's don't have CASE WHEN ... END - $this->_expressions['maxmajor'] = "MAX(IF(minor_edit=0,version,0))"; - $this->_expressions['maxminor'] = "MAX(IF(minor_edit<>0,version,0))"; - } - } - } - /** * Kill timed out processes. ( so far only called on about every 50-th save. ) */ @@ -217,11 +197,9 @@ // Note that this will fail silently if the page does not // have a record in the page table. Since it's just the // hit count, who cares? - // LIMIT since 3.23 - $dbh->query(sprintf("UPDATE LOW_PRIORITY %s SET hits=hits+1 WHERE pagename='%s' %s", + $dbh->query(sprintf("UPDATE LOW_PRIORITY %s SET hits=hits+1 WHERE pagename='%s' LIMIT 1", $this->_table_names['page_tbl'], - $dbh->escapeSimple($pagename), - ($this->_serverinfo['version'] >= 323.0) ? "LIMIT 1" : "")); + $dbh->escapeSimple($pagename))); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |