Is there any documentation on using the QueryPage class in an extension? I'd like to create a special page with the QueryPage features but am running into problems "hooking it up" to run. I don't see any QueryPage docs on mediawiki.org or meta. (Or is there a more modern way to get a paging Special Page?)
First I defined my subclass of QueryPage with some dummy methods:
class MyQueryPageClassName extends QueryPage { function getName() { return 'My Query Page'; } function getSQL() { return "select 1 as 'test'"; } function formatResult() { return 'dummy result'; } }
Then I hooked up my page with:
$wgHooks['wgQueryPages'][] = 'wfMyQueryPages'; function wfMtQueryPages(&$wgQueryPages) { $wgQueryPages[] = array('MyQueryPageClassName', 'MyQueryPage'); return true; }
At this point, the special page does not exist on the wiki. What else needs to be done to make this work?
I looked at SpecialPopularpages.php and see a global function wfSpecialPopularpages() at the end that looks necessary, but I don't see anything that calls it in the code. How does this really work? I created my own version but nothing seems to call it.
/** * Constructor */ function wfMyQueryPage() { list( $limit, $offset ) = wfCheckLimits(); $ppp = new MyQueryPageClassName(); return $ppp->doQuery( $offset, $limit ); }
Any help appreciated.
Thanks, DanB