From: Aaron Schulz Date: Wed, 4 Sep 2019 03:05:49 +0000 (-0700) Subject: rdbms: cleanup visibility of Database::makeSelectOptions() X-Git-Tag: 1.34.0-rc.0~394^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=2f8be5ca9d1189d0885fd51f0e1230e03bffb062;p=lhc%2Fweb%2Fwiklou.git rdbms: cleanup visibility of Database::makeSelectOptions() Change-Id: I2e18dd3d450ceec9895d3143074743bc206a943d --- diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 6aa3f6fe59..be41ee0409 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1681,12 +1681,13 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * Returns an optional USE INDEX clause to go after the table, and a * string to go at the end of the query. * + * @see Database::select() + * * @param array $options Associative array of options to be turned into * an SQL query, valid keys are listed in the function. * @return array - * @see Database::select() */ - protected function makeSelectOptions( $options ) { + protected function makeSelectOptions( array $options ) { $preLimitTail = $postLimitTail = ''; $startOpts = ''; diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index a7ebc86e50..c075a1b4c2 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -1301,7 +1301,7 @@ SQL; return "'" . pg_escape_string( $conn, (string)$s ) . "'"; } - public function makeSelectOptions( $options ) { + protected function makeSelectOptions( array $options ) { $preLimitTail = $postLimitTail = ''; $startOpts = $useIndex = $ignoreIndex = ''; diff --git a/includes/libs/rdbms/database/DatabaseSqlite.php b/includes/libs/rdbms/database/DatabaseSqlite.php index 657d308310..0e2dc8fa9a 100644 --- a/includes/libs/rdbms/database/DatabaseSqlite.php +++ b/includes/libs/rdbms/database/DatabaseSqlite.php @@ -603,15 +603,10 @@ class DatabaseSqlite extends Database { return in_array( 'UNIQUE', $options ); } - /** - * Filter the options used in SELECT statements - * - * @param array $options - * @return array - */ - function makeSelectOptions( $options ) { + protected function makeSelectOptions( array $options ) { + // Remove problematic options that the base implementation converts to SQL foreach ( $options as $k => $v ) { - if ( is_numeric( $k ) && ( $v == 'FOR UPDATE' || $v == 'LOCK IN SHARE MODE' ) ) { + if ( is_numeric( $k ) && ( $v === 'FOR UPDATE' || $v === 'LOCK IN SHARE MODE' ) ) { $options[$k] = ''; } }