Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -1651,7 +1651,7 @@ |
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | /** |
1655 | | - * @private |
| 1655 | + * @return string |
1656 | 1656 | */ |
1657 | 1657 | function tableNamesWithUseIndexOrJOIN( $tables, $use_index = array(), $join_conds = array() ) { |
1658 | 1658 | $ret = array(); |
Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -84,23 +84,14 @@ |
85 | 85 | $this->tables = array_merge( $this->tables, $tables ); |
86 | 86 | } else { |
87 | 87 | if ( !is_null( $alias ) ) { |
88 | | - $tables = $this->getAliasedName( $tables, $alias ); |
| 88 | + $this->tables[$alias] = $tables; |
| 89 | + } else { |
| 90 | + $this->tables[] = $tables; |
89 | 91 | } |
90 | | - $this->tables[] = $tables; |
91 | 92 | } |
92 | 93 | } |
93 | 94 | |
94 | 95 | /** |
95 | | - * Get the SQL for a table name with alias |
96 | | - * @param $table string Table name |
97 | | - * @param $alias string Alias |
98 | | - * @return string SQL |
99 | | - */ |
100 | | - protected function getAliasedName( $table, $alias ) { |
101 | | - return $this->getDB()->tableName( $table ) . ' ' . $alias; |
102 | | - } |
103 | | - |
104 | | - /** |
105 | 96 | * Add a set of JOIN conditions to the internal array |
106 | 97 | * |
107 | 98 | * JOIN conditions are formatted as array( tablename => array(jointype, |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -179,8 +179,6 @@ |
180 | 180 | $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) ); |
181 | 181 | } |
182 | 182 | |
183 | | - |
184 | | - |
185 | 183 | // This is an index optimization for mysql, as done in the Special:Watchlist page |
186 | 184 | $this->addWhereIf( "rc_timestamp > ''", !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql' ); |
187 | 185 | |
Index: trunk/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -89,8 +89,7 @@ |
90 | 90 | $useIndex = false; |
91 | 91 | // Filter only users that belong to a given group |
92 | 92 | $this->addTables( 'user_groups', 'ug1' ); |
93 | | - $ug1 = $this->getAliasedName( 'user_groups', 'ug1' ); |
94 | | - $this->addJoinConds( array( $ug1 => array( 'INNER JOIN', array( 'ug1.ug_user=user_id', |
| 93 | + $this->addJoinConds( array( 'ug1' => array( 'INNER JOIN', array( 'ug1.ug_user=user_id', |
95 | 94 | 'ug1.ug_group' => $params['group'] ) ) ) ); |
96 | 95 | } |
97 | 96 | |
— | — | @@ -107,8 +106,7 @@ |
108 | 107 | $sqlLimit = $limit + $groupCount + 1; |
109 | 108 | |
110 | 109 | $this->addTables( 'user_groups', 'ug2' ); |
111 | | - $tname = $this->getAliasedName( 'user_groups', 'ug2' ); |
112 | | - $this->addJoinConds( array( $tname => array( 'LEFT JOIN', 'ug2.ug_user=user_id' ) ) ); |
| 110 | + $this->addJoinConds( array( 'ug2' => array( 'LEFT JOIN', 'ug2.ug_user=user_id' ) ) ); |
113 | 111 | $this->addFields( 'ug2.ug_group ug_group2' ); |
114 | 112 | } else { |
115 | 113 | $sqlLimit = $limit + 1; |