Some problems after 1.17 / 1.18: DatabaseFunctions.php and addMessage()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Some problems after 1.17 / 1.18: DatabaseFunctions.php and addMessage()

Eric K-2
There's two issues I'm having after upgrading from 1.16.5 to 1.18.0:


1. Some people (including me) had included "DatabaseFunctions.php" in their extensions, for example by doing:
include_once './extensions/DatabaseFunctions.php';


1.17 took that file out (file: History):
=== Configuration changes in 1.17 ===
* DatabaseFunctions.php that was needed for compatibility with pre-1.3  extensions has been removed.

I was using the database functions for example:
$my_query = wfQuery($this_query, DB_WRITE);

I can fix that temporarily by copying that file and using it but I want to work with whatever is "new" now so I dont use any old methods.


2. I'm also getting this in a few extensions:
Fatal error: Call to a member function addMessage() on a non-object in  [...]/extensions/MetaDescriptionTag.php on line 72

That function is being used like this: $wgMessageCache->addMessage

Anyone know any workarounds? I'm going to work on it in any case in the next few days and will report back if I'm successful.
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Some problems after 1.17 / 1.18: DatabaseFunctions.php and addMessage()

Daniel Friesen-4
On Sun, 04 Dec 2011 20:03:38 -0800, Eric K <[hidden email]> wrote:

> There's two issues I'm having after upgrading from 1.16.5 to 1.18.0:
>
>
> 1. Some people (including me) had included "DatabaseFunctions.php" in  
> their extensions, for example by doing:
> include_once './extensions/DatabaseFunctions.php';
>
>
> 1.17 took that file out (file: History):
> === Configuration changes in 1.17 ===
> * DatabaseFunctions.php that was needed for compatibility with pre-1.3  
> extensions has been removed.
>
> I was using the database functions for example:
> $my_query = wfQuery($this_query, DB_WRITE);
Grab the master database for writes with $dbw = wfGetDB( DB_MASTER );
You 'can' do a query on that using $dbw->query( $this_query );
However I DO NOT recommend you just start throwing raw sql. Continuing  
that pattern is a bad one that won't match the standards that other  
extensions live up to. Introducing sql injection vulnerabilities will be  
easier, and
I recommend you change your code to make use of the abstract ->select,  
->update, ->insert, etc... methods.


> I can fix that temporarily by copying that file and using it but I want  
> to work with whatever is "new" now so I dont use any old methods.
>
>
> 2. I'm also getting this in a few extensions:
> Fatal error: Call to a member function addMessage() on a non-object in  
> [...]/extensions/MetaDescriptionTag.php on line 72
>
> That function is being used like this: $wgMessageCache->addMessage
>
> Anyone know any workarounds? I'm going to work on it in any case in the  
> next few days and will report back if I'm successful.
Move your i18n messages to an .i18n.php file and add it to  
$wgExtensionMessagesFiles.


--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Some problems after 1.17 / 1.18: DatabaseFunctions.php and addMessage()

Eric K-2
Thanks for the suggestion! I am now looking into the bundled extension Renameuser and following its methods, like:
$res = $dbw->select( $table ...





________________________________
 From: Daniel Friesen <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: Monday, December 5, 2011 10:01 AM
Subject: Re: [Mediawiki-l] Some problems after 1.17 / 1.18: DatabaseFunctions.php and addMessage()
 
On Sun, 04 Dec 2011 20:03:38 -0800, Eric K <[hidden email]> wrote:

> There's two issues I'm having after upgrading from 1.16.5 to 1.18.0:
>
>
> 1. Some people (including me) had included "DatabaseFunctions.php" in 
> their extensions, for example by doing:
> include_once './extensions/DatabaseFunctions.php';
>
>
> 1.17 took that file out (file: History):
> === Configuration changes in 1.17 ===
> * DatabaseFunctions.php that was needed for compatibility with pre-1.3 
> extensions has been removed.
>
> I was using the database functions for example:
> $my_query = wfQuery($this_query, DB_WRITE);
Grab the master database for writes with $dbw = wfGetDB( DB_MASTER );
You 'can' do a query on that using $dbw->query( $this_query );
However I DO NOT recommend you just start throwing raw sql. Continuing 
that pattern is a bad one that won't match the standards that other 
extensions live up to. Introducing sql injection vulnerabilities will be 
easier, and
I recommend you change your code to make use of the abstract ->select, 
->update, ->insert, etc... methods.


> I can fix that temporarily by copying that file and using it but I want 
> to work with whatever is "new" now so I dont use any old methods.
>
>
> 2. I'm also getting this in a few extensions:
> Fatal error: Call to a member function addMessage() on a non-object in 
> [...]/extensions/MetaDescriptionTag.php on line 72
>
> That function is being used like this: $wgMessageCache->addMessage
>
> Anyone know any workarounds? I'm going to work on it in any case in the 
> next few days and will report back if I'm successful.
Move your i18n messages to an .i18n.php file and add it to 
$wgExtensionMessagesFiles.


--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l