Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -154,6 +154,9 @@ |
155 | 155 | // JS variables |
156 | 156 | $wgHooks['MakeGlobalVariablesScript'][] = 'LqtHooks::onMakeGlobalVariablesScript'; |
157 | 157 | |
| 158 | +// API |
| 159 | +$wgHooks['APIQueryAfterExecute'][] = 'LqtHooks::onAPIQueryAfterExecute'; |
| 160 | + |
158 | 161 | // Special pages |
159 | 162 | $wgSpecialPages['MoveThread'] = 'SpecialMoveThread'; |
160 | 163 | $wgSpecialPages['NewMessages'] = 'SpecialNewMessages'; |
Index: trunk/extensions/LiquidThreads/classes/Hooks.php |
— | — | @@ -862,4 +862,21 @@ |
863 | 863 | $list[NS_LQT_SUMMARY_TALK] = 'Summary_talk'; |
864 | 864 | return true; |
865 | 865 | } |
| 866 | + |
| 867 | + public static function onAPIQueryAfterExecute( &$module ) { |
| 868 | + if( $module instanceof ApiQueryInfo ) { |
| 869 | + $result = $module->getResult(); |
| 870 | + $data = $result->getData(); |
| 871 | + |
| 872 | + foreach( $data['query']['pages'] as $pageid => $page ) { |
| 873 | + if( $page == 'page' ) continue; |
| 874 | + |
| 875 | + if( LqtDispatch::isLqtPage( Title::newFromText( $page['title'] ) ) ) { |
| 876 | + $result->addValue( array( 'query', 'pages' ), $pageid, array( 'islqttalkpage' => '' ) ); |
| 877 | + } |
| 878 | + } |
| 879 | + } |
| 880 | + |
| 881 | + return true; |
| 882 | + } |
866 | 883 | } |