diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-01-14 19:24:18 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-01-14 19:24:18 +0100 |
commit | 224b22a051051f6c2e494c3a2fb4adb42898e2d1 (patch) | |
tree | 85a41a4cf8533bf740ec4c8d3affce88414daa56 /includes/db | |
parent | 9937b8e6d6a8b4517c04c143daaf9ebd42ce8ba0 (diff) |
Update to MediaWiki 1.22.1
Diffstat (limited to 'includes/db')
-rw-r--r-- | includes/db/DatabaseMssql.php | 2 | ||||
-rw-r--r-- | includes/db/DatabaseMysqlBase.php | 9 | ||||
-rw-r--r-- | includes/db/DatabaseOracle.php | 2 | ||||
-rw-r--r-- | includes/db/DatabasePostgres.php | 30 | ||||
-rw-r--r-- | includes/db/DatabaseSqlite.php | 2 |
5 files changed, 39 insertions, 6 deletions
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 240a097c..37f5372e 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -655,7 +655,7 @@ class DatabaseMssql extends DatabaseBase { * @return string wikitext of a link to the server software's web site */ public function getSoftwareLink() { - return "[http://www.microsoft.com/sql/ MS SQL Server]"; + return "[{{int:version-db-mssql-url}} MS SQL Server]"; } /** diff --git a/includes/db/DatabaseMysqlBase.php b/includes/db/DatabaseMysqlBase.php index 26c9d247..8f12b92d 100644 --- a/includes/db/DatabaseMysqlBase.php +++ b/includes/db/DatabaseMysqlBase.php @@ -681,7 +681,14 @@ abstract class DatabaseMysqlBase extends DatabaseBase { * @return string */ public function getSoftwareLink() { - return '[http://www.mysql.com/ MySQL]'; + $version = $this->getServerVersion(); + if ( strpos( $version, 'MariaDB' ) !== false ) { + return '[{{int:version-db-mariadb-url}} MariaDB]'; + } elseif ( strpos( $version, 'percona' ) !== false ) { + return '[{{int:version-db-percona-url}} Percona Server]'; + } else { + return '[{{int:version-db-mysql-url}} MySQL]'; + } } /** diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index fbaa4da5..32d4d984 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -846,7 +846,7 @@ class DatabaseOracle extends DatabaseBase { * @return string wikitext of a link to the server software's web site */ public function getSoftwareLink() { - return '[http://www.oracle.com/ Oracle]'; + return '[{{int:version-db-oracle-url}} Oracle]'; } /** diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index e564a162..aed35f10 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -721,6 +721,29 @@ __INDEXATTR__; } /** + * Change the FOR UPDATE option as necessary based on the join conditions. Then pass + * to the parent function to get the actual SQL text. + * + * In Postgres when using FOR UPDATE, only the main table and tables that are inner joined + * can be locked. That means tables in an outer join cannot be FOR UPDATE locked. Trying to do + * so causes a DB error. This wrapper checks which tables can be locked and adjusts it accordingly. + */ + function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__, $options = array(), $join_conds = array() ) { + $forUpdateKey = array_search( 'FOR UPDATE', $options ); + if ( $forUpdateKey !== false && $join_conds ) { + unset( $options[$forUpdateKey] ); + + foreach ( $join_conds as $table => $join_cond ) { + if ( 0 === preg_match( '/^(?:LEFT|RIGHT|FULL)(?: OUTER)? JOIN$/i', $join_cond[0] ) ) { + $options['FOR UPDATE'][] = $table; + } + } + } + + return parent::selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds ); + } + + /** * INSERT wrapper, inserts an array into a table * * $args may be a single associative array, or an array of these with numeric keys, @@ -1060,7 +1083,7 @@ __INDEXATTR__; * @return string wikitext of a link to the server software's web site */ public function getSoftwareLink() { - return '[http://www.postgresql.org/ PostgreSQL]'; + return '[{{int:version-db-postgres-url}} PostgreSQL]'; } /** @@ -1399,9 +1422,12 @@ SQL; // : false ); //} - if ( isset( $noKeyOptions['FOR UPDATE'] ) ) { + if ( isset( $options['FOR UPDATE'] ) ) { + $postLimitTail .= ' FOR UPDATE OF ' . implode( ', ', $options['FOR UPDATE'] ); + } else if ( isset( $noKeyOptions['FOR UPDATE'] ) ) { $postLimitTail .= ' FOR UPDATE'; } + if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) { $startOpts .= 'DISTINCT'; } diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 4a51226f..3e034649 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -614,7 +614,7 @@ class DatabaseSqlite extends DatabaseBase { * @return string wikitext of a link to the server software's web site */ public function getSoftwareLink() { - return "[http://sqlite.org/ SQLite]"; + return "[{{int:version-db-sqlite-url}} SQLite]"; } /** |