From 42017a2f47635b22a9d2e574fa210de20c5010ca Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 22 Jul 2010 04:00:39 +0000 Subject: [PATCH] Use $wgContLang not $wgLang for checkTitleEncoding() and getSpecialPageAliases(), it doesn't make sense to use the user language, WebRequest and SpecialPage certainly don't. The DatabaseOracle use of checkTitleEncoding() is weird and probably broken, but at least it uses the right object now. --- includes/api/ApiQuerySiteinfo.php | 8 ++++---- includes/db/DatabaseOracle.php | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index e861cc7cd3..092aaababb 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -99,7 +99,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { } protected function appendGeneralInfo( $property ) { - global $wgContLang, $wgLang; + global $wgContLang; $data = array(); $mainPage = Title::newMainPage(); @@ -128,7 +128,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { if ( $wgContLang->isRTL() ) { $data['rtl'] = ''; } - $data['fallback8bitEncoding'] = $wgLang->fallback8bitEncoding(); + $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding(); if ( wfReadOnly() ) { $data['readonly'] = ''; @@ -209,9 +209,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { } protected function appendSpecialPageAliases( $property ) { - global $wgLang; + global $wgContLang; $data = array(); - foreach ( $wgLang->getSpecialPageAliases() as $specialpage => $aliases ) + foreach ( $wgContLang->getSpecialPageAliases() as $specialpage => $aliases ) { $arr = array( 'realname' => $specialpage, 'aliases' => $aliases ); $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' ); diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index f1b54fafc5..f07a2a5c86 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -457,7 +457,7 @@ class DatabaseOracle extends DatabaseBase { } private function insertOneRow( $table, $row, $fname ) { - global $wgLang; + global $wgContLang; $table = $this->tableName( $table ); // "INSERT INTO tables (a, b, c)" @@ -493,7 +493,7 @@ class DatabaseOracle extends DatabaseBase { $val = '31-12-2030 12:00:00.000000'; } - $val = ( $wgLang != null ) ? $wgLang->checkTitleEncoding( $val ) : $val; + $val = ( $wgContLang != null ) ? $wgContLang->checkTitleEncoding( $val ) : $val; if ( oci_bind_by_name( $stmt, ":$col", $val ) === false ) { $this->reportQueryError( $this->lastErrno(), $this->lastError(), $sql, __METHOD__ ); return false; @@ -1028,9 +1028,9 @@ class DatabaseOracle extends DatabaseBase { } function addQuotes( $s ) { - global $wgLang; - if ( isset( $wgLang->mLoaded ) && $wgLang->mLoaded ) { - $s = $wgLang->checkTitleEncoding( $s ); + global $wgContLang; + if ( isset( $wgContLang->mLoaded ) && $wgContLang->mLoaded ) { + $s = $wgContLang->checkTitleEncoding( $s ); } return "'" . $this->strencode( $s ) . "'"; } @@ -1040,7 +1040,7 @@ class DatabaseOracle extends DatabaseBase { } function selectRow( $table, $vars, $conds, $fname = 'DatabaseOracle::selectRow', $options = array(), $join_conds = array() ) { - global $wgLang; + global $wgContLang; $conds2 = array(); $conds = ($conds != null && !is_array($conds)) ? array($conds) : $conds; @@ -1048,9 +1048,9 @@ class DatabaseOracle extends DatabaseBase { $col_info = $this->fieldInfoMulti( $table, $col ); $col_type = $col_info != false ? $col_info->type() : 'CONSTANT'; if ( $col_type == 'CLOB' ) { - $conds2['TO_CHAR(' . $col . ')'] = $wgLang->checkTitleEncoding( $val ); + $conds2['TO_CHAR(' . $col . ')'] = $wgContLang->checkTitleEncoding( $val ); } elseif ( $col_type == 'VARCHAR2' && !mb_check_encoding( $val ) ) { - $conds2[$col] = $wgLang->checkTitleEncoding( $val ); + $conds2[$col] = $wgContLang->checkTitleEncoding( $val ); } else { $conds2[$col] = $val; } @@ -1103,24 +1103,24 @@ class DatabaseOracle extends DatabaseBase { } public function delete( $table, $conds, $fname = 'DatabaseOracle::delete' ) { - global $wgLang; + global $wgContLang; - if ( $wgLang != null ) { + if ( $wgContLang != null ) { $conds2 = array(); $conds = ($conds != null && !is_array($conds)) ? array($conds) : $conds; foreach ( $conds as $col => $val ) { $col_info = $this->fieldInfoMulti( $table, $col ); $col_type = $col_info != false ? $col_info->type() : 'CONSTANT'; if ( $col_type == 'CLOB' ) { - $conds2['TO_CHAR(' . $col . ')'] = $wgLang->checkTitleEncoding( $val ); + $conds2['TO_CHAR(' . $col . ')'] = $wgContLang->checkTitleEncoding( $val ); } else { if ( is_array( $val ) ) { $conds2[$col] = $val; foreach ( $conds2[$col] as &$val2 ) { - $val2 = $wgLang->checkTitleEncoding( $val2 ); + $val2 = $wgContLang->checkTitleEncoding( $val2 ); } } else { - $conds2[$col] = $wgLang->checkTitleEncoding( $val ); + $conds2[$col] = $wgContLang->checkTitleEncoding( $val ); } } } -- 2.20.1