mysqli

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

mysqli

adrian-27
Hello,

Quick question.  I have checked the FAQ and the documentation.  Why
doesn't mediawiki use mysqli?  It's actually not that hard to switch
from using mysql to mysqli.  Also, mysqli supports a few nice things.

thanks,

adrian

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

Re: mysqli

Sylvain Machefert
Hi !
I don't know mysqli, but a quick look at php doc (
http://www.php.net/mysqli) says :

In order to have these functions available, you must compile PHP with
support for the mysqli extension.

Note: The mysqli extension is designed to work with the version 4.1.3 or
above of MySQL. For previous versions, please see the MySQL extension
documentation.

MediaWiki can work with older version of MySQL, and does not need to
(re-)compile PHP, because we often can't do that (shared hosting...).


2006/3/2, adrian <[hidden email]>:

>
> Hello,
>
> Quick question.  I have checked the FAQ and the documentation.  Why
> doesn't mediawiki use mysqli?  It's actually not that hard to switch
> from using mysql to mysqli.  Also, mysqli supports a few nice things.
>
> thanks,
>
> adrian
>

--
Sylvain Machefert
http://iubito.free.fr
http://tousauxbalkans.free.fr
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: mysqli

Brion Vibber
In reply to this post by adrian-27
adrian wrote:
> Quick question.  I have checked the FAQ and the documentation.  Why
> doesn't mediawiki use mysqli?

Why would it?

> It's actually not that hard to switch
> from using mysql to mysqli.  Also, mysqli supports a few nice things.

Like what?

-- brion vibber (brion @ pobox.com)


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

signature.asc (257 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Permission-Specific Content.

Graeme Worthy
Here's a litte howto I wrote but I'd like some feedback on it.
I'm not sure if exposing the user object like this presents a big  
hole, and i should instead try a different way of presenting these  
variables?

Any thoughts?

-----------------------------------------------------------
= Adding user permissions-specific content in mediawiki. =
-----------------------------------------------------------


The way that templates are used in media wiki does not automatically  
enable user-permission-modifiable content to be specified in the  
template.

you have to let it access the user object.

in the default template, after

function execute( ){

add

global $wgUser;

and all of a sudden you have access to all the properties.

so now you can do fun stuff like


     <?php if (!$wgUser->isAllowed('edit') ): ?>

     [the edit controls]

     <?php endif ?>


     <?php if ( $wgUser->isAnon() ): ?>

     anonymous users prohibited from viewing this page

     <?php else ?>

     [the page]

     <?php endif; ?>

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

Re: mysqli

adrian-27
In reply to this post by adrian-27
> > Quick question.  I have checked the FAQ and the documentation.  Why
> > doesn't mediawiki use mysqli?
>
> Why would it?

Hello Brion,

Well, as Sylvain said, there are a few reasons NOT to support mysqli.
Like, for instance, the mysql package is installed by default and the
mysqli package is currently not installed by default.  I'll admit,
right now that's a very good reason to refrain from making it the
default method.

The first reason TO use mysqli that you might care about (which was told
to me by someone on #MediaWiki) is that mysqli_stmt is much faster and
much more secure than mysql_query (you don't need to escape the inputs
to mysqli_stmt).  The API is supposedly better, but they seem equally
simple to me.

The only reason *I* would like to see mysqli supported (even if it was
not the default method) would be so we could use mysqli_embedded.
mysqli_embedded allows people to use MediaWiki in standalone
applications much easier.  In fact, it would allow people to use
MediaWiki without significant change in a wikipedia-on-dvd type
situation.

thanks for your time,

adrian

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

Re: mysqli

Domas Mituzas
Adrian,

> The first reason TO use mysqli that you might care about (which was  
> told
> to me by someone on #MediaWiki) is that mysqli_stmt is much faster and
> much more secure than mysql_query (you don't need to escape the inputs
> to mysqli_stmt).  The API is supposedly better, but they seem equally
> simple to me.

There are multiple issues with prepared statements.
First of all, we do lots of query building anyway, where we may hit  
multiple different queries.
We would still have to prepare multiple statements even for same  
tasks (counts of arguments are different, different nested options,  
yadda yadda).
Usually if we can aggregate multiple similar queries into single one,  
we do.

You would not get too much efficiency if you would prepare same  
queries, therefore you would have to keep a cache of prepared  
statements.

Another important point to note is that for long running operations  
that issue multiple queries, you have to deallocate statements once  
you won't use it again, otherwise they will accumulate on server (and  
leak memory).

As for security, our query builder solves it all \o/.


> The only reason *I* would like to see mysqli supported (even if it was
> not the default method) would be so we could use mysqli_embedded.
> mysqli_embedded allows people to use MediaWiki in standalone
> applications much easier.  In fact, it would allow people to use
> MediaWiki without significant change in a wikipedia-on-dvd type
> situation.

It's trivial to extend MediaWiki if only thing you wish is DB API  
change. :)

Domas
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l