[wp-trac] [WordPress Trac] #21663: Use PDO for MySQL queries when PDO is available
WordPress Trac
noreply at wordpress.org
Fri Jan 18 13:53:46 UTC 2013
#21663: Use PDO for MySQL queries when PDO is available
--------------------------------------------------+------------------
Reporter: scottconnerly | Owner:
Type: task (blessed) | Status: new
Priority: normal | Milestone: 3.6
Component: Database | Version: 3.5
Severity: normal | Resolution:
Keywords: dev-feedback has-patch needs-testing |
--------------------------------------------------+------------------
Comment (by Otto42):
Replying to [comment:59 bpetty]:
> To be perfectly clear, what I'm saying is that the patch needs to not
default to PDO first if it's available *unless* the version of PHP being
used is 5.5 or above, and in cases of PHP 5.4 and below, it should default
to using the existing mysql extension it's using right now. In doing so,
we give plugin authors who did incorrectly use raw mysql calls a chance of
fixing their plugin before it breaks on every WordPress installation the
second everyone upgrades to 3.6, and it also gives users of those plugins
the time to perform their plugin updates appropriately as well.
I agree with the idea, but disagree with the approach.
Plugins using mysql_* functions basically are relying on the mysql_connect
and mysql_select_db functions having been called to set up that initial
connection for them to use. It would be possible to call both of those in
PHP < 5.5 installs, just to set up the connection for plugins, and then to
continue on using the newer methods, if available, for the speed
improvements.
For the people who argue that making a connection which is then unused is
rather stupid, I agree. But it would both maintain backward compatibility
and give the performance boost. And, we could wrap this extra connection
in a define or some such to allow power-users to turn it off manually via
their wp-config.
If you want to take this idea further and somehow detect when mysql_*
functions are being used and do the connection on the fly somehow, then
feel free to think about that. But for a first draft, just adding a couple
of extra old mysql calls is enough for backward compat, I believe.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21663#comment:61>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list