Hi,
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
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
Seems like a bit of a chicken and egg problem, any ideas?
Travis
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)
The FlaggedRevs extension uses a query page. I suppose you could mimic that.
-Aaron Schulz
Date: Mon, 1 Oct 2007 12:22:37 -0400 From: travis@wikihow.com To: wikitech-l@lists.wikimedia.org Subject: [Wikitech-l] creating an extension that extends QueryPage
Hi,
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
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
Seems like a bit of a chicken and egg problem, any ideas?
Travis
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
_________________________________________________________________ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QB...
I see brion already replied. At any rate, be aware that you should NOT use isExpensive() as true, as the updatespecialpages.php file will get confused.
Travis Derouin-2 wrote:
Hi,
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
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
Seems like a bit of a chicken and egg problem, any ideas?
Travis
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
Thanks for the info. It also looks like if you declare the class inside the function that's appended to wgExtensionFunctions, it seems to work too. Weird.
Thanks.
On 10/1/07, Voice of All jschulz_4587@msn.com wrote:
I see brion already replied. At any rate, be aware that you should NOT use isExpensive() as true, as the updatespecialpages.php file will get confused.
Travis Derouin-2 wrote:
Hi,
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
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
Seems like a bit of a chicken and egg problem, any ideas?
Travis
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- View this message in context: http://www.nabble.com/creating-an-extension-that-extends-QueryPage-tf4549357... Sent from the Wikipedia Developers mailing list archive at Nabble.com.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org