Plugin Directory

Changeset 1597438


Ignore:
Timestamp:
02/16/2017 05:11:10 PM (9 years ago)
Author:
newsplugin.com
Message:

Support mysqli and with it, PHP 7.0. Using getters on wpdb, hopefully they'll stay.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • newsplugin/trunk/news-plugin-utils.php

    r1559531 r1597438  
    218218    }
    219219
     220    static function get_system_db_info() {
     221        global $wpdb; /* Recommended by https://codex.wordpress.org/Class_Reference/wpdb */
     222
     223        if(!empty($wpdb->use_mysqli)) {
     224            /* See also http://fw2s.com/how-to-get-complete-mysql-version-in-wordpress/
     225               Note: use_mysqli is private and dbh is protected, BUT wpdb class is allowing
     226               to access then through getters and setters anyway. Backward compatibility.
     227             */
     228            return(array(
     229                    'mysql_method'          => 'mysqli',
     230                    'mysql_server_info'     => mysqli_get_server_info($wpdb->dbh),
     231                    'mysql_client_info'     => mysqli_get_client_info($wpdb->dbh),
     232                    'mysql_proto_info'      => mysqli_get_proto_info($wpdb->dbh),
     233                ));
     234        } else {
     235            return(array(
     236                    'mysql_method'          => 'mysql',
     237                    'mysql_server_info'     => mysql_get_server_info(),
     238                    'mysql_client_info'     => mysql_get_client_info(),
     239                    'mysql_proto_info'      => mysql_get_proto_info(),
     240                ));
     241        }
     242    }
     243
    220244    static function get_system_info() {
    221245        $my_theme = wp_get_theme();
     
    237261          $curl_status = 'Disabled';
    238262        }
     263
     264        $db_info = self::get_system_db_info();
    239265
    240266        $system_info = array(
     
    262288                'memory_limit'          => ini_get('memory_limit'),
    263289                'execution_time'        => ini_get('max_execution_time'),
    264                 'mysql_server_info'     => mysql_get_server_info(),
    265                 'mysql_client_info'     => mysql_get_client_info(),
    266                 'mysql_proto_info'      => mysql_get_proto_info(),
     290                'mysql_method'          => $db_info['mysql_method'],
     291                'mysql_server_info'     => $db_info['mysql_server_info'],
     292                'mysql_client_info'     => $db_info['mysql_client_info'],
     293                'mysql_proto_info'      => $db_info['mysql_proto_info'],
    267294                'is_Curl'               => $curl_status,
    268295                'curl_version'          => $curl_ver['version'],
Note: See TracChangeset for help on using the changeset viewer.