On Mon, Jan 16, 2012 at 7:49 AM, Vance - vance0725@gmail.com wrote:
I’m working on a PHP class to execute some database queries in support of another class that will be used by an extension. But I’m getting the following error message:
Fatal error: Call to undefined function wfGetDB()
when I try to call a method in my class from a test script. Any ideas as to how to resolve this?
As a guess, you're calling these during initialization/setup, and not all of MediaWiki's internal frameworks have been loaded yet.
Avoid running non-trivial code directly in an extension setup file; put such things into a function, and add it to the $wgExtensionFunctions array -- that'll queue it to be executed after the framework's set up.
-- brion vibber (brion @ pobox.com / bvibber @ wikimedia.org)