Travis Derouin wrote:
I'm trying to extend QueryPage into an extension,
which should be
pretty simple. If I declare the class in a new file located in the
extensions subdirectory to extend QueryPage:
class BuddyPage extends PageQueryPage {
}
I get:
Fatal error: Class 'PageQueryPage' not found in
/var/www/html/mediawiki-1.11.0/extensions/BuddyPage.php on line 21
Generally what you should be doing is adding your file to
$wgAutoloadClasses in the extension's loader file; then the file gets
loaded on-demand when the class actually gets used. Something like:
$wgAutoloadClasses['PageQueryPage'] =
dirname(__FILE__).'/PageQueryPage.php';
QueryPage.php will be similarly loaded on demand when actually needed,
at a time when things are initialized properly.
But if I include QueryPage.php:
require_once('QueryPage.php');
I get the error:
Fatal error: Call to undefined function wfRunHooks() in
/var/www/html/mediawiki-1.11.0/includes/QueryPage.php on line 46
IMHO QueryPage.php is not constructed very nicely. The class definition
and the building of a list of generatable query pages should probably
not be in the same file.
But you should sidestep this problem via the above loading technique.
-- brion vibber (brion @
wikimedia.org)