Make WordPress Core

Opened 12 years ago

Closed 10 years ago

#16758 closed enhancement (wontfix)

PHP5-port - move of wpdb::check_database_version()

Reported by: hakre's profile hakre Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch
Focuses: Cc:


The function wpdb::check_database_version() is doing a check of the database version against a needed database version. The database server version is returned from $this->db_version(), the required database version is in a global variable called $required_mysql_version.

This keeps the database code coupled to the global variable while the class is made to be replaced, e.g. for other database abstractions (compare #14508 which is made for extends wpdb). Normally the database class is a singleton in a global variable already.

Therefore this mixes global with local space twice. I suggest to de-couple wpdb a bit from that hardencoded global variable name and move the code out of the wpdb class into that alread existing global function called wp_check_mysql_version().

This should make the database interface a bit more lightweight which could be a benefit when porting to PHP5.

Attachments (2)

16758.patch (1.7 KB) - added by hakre 12 years ago.
16758.2.patch (1.5 KB) - added by hakre 12 years ago.
with _deprecated_function() call#

Download all attachments as: .zip

Change History (3)

12 years ago

12 years ago

with _deprecated_function() call#

#1 @dd32
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The suggested change here would cause DB dropins compatibility issues.

For example, currently a DB dropin can replace the wpdb::check_database_version() method with a check for >= 1.0 (If that's the version of the server they require) and ignore the global $required_mysql_version.
With this change, a DB Dropin would have to make sure it returned a MySQL version number >= $required_mysql_version in order to work, which would be a step backwards in becoming DB agnostic.

I don't really see a problem with $wpdb relying on the global, When wpdb is used stand alone, the method wouldn't be used either.

Note: See TracTickets for help on using tickets.