| 1 | Index: wp-includes/wp-db.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/wp-db.php (revision 10840) |
|---|
| 4 | +++ wp-includes/wp-db.php (working copy) |
|---|
| 5 | @@ -323,8 +323,12 @@ |
|---|
| 6 | |
|---|
| 7 | if ( defined('DB_COLLATE') ) |
|---|
| 8 | $this->collate = DB_COLLATE; |
|---|
| 9 | - |
|---|
| 10 | + /** MYSQL **/ |
|---|
| 11 | + /** mysqli |
|---|
| 12 | + $this->dbh = @mysqli_connect($dbhost, $dbuser, $dbpassword); |
|---|
| 13 | + **/ |
|---|
| 14 | $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true); |
|---|
| 15 | + /** /MYSQL **/ |
|---|
| 16 | if (!$this->dbh) { |
|---|
| 17 | $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/" |
|---|
| 18 | <h1>Error establishing a database connection</h1> |
|---|
| 19 | @@ -343,8 +347,14 @@ |
|---|
| 20 | |
|---|
| 21 | if ( $this->has_cap( 'collation' ) ) { |
|---|
| 22 | if ( !empty($this->charset) ) { |
|---|
| 23 | + /** MYSQL **/ |
|---|
| 24 | + /** mysqli |
|---|
| 25 | + if ( function_exists('mysqli_set_charset') ) { |
|---|
| 26 | + mysqli_set_charset($this->dbh, $this->charset); |
|---|
| 27 | + **/ |
|---|
| 28 | if ( function_exists('mysql_set_charset') ) { |
|---|
| 29 | mysql_set_charset($this->charset, $this->dbh); |
|---|
| 30 | + /** /MYSQL **/ |
|---|
| 31 | $this->real_escape = true; |
|---|
| 32 | } else { |
|---|
| 33 | $collation_query = "SET NAMES '{$this->charset}'"; |
|---|
| 34 | @@ -412,7 +422,12 @@ |
|---|
| 35 | * @return null Always null. |
|---|
| 36 | */ |
|---|
| 37 | function select($db) { |
|---|
| 38 | + /** MYSQL **/ |
|---|
| 39 | + /** mysqli |
|---|
| 40 | + if (!@mysqli_select_db($this->dbh, $db)) { |
|---|
| 41 | + **/ |
|---|
| 42 | if (!@mysql_select_db($db, $this->dbh)) { |
|---|
| 43 | + /** /MYSQL **/ |
|---|
| 44 | $this->ready = false; |
|---|
| 45 | $this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/' |
|---|
| 46 | <h1>Can’t select database</h1> |
|---|
| 47 | @@ -433,7 +448,12 @@ |
|---|
| 48 | |
|---|
| 49 | function _real_escape($string) { |
|---|
| 50 | if ( $this->dbh && $this->real_escape ) |
|---|
| 51 | + /** MYSQL **/ |
|---|
| 52 | + /** mysqli |
|---|
| 53 | + return mysqli_real_escape_string( $this->dbh, $string ); |
|---|
| 54 | + **/ |
|---|
| 55 | return mysql_real_escape_string( $string, $this->dbh ); |
|---|
| 56 | + /** /MYSQL **/ |
|---|
| 57 | else |
|---|
| 58 | return addslashes( $string ); |
|---|
| 59 | } |
|---|
| 60 | @@ -524,7 +544,12 @@ |
|---|
| 61 | function print_error($str = '') { |
|---|
| 62 | global $EZSQL_ERROR; |
|---|
| 63 | |
|---|
| 64 | + /** MYSQL **/ |
|---|
| 65 | + /** mysqli |
|---|
| 66 | + if (!$str) $str = mysqli_error($this->dbh); |
|---|
| 67 | + **/ |
|---|
| 68 | if (!$str) $str = mysql_error($this->dbh); |
|---|
| 69 | + /** /MYSQL **/ |
|---|
| 70 | $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str); |
|---|
| 71 | |
|---|
| 72 | if ( $this->suppress_errors ) |
|---|
| 73 | @@ -648,39 +673,75 @@ |
|---|
| 74 | if ( defined('SAVEQUERIES') && SAVEQUERIES ) |
|---|
| 75 | $this->timer_start(); |
|---|
| 76 | |
|---|
| 77 | + /** MYSQL **/ |
|---|
| 78 | + /** mysqli |
|---|
| 79 | + $this->result = @mysqli_query($this->dbh, $query); |
|---|
| 80 | + **/ |
|---|
| 81 | $this->result = @mysql_query($query, $this->dbh); |
|---|
| 82 | + /** /MYSQL **/ |
|---|
| 83 | ++$this->num_queries; |
|---|
| 84 | |
|---|
| 85 | if ( defined('SAVEQUERIES') && SAVEQUERIES ) |
|---|
| 86 | $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() ); |
|---|
| 87 | |
|---|
| 88 | // If there is an error then take note of it.. |
|---|
| 89 | + /** MYSQL **/ |
|---|
| 90 | + /** mysqli |
|---|
| 91 | + if ( $this->last_error = mysqli_error($this->dbh) ) { |
|---|
| 92 | + **/ |
|---|
| 93 | if ( $this->last_error = mysql_error($this->dbh) ) { |
|---|
| 94 | + /** /MYSQL **/ |
|---|
| 95 | $this->print_error(); |
|---|
| 96 | return false; |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | if ( preg_match("/^\\s*(insert|delete|update|replace|alter) /i",$query) ) { |
|---|
| 100 | + /** MYSQL **/ |
|---|
| 101 | + /** mysqli |
|---|
| 102 | + $this->rows_affected = mysqli_affected_rows($this->dbh); |
|---|
| 103 | + **/ |
|---|
| 104 | $this->rows_affected = mysql_affected_rows($this->dbh); |
|---|
| 105 | + /** /MYSQL **/ |
|---|
| 106 | // Take note of the insert_id |
|---|
| 107 | if ( preg_match("/^\\s*(insert|replace) /i",$query) ) { |
|---|
| 108 | + /** MYSQL **/ |
|---|
| 109 | + /** mysqli |
|---|
| 110 | + $this->insert_id = mysqli_insert_id($this->dbh); |
|---|
| 111 | + **/ |
|---|
| 112 | $this->insert_id = mysql_insert_id($this->dbh); |
|---|
| 113 | + /** /MYSQL **/ |
|---|
| 114 | } |
|---|
| 115 | // Return number of rows affected |
|---|
| 116 | $return_val = $this->rows_affected; |
|---|
| 117 | } else { |
|---|
| 118 | $i = 0; |
|---|
| 119 | + /** MYSQL **/ |
|---|
| 120 | + /** mysqli |
|---|
| 121 | + while ($i < @mysqli_num_fields($this->result)) { |
|---|
| 122 | + $this->col_info[$i] = @mysqli_fetch_field($this->result); |
|---|
| 123 | + **/ |
|---|
| 124 | while ($i < @mysql_num_fields($this->result)) { |
|---|
| 125 | $this->col_info[$i] = @mysql_fetch_field($this->result); |
|---|
| 126 | + /** /MYSQL **/ |
|---|
| 127 | $i++; |
|---|
| 128 | } |
|---|
| 129 | $num_rows = 0; |
|---|
| 130 | + /** MYSQL **/ |
|---|
| 131 | + /** mysqli |
|---|
| 132 | + while ( $row = @mysqli_fetch_object($this->result) ) { |
|---|
| 133 | + **/ |
|---|
| 134 | while ( $row = @mysql_fetch_object($this->result) ) { |
|---|
| 135 | + /** /MYSQL **/ |
|---|
| 136 | $this->last_result[$num_rows] = $row; |
|---|
| 137 | $num_rows++; |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | + /** MYSQL **/ |
|---|
| 141 | + /** mysqli |
|---|
| 142 | + @mysqli_free_result($this->result); |
|---|
| 143 | + **/ |
|---|
| 144 | @mysql_free_result($this->result); |
|---|
| 145 | + /** /MYSQL **/ |
|---|
| 146 | |
|---|
| 147 | // Log number of rows the query returned |
|---|
| 148 | $this->num_rows = $num_rows; |
|---|
| 149 | @@ -1056,7 +1117,12 @@ |
|---|
| 150 | * @return false|string false on failure, version number on success |
|---|
| 151 | */ |
|---|
| 152 | function db_version() { |
|---|
| 153 | + /** MYSQL **/ |
|---|
| 154 | + /** mysqli |
|---|
| 155 | + return preg_replace('/[^0-9.].*/', '', mysqli_get_server_info( $this->dbh )); |
|---|
| 156 | + **/ |
|---|
| 157 | return preg_replace('/[^0-9.].*/', '', mysql_get_server_info( $this->dbh )); |
|---|
| 158 | + /** /MYSQL **/ |
|---|
| 159 | } |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | Index: wp-settings.php |
|---|
| 163 | =================================================================== |
|---|
| 164 | --- wp-settings.php (revision 10840) |
|---|
| 165 | +++ wp-settings.php (working copy) |
|---|
| 166 | @@ -15,7 +15,14 @@ |
|---|
| 167 | if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) |
|---|
| 168 | @ini_set('memory_limit', WP_MEMORY_LIMIT); |
|---|
| 169 | |
|---|
| 170 | +/** PHP **/ |
|---|
| 171 | +/** >4.4.9 |
|---|
| 172 | +**/ |
|---|
| 173 | +/** <=5.2.9 |
|---|
| 174 | set_magic_quotes_runtime(0); |
|---|
| 175 | +**/ |
|---|
| 176 | +set_magic_quotes_runtime(0); |
|---|
| 177 | +/** /PHP **/ |
|---|
| 178 | @ini_set('magic_quotes_sybase', 0); |
|---|
| 179 | |
|---|
| 180 | /** |
|---|
| 181 | @@ -140,7 +147,12 @@ |
|---|
| 182 | } |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | +/** MYSQL **/ |
|---|
| 186 | +/** mysqli |
|---|
| 187 | +if ( !extension_loaded('mysqli') && !file_exists(WP_CONTENT_DIR . '/db.php') ) |
|---|
| 188 | +**/ |
|---|
| 189 | if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) |
|---|
| 190 | +/** /MYSQL **/ |
|---|
| 191 | die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); |
|---|
| 192 | |
|---|
| 193 | /** |
|---|
| 194 | @@ -565,7 +577,15 @@ |
|---|
| 195 | * @global object $wp_the_query |
|---|
| 196 | * @since 2.0.0 |
|---|
| 197 | */ |
|---|
| 198 | +/** PHP **/ |
|---|
| 199 | +/** <5.0.0 |
|---|
| 200 | $wp_the_query =& new WP_Query(); |
|---|
| 201 | +**/ |
|---|
| 202 | +/** >4.4.9 |
|---|
| 203 | +$wp_the_query = new WP_Query(); |
|---|
| 204 | +**/ |
|---|
| 205 | +$wp_the_query =& new WP_Query(); |
|---|
| 206 | +/** /PHP **/ |
|---|
| 207 | |
|---|
| 208 | /** |
|---|
| 209 | * Holds the reference to @see $wp_the_query |
|---|
| 210 | @@ -580,21 +600,45 @@ |
|---|
| 211 | * @global object $wp_rewrite |
|---|
| 212 | * @since 1.5.0 |
|---|
| 213 | */ |
|---|
| 214 | +/** PHP **/ |
|---|
| 215 | +/** <5.0.0 |
|---|
| 216 | $wp_rewrite =& new WP_Rewrite(); |
|---|
| 217 | +**/ |
|---|
| 218 | +/** >4.4.9 |
|---|
| 219 | +$wp_rewrite = new WP_Rewrite(); |
|---|
| 220 | +**/ |
|---|
| 221 | +$wp_rewrite =& new WP_Rewrite(); |
|---|
| 222 | +/** /PHP **/ |
|---|
| 223 | |
|---|
| 224 | /** |
|---|
| 225 | * WordPress Object |
|---|
| 226 | * @global object $wp |
|---|
| 227 | * @since 2.0.0 |
|---|
| 228 | */ |
|---|
| 229 | +/** PHP **/ |
|---|
| 230 | +/** <5.0.0 |
|---|
| 231 | $wp =& new WP(); |
|---|
| 232 | +**/ |
|---|
| 233 | +/** >4.4.9 |
|---|
| 234 | +$wp = new WP(); |
|---|
| 235 | +**/ |
|---|
| 236 | +$wp =& new WP(); |
|---|
| 237 | +/** /PHP **/ |
|---|
| 238 | |
|---|
| 239 | /** |
|---|
| 240 | * WordPress Widget Factory Object |
|---|
| 241 | * @global object $wp_widget_factory |
|---|
| 242 | * @since 2.8.0 |
|---|
| 243 | */ |
|---|
| 244 | +/** PHP **/ |
|---|
| 245 | +/** <5.0.0 |
|---|
| 246 | $wp_widget_factory =& new WP_Widget_Factory(); |
|---|
| 247 | +**/ |
|---|
| 248 | +/** >4.4.9 |
|---|
| 249 | +$wp_widget_factory = new WP_Widget_Factory(); |
|---|
| 250 | +**/ |
|---|
| 251 | +$wp_widget_factory =& new WP_Widget_Factory(); |
|---|
| 252 | +/** /PHP **/ |
|---|
| 253 | |
|---|
| 254 | do_action('setup_theme'); |
|---|
| 255 | |
|---|
| 256 | @@ -630,7 +674,15 @@ |
|---|
| 257 | * @global object $wp_locale |
|---|
| 258 | * @since 2.1.0 |
|---|
| 259 | */ |
|---|
| 260 | +/** PHP **/ |
|---|
| 261 | +/** <5.0.0 |
|---|
| 262 | $wp_locale =& new WP_Locale(); |
|---|
| 263 | +**/ |
|---|
| 264 | +/** >4.4.9 |
|---|
| 265 | +$wp_locale = new WP_Locale(); |
|---|
| 266 | +**/ |
|---|
| 267 | +$wp_locale =& new WP_Locale(); |
|---|
| 268 | +/** /PHP **/ |
|---|
| 269 | |
|---|
| 270 | // Load functions for active theme. |
|---|
| 271 | if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) |
|---|
| 272 | Index: wp-admin/install.php |
|---|
| 273 | =================================================================== |
|---|
| 274 | --- wp-admin/install.php (revision 10840) |
|---|
| 275 | +++ wp-admin/install.php (working copy) |
|---|
| 276 | @@ -14,6 +14,9 @@ |
|---|
| 277 | */ |
|---|
| 278 | define('WP_INSTALLING', true); |
|---|
| 279 | |
|---|
| 280 | +/** Do version adjustments */ |
|---|
| 281 | +require_once('wp-adjust.php'); |
|---|
| 282 | + |
|---|
| 283 | /** Load WordPress Bootstrap */ |
|---|
| 284 | require_once('../wp-load.php'); |
|---|
| 285 | |
|---|