[Mediawiki-l] wfStrencode & wfQuery

Brion Vibber brion at pobox.com
Mon Jan 22 19:22:00 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
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.)

- -- brion vibber (brion @ pobox.com)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFtQ7XwRnhpk1wk44RAja8AKCoM6hvTz27kKam8E1kukptIFeYyACeK6l4
UlQUQ0g37GytTcXRpP3S5CI=
=hciC
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list