Brion Vibber wrote:
wfStrencode is waaay ancient and finally got removed. One problem
with
it is that as a global function it wouldn't match with the actual database class in use, and thus may perform incorrect escaping.
Okay.
Use the database object's addQuotes() method if you must construct
SQL
manually. This performs both quoting and escaping appropriate to the database connection.
e.g.: 'blah blah page_title=' . $dbr->addQuotes( $row->page_title )
So, obviously, I have some extensions that worked with versions up to and including 1.8.2, but will break 1.9alpha. I'm comfortable with that, but I've only recently started hacking at this code, so a little push along might be needed. In the case of the RSS feed extension I have (Alxndr's, actually), the guilty line reads:
$ti = wfStrencode($wgTitle->getDBkey());
I'm not yet familiar enough with this to completely understand what's going on, so if I could ask; can you show me in this case what I should be doing? If I get shown once, I should be able to deal with it into the future.
Much appreciated. Oh, and thanks for gently tolerating the n00b.
Steve
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Stephen Collins wrote:
Brion Vibber wrote:
e.g.: 'blah blah page_title=' . $dbr->addQuotes( $row->page_title )
[snip]
$ti = wfStrencode($wgTitle->getDBkey());
I'm not yet familiar enough with this to completely understand what's going on, so if I could ask; can you show me in this case what I should be doing? If I get shown once, I should be able to deal with it into the future.
I pretty much just showed you.
- -- brion vibber (brion @ pobox.com)
On 20/12/2006, at 4:48 AM, Brion Vibber wrote:
I pretty much just showed you.
Okay, I'll pay that. I was tired, and didn't feel like thinking...
However, now I change the code to reflect the new function and apparently, addQuotes is undefined...
Fatal error: Call to undefined function addQuotes() in /home/3698/ domains/wikitest/html/smsp1/extensions/rss.php on line 226
So, what am I doing wrong? Looks to me like some kind of function library is missing...
I'm blundering along in the dark here - unfamiliarity with both PHP and MediaWiki is cruelling me and I could really do with a little friendly advice.
Steve
On 20/12/06, Stephen Collins trib@acidlabs.org wrote:
On 20/12/2006, at 4:48 AM, Brion Vibber wrote:
I pretty much just showed you.
Okay, I'll pay that. I was tired, and didn't feel like thinking...
However, now I change the code to reflect the new function and apparently, addQuotes is undefined...
Fatal error: Call to undefined function addQuotes() in /home/3698/ domains/wikitest/html/smsp1/extensions/rss.php on line 226
You seem to be calling addQuotes() as if it were global. You need to call it as a member function of the database class, which it is.
You'll see either $dbw or $dbr defined around the problematic code block; this is a database object. Use (alter as appropriate):
$dbr->addQuotes( blah blah );
Rob Church
Rob Church wrote:
You seem to be calling addQuotes() as if it were global. You need to call it as a member function of the database class, which it is.
You'll see either $dbw or $dbr defined around the problematic code block; this is a database object. Use (alter as appropriate):
$dbr->addQuotes( blah blah );
Okay, I think I'm starting to get it... Thanks.
The code I'm using as a base (that works in 1.8.2) isn't written *at all* like that. The original extension, that lives at http:// meta.wikimedia.org/wiki/User:Alxndr/RSS, is admittedly progress on a series of hacks to bend RSS into MediaWiki. I guess I'm about to significantly increase my headspace here as I figure out a better way of doing this ;)
Steve
mediawiki-l@lists.wikimedia.org