Index: trunk/phase3/includes/api/ApiQueryLangLinks.php |
— | — | @@ -46,6 +46,11 @@ |
47 | 47 | } |
48 | 48 | |
49 | 49 | $params = $this->extractRequestParams(); |
| 50 | + |
| 51 | + if ( isset( $params['title'] ) && !isset( $params['lang'] ) ) { |
| 52 | + $this->dieUsageMsg( array( 'missingparam', 'lang' ) ); |
| 53 | + } |
| 54 | + |
50 | 55 | $this->addFields( array( |
51 | 56 | 'll_from', |
52 | 57 | 'll_lang', |
— | — | @@ -69,12 +74,23 @@ |
70 | 75 | ); |
71 | 76 | } |
72 | 77 | |
73 | | - // Don't order by ll_from if it's constant in the WHERE clause |
74 | | - if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) { |
75 | | - $this->addOption( 'ORDER BY', 'll_lang' ); |
| 78 | + if ( isset( $params['lang'] ) ) { |
| 79 | + $this->addWhereFld( 'll_lang', $params['lang'] ); |
| 80 | + if ( isset( $params['title'] ) ) { |
| 81 | + $this->addWhereFld( 'll_title', $params['title'] ); |
| 82 | + $this->addOption( 'ORDER BY', 'll_from' ); |
| 83 | + } else { |
| 84 | + $this->addOption( 'ORDER BY', 'll_title, ll_from' ); |
| 85 | + } |
76 | 86 | } else { |
77 | | - $this->addOption( 'ORDER BY', 'll_from, ll_lang' ); |
| 87 | + // Don't order by ll_from if it's constant in the WHERE clause |
| 88 | + if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) { |
| 89 | + $this->addOption( 'ORDER BY', 'll_lang' ); |
| 90 | + } else { |
| 91 | + $this->addOption( 'ORDER BY', 'll_from, ll_lang' ); |
| 92 | + } |
78 | 93 | } |
| 94 | + |
79 | 95 | $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
80 | 96 | $res = $this->select( __METHOD__ ); |
81 | 97 | |
— | — | @@ -117,6 +133,8 @@ |
118 | 134 | ), |
119 | 135 | 'continue' => null, |
120 | 136 | 'url' => false, |
| 137 | + 'lang' => null, |
| 138 | + 'title' => null, |
121 | 139 | ); |
122 | 140 | } |
123 | 141 | |
— | — | @@ -125,6 +143,8 @@ |
126 | 144 | 'limit' => 'How many langlinks to return', |
127 | 145 | 'continue' => 'When more results are available, use this to continue', |
128 | 146 | 'url' => 'Whether to get the full URL', |
| 147 | + 'lang' => 'Language code', |
| 148 | + 'title' => "Link to search for. Must be used with {$this->getModulePrefix()}lang", |
129 | 149 | ); |
130 | 150 | } |
131 | 151 | |
— | — | @@ -134,6 +154,7 @@ |
135 | 155 | |
136 | 156 | public function getPossibleErrors() { |
137 | 157 | return array_merge( parent::getPossibleErrors(), array( |
| 158 | + array( 'missingparam', 'lang' ), |
138 | 159 | array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ), |
139 | 160 | ) ); |
140 | 161 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -79,6 +79,7 @@ |
80 | 80 | * (bug 26498) allow LinksUpdate with API |
81 | 81 | * (bug 26485) add a elextlinks param to prop=extlinks |
82 | 82 | * (bug 26483) add a iwtitles param to prop=iwlinks |
| 83 | +* (bug 26484) add a lltitles param to prop=langlinks |
83 | 84 | |
84 | 85 | === Languages updated in 1.18 === |
85 | 86 | |