Index: trunk/phase3/includes/api/ApiQueryInfo.php |
— | — | @@ -262,6 +262,10 @@ |
263 | 263 | if ( $this->fld_talkid || $this->fld_subjectid ) { |
264 | 264 | $this->getTSIDs(); |
265 | 265 | } |
| 266 | + |
| 267 | + if ( $this->fld_displaytitle ) { |
| 268 | + $this->getDisplayTitle(); |
| 269 | + } |
266 | 270 | |
267 | 271 | foreach ( $this->everything as $pageid => $title ) { |
268 | 272 | $pageInfo = $this->extractPageInfo( $pageid, $title ); |
— | — | @@ -357,9 +361,13 @@ |
358 | 362 | } |
359 | 363 | |
360 | 364 | if ( $this->fld_displaytitle ) { |
361 | | - |
| 365 | + if ( isset( $this->displaytitles[$title->getArticleId()] ) ) { |
| 366 | + $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleId()]; |
| 367 | + } else { |
| 368 | + $pageInfo['displaytitle'] = $title; |
| 369 | + } |
362 | 370 | } |
363 | | - |
| 371 | + |
364 | 372 | return $pageInfo; |
365 | 373 | } |
366 | 374 | |
— | — | @@ -512,7 +520,7 @@ |
513 | 521 | */ |
514 | 522 | private function getTSIDs() { |
515 | 523 | $getTitles = $this->talkids = $this->subjectids = array(); |
516 | | - $db = $this->getDB(); |
| 524 | + |
517 | 525 | foreach ( $this->everything as $t ) { |
518 | 526 | if ( MWNamespace::isTalk( $t->getNamespace() ) ) { |
519 | 527 | if ( $this->fld_subjectid ) { |
— | — | @@ -525,6 +533,8 @@ |
526 | 534 | if ( !count( $getTitles ) ) { |
527 | 535 | return; |
528 | 536 | } |
| 537 | + |
| 538 | + $db = $this->getDB(); |
529 | 539 | |
530 | 540 | // Construct a custom WHERE clause that matches |
531 | 541 | // all titles in $getTitles |
— | — | @@ -544,7 +554,32 @@ |
545 | 555 | } |
546 | 556 | } |
547 | 557 | } |
| 558 | + |
| 559 | + private function getDisplayTitle() { |
| 560 | + $pageIds = $this->displaytitles = array(); |
| 561 | + |
| 562 | + foreach ( $this->everything as $t ) { |
| 563 | + $pageIds = $t->getArticleID(); |
| 564 | + } |
| 565 | + |
| 566 | + if ( !count( $pageIds ) ) { |
| 567 | + return; |
| 568 | + } |
| 569 | + |
| 570 | + $db = $this->getDB(); |
548 | 571 | |
| 572 | + $this->resetQueryParams(); |
| 573 | + $this->addTables( 'page_props' ); |
| 574 | + $this->addFields( array( 'pp_page', 'pp_value' ) ); |
| 575 | + $this->addWhereFld( 'pp_page', $pageIds ); |
| 576 | + $this->addWhereFld( 'pp_propname', 'displaytitle' ); |
| 577 | + $res = $this->select( __METHOD__ ); |
| 578 | + |
| 579 | + foreach ( $res as $row ) { |
| 580 | + $this->displaytitles[$row->pp_page] = $row->pp_value; |
| 581 | + } |
| 582 | + } |
| 583 | + |
549 | 584 | /** |
550 | 585 | * Get information about watched status and put it in $this->watched |
551 | 586 | */ |
— | — | @@ -589,7 +624,8 @@ |
590 | 625 | 'subjectid', |
591 | 626 | 'url', |
592 | 627 | 'readable', |
593 | | - 'preload' |
| 628 | + 'preload', |
| 629 | + 'displaytitle', |
594 | 630 | ) ), |
595 | 631 | 'token' => array( |
596 | 632 | ApiBase::PARAM_DFLT => null, |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -282,6 +282,7 @@ |
283 | 283 | * (bug 24296) Added converttitles parameter to convert titles to their |
284 | 284 | canonical language variant. |
285 | 285 | * Fixed "link" parameter in image links with "thumb" parameter. |
| 286 | +* (bug 23936) - Add "displaytitle" to query/info API |
286 | 287 | |
287 | 288 | === Languages updated in 1.17 === |
288 | 289 | |