r69749 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69748‎ | r69749 | r69750 >
Date:20:21, 22 July 2010
Author:reedy
Status:ok
Tags:
Comment:
Part of bug 24485 - Make iwbacklinks a generator, display iwprefix and iwtitle optionally

Added iwblprop to display iwprefix/iwtitle optionally

Comment out wrong example (generator, till rest of bug is implemented)
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryIWBacklinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php
@@ -64,6 +64,10 @@
6565 "iwl_from >= $from)))"
6666 );
6767 }
 68+
 69+ $prop = array_flip( $params['prop'] );
 70+ $iwprefix = isset( $prop['iwprefix'] );
 71+ $iwtitle = isset( $prop['iwtitle'] );
6872
6973 $this->addTables( array( 'iwlinks', 'page' ) );
7074 $this->addWhere( 'iwl_from = page_id' );
@@ -107,6 +111,14 @@
108112 if ( $row->page_is_redirect ) {
109113 $entry['redirect'] = '';
110114 }
 115+
 116+ if ( $iwprefix ) {
 117+ $entry['iwprefix'] = $row->iwl_prefix;
 118+ }
 119+
 120+ if ( $iwtitle ) {
 121+ $entry['iwtitle'] = $row->iwl_title;
 122+ }
111123
112124 $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry );
113125 if ( !$fit ) {
@@ -132,7 +144,15 @@
133145 ApiBase::PARAM_MIN => 1,
134146 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
135147 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
136 - )
 148+ ),
 149+ 'prop' => array(
 150+ ApiBase::PARAM_ISMULTI => true,
 151+ ApiBase::PARAM_DFLT => '',
 152+ ApiBase::PARAM_TYPE => array(
 153+ 'iwprefix',
 154+ 'iwtitle',
 155+ ),
 156+ ),
137157 );
138158 }
139159
@@ -141,6 +161,11 @@
142162 'prefix' => 'Prefix for the interwiki',
143163 'title' => "Interwiki link to search for. Must be used with {$this->getModulePrefix()}prefix",
144164 'continue' => 'When more results are available, use this to continue',
 165+ 'prop' => array(
 166+ 'Which properties to get',
 167+ ' iwprefix - Adds the prefix of the interwiki',
 168+ ' iwtitle - Adds the title of the interwiki',
 169+ ),
145170 'limit' => 'How many total pages to return',
146171 );
147172 }
@@ -163,7 +188,7 @@
164189 protected function getExamples() {
165190 return array(
166191 'api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks',
167 - 'api.php?action=query&generator=iwbacklinks&giwbltitle=Test&iwblprefix=wikibooks&prop=info'
 192+ //'api.php?action=query&generator=iwbacklinks&giwbltitle=Test&iwblprefix=wikibooks&prop=info'
168193 );
169194 }
170195

Follow-up revisions

RevisionCommit summaryAuthorDate
r69753* (bug 24485) Make iwbacklinks a generator, display iwprefix and iwtitle opti...reedy21:03, 22 July 2010

Status & tagging log