r77072 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77071‎ | r77072 | r77073 >
Date:14:04, 21 November 2010
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* (bug 26006) prop=langlinks now allows obtaining full URL
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLangLinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryLangLinks.php
@@ -87,6 +87,12 @@
8888 break;
8989 }
9090 $entry = array( 'lang' => $row->ll_lang );
 91+ if ( !is_null( $params['url'] ) ) {
 92+ $title = Title::newFromText( "{$row->ll_lang}:{$row->ll_title}" );
 93+ if ( $title ) {
 94+ $entry = array_merge( $entry, array( 'url' => $title->getFullURL() ) );
 95+ }
 96+ }
9197 ApiResult::setContent( $entry, $row->ll_title );
9298 $fit = $this->addPageSubItem( $row->ll_from, $entry );
9399 if ( !$fit ) {
@@ -110,6 +116,7 @@
111117 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
112118 ),
113119 'continue' => null,
 120+ 'url' => null,
114121 );
115122 }
116123
@@ -117,6 +124,7 @@
118125 return array(
119126 'limit' => 'How many langlinks to return',
120127 'continue' => 'When more results are available, use this to continue',
 128+ 'url' => 'Whether to get the full URL',
121129 );
122130 }
123131
Index: trunk/phase3/RELEASE-NOTES
@@ -527,6 +527,7 @@
528528 * (bug 25760) counter property still reported by the API when
529529 $wgDisableCounters enabled
530530 * (bug 25987) prop=info&inprop=watched now also works for missing pages
 531+* (bug 26006) prop=langlinks now allows obtaining full URL
531532
532533 === Languages updated in 1.17 ===
533534

Follow-up revisions

RevisionCommit summaryAuthorDate
r77079Per Reedy, follow-up to r77072: don't use array_merge() to add just one itemialex17:02, 21 November 2010
r77080Per r77072 CR, followup r66872 (seemingly my crappy code from 5 months ago) l...reedy17:27, 21 November 2010
r77660Followup r77072: declare llurl as a boolean parameter.catrope14:44, 3 December 2010

Comments

#Comment by Reedy (talk | contribs)   16:19, 21 November 2010
$entry = array( 'lang' => $row->ll_lang );
+			if ( !is_null( $params['url'] ) ) {
+				$title = Title::newFromText( "{$row->ll_lang}:{$row->ll_title}" );
+				if ( $title ) {
+					$entry['url'] = $title->getFullURL();
+				}
+			}

Would be better (ie don't use array_merge)

#Comment by IAlex (talk | contribs)   17:04, 21 November 2010

Done in r77079 (I just stole the code from ApiQueryIWLinks.php though).

#Comment by Reedy (talk | contribs)   17:27, 21 November 2010

Cheers for pointing that one out, now cleared that up =)

#Comment by Reedy (talk | contribs)   16:20, 21 November 2010

(Thanks for fixing the bug though!)

Status & tagging log