Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -94,6 +94,9 @@ |
95 | 95 | case 'functionhooks': |
96 | 96 | $fit = $this->appendFunctionHooks( $p ); |
97 | 97 | break; |
| 98 | + case 'showhooks': |
| 99 | + $fit = $this->appendSubscribedHooks( $p ); |
| 100 | + break; |
98 | 101 | default: |
99 | 102 | ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); |
100 | 103 | } |
— | — | @@ -498,6 +501,26 @@ |
499 | 502 | return "<{$item}>"; |
500 | 503 | } |
501 | 504 | |
| 505 | + public function appendSubscribedHooks( $property ) { |
| 506 | + global $wgHooks; |
| 507 | + $myWgHooks = $wgHooks; |
| 508 | + ksort( $myWgHooks ); |
| 509 | + |
| 510 | + $data = array(); |
| 511 | + foreach ( $myWgHooks as $hook => $hooks ) { |
| 512 | + $arr = array( |
| 513 | + 'name' => $hook, |
| 514 | + 'subscribers' => $hooks, |
| 515 | + ); |
| 516 | + |
| 517 | + $this->getResult()->setIndexedTagName( $arr['subscribers'], 's' ); |
| 518 | + $data[] = $arr; |
| 519 | + } |
| 520 | + |
| 521 | + $this->getResult()->setIndexedTagName( $data, 'hook' ); |
| 522 | + return $this->getResult()->addValue( 'query', $property, $data ); |
| 523 | + } |
| 524 | + |
502 | 525 | public function getCacheMode( $params ) { |
503 | 526 | return 'public'; |
504 | 527 | } |
— | — | @@ -524,6 +547,7 @@ |
525 | 548 | 'skins', |
526 | 549 | 'extensiontags', |
527 | 550 | 'functionhooks', |
| 551 | + 'showhooks', |
528 | 552 | ) |
529 | 553 | ), |
530 | 554 | 'filteriw' => array( |
— | — | @@ -557,6 +581,7 @@ |
558 | 582 | ' skins - Returns a list of all enabled skins', |
559 | 583 | ' extensiontags - Returns a list of parser extension tags', |
560 | 584 | ' functionhooks - Returns a list of parser function hooks', |
| 585 | + ' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)' |
561 | 586 | ), |
562 | 587 | 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', |
563 | 588 | 'showalldb' => 'List all database servers, not just the one lagging the most', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -366,6 +366,7 @@ |
367 | 367 | * (bug 28238) paraminfo: output both limits for multi param |
368 | 368 | * (bug 27179) API: List of extension tags through meta=siteinfo |
369 | 369 | * Get a list of function hooks through meta=siteinfo |
| 370 | +* Get a list of all subscribed hooks, and those subscribers |
370 | 371 | |
371 | 372 | === Languages updated in 1.18 === |
372 | 373 | |