[Mediawiki-l] wfStrencode & wfQuery

John Moorhouse john.moorhouse at 3jays.me.uk
Mon Jan 22 19:58:43 UTC 2007

Brion- many thanks is now working,

I've used the db->addQuotes, I will see what I can learn on the query 
builder functions to see if I can remove the sql bits as well.

Thanks for this.


Brion Vibber wrote:
> Hash: SHA1
> John Moorhouse wrote:
>> I'm working on moving a number of Wiki's to V1.9 and have hit a problem 
>> with the kWBreadCrumbs extension, which is complaining about both 
>> wfStrencode & wfQuery functions, I've tried the various suggestions 
>> about replacing wfStrencode with addQuotes() but I'm rather out of my 
>> depth. The rest of the extension works with 1.9  (I've dot it running 
>> without the kwBreadCrumbsNoCache function, any help would be 
>> appreciated, as I'm out of my depth here, I've added the function code 
>> to this email. If I can get it working I'll add it back into the 
>> extensions list if this is felt appropriate.
> Change:
> wfStrencode($blah)
> to
> $db->strencode($blah)
> (or better $db->addQuotes($blah); note this includes the outer quotes)
> wfQuery($blah, DB_WRITE, $fname);
> to
> $db->query($blah, $fname);
> (or better use the various query-builder functions, which will tend to
> be safer due to applying propr quoting always, and may be more portable
> for not-quite-standard constructs).
> These long-, long-, long-obsolete functions have been removed because
> they are unreliable -- it's hard to know which database object they will
> be sent to, and that's generally icky.
> You get a Database object from wfGetDB(DB_MASTER) or wfGetDB(DB_SLAVE).
> Writes must go to the master *only*. Many read operations can be taken
> from a slave, which will spread load away from your primary server in a
> load-balancing replication setup. (On a single server they will both
> return the same connection.)

More information about the MediaWiki-l mailing list