PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.85
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.85
5.5.85 5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 All 161 releases
← All changes | WPDataAccess/Connection/WPDADB_WPDB.php +15 -18 5.5.35 → 5.5.85 View file →
@@ -1,7 +1,6 @@
1 1 <?php
2 2
3 -// phpcs:ignore Standard.Category.SniffName.ErrorCode
4 3 namespace WPDataAccess\Connection;
5 4
6 5 /**
7 6 * This class extends WodPress class wpdb to enable remote connections and connections to local databases.
@@ -116,8 +115,9 @@
116 115 *
117 116 * @return bool
118 117 */
119 118 public function db_connect( $allow_bail = false ) {
119 + // phpcs:disable -- skip all mysqli messages
120 120 $this->is_mysql = true;
121 121 $client_flags = ( defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0 );
122 122 /*
123 123 * Set the MySQLi error reporting off because WordPress handles its own.
@@ -132,9 +132,8 @@
132 132 $is_ipv6 = false;
133 133 $host_data = $this->parse_db_host( $this->dbhost );
134 134 if ( $host_data ) {
135 135 list( $host, $port, $socket, $is_ipv6 ) = $host_data;
136 - // phpcs:ignore - 8.1 proof
137 136 }
138 137 /*
139 138 * If using the `mysqlnd` library, the IPv6 address needs to be enclosed
140 139 * in square brackets, whereas it doesn't while using the `libmysqlclient` library.
@@ -144,9 +143,8 @@
144 143 $host = "[{$host}]";
145 144 }
146 145 if ( 'on' === $this->ssl ) {
147 146 mysqli_ssl_set(
148 - // phpcs:ignore
149 147 $this->dbh,
150 148 $this->ssl_key,
151 149 $this->ssl_cert,
152 150 $this->ssl_ca,
@@ -154,9 +152,8 @@
154 152 $this->ssl_cipher
155 153 );
156 154 }
157 155 mysqli_report( MYSQLI_REPORT_STRICT );
158 - // phpcs:ignore
159 156 try {
160 157 if ( WP_DEBUG ) {
161 158 if ( !mysqli_real_connect(
162 159 $this->dbh,
@@ -167,15 +164,12 @@
167 164 $port,
168 165 $socket,
169 166 $client_flags
170 167 ) ) {
171 - // phpcs:ignore
172 168 mysqli_report( MYSQLI_REPORT_OFF );
173 - // phpcs:ignore
174 169 return false;
175 170 }
176 171 } else {
177 - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
178 172 if ( !@mysqli_real_connect(
179 173 $this->dbh,
180 174 $host,
181 175 $this->dbuser,
@@ -184,21 +178,17 @@
184 178 $port,
185 179 $socket,
186 180 $client_flags
187 181 ) ) {
188 - // phpcs:ignore
189 182 mysqli_report( MYSQLI_REPORT_OFF );
190 - // phpcs:ignore
191 183 return false;
192 184 }
193 185 }
194 186 } catch ( \mysqli_sql_exception $e ) {
195 187 mysqli_report( MYSQLI_REPORT_OFF );
196 - // phpcs:ignore
197 188 return false;
198 189 }
199 190 mysqli_report( MYSQLI_REPORT_OFF );
200 - // phpcs:ignore
201 191 if ( $this->dbh->connect_errno ) {
202 192 $this->dbh = null;
203 193 /*
204 194 * It's possible ext/mysqli is misconfigured. Fall back to ext/mysql if:
@@ -225,26 +215,27 @@
225 215 if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
226 216 require_once WP_CONTENT_DIR . '/db-error.php';
227 217 die;
228 218 }
229 - $message = '<h1>' . __( 'Error establishing a database connection' ) . "</h1>\n";
219 + $message = '<h1>' . __( 'Error establishing a database connection', 'wp-data-access' ) . "</h1>\n";
230 220 $message .= '<p>' . sprintf(
231 221 /* translators: 1: wp-config.php, 2: Database host. */
232 - __( 'This either means that the username and password information in your %1$s file is incorrect or we can&#8217;t contact the database server at %2$s. This could mean your host&#8217;s database server is down.' ),
222 + __( 'This either means that the username and password information in your %1$s file is incorrect or we can&#8217;t contact the database server at %2$s. This could mean your host&#8217;s database server is down.', 'wp-data-access' ),
233 223 '<code>wp-config.php</code>',
234 224 '<code>' . htmlspecialchars( $this->dbhost, ENT_QUOTES ) . '</code>'
235 225 ) . "</p>\n";
236 226 $message .= "<ul>\n";
237 - $message .= '<li>' . __( 'Are you sure you have the correct username and password?' ) . "</li>\n";
238 - $message .= '<li>' . __( 'Are you sure you have typed the correct hostname?' ) . "</li>\n";
239 - $message .= '<li>' . __( 'Are you sure the database server is running?' ) . "</li>\n";
227 + $message .= '<li>' . __( 'Are you sure you have the correct username and password?', 'wp-data-access' ) . "</li>\n";
228 + $message .= '<li>' . __( 'Are you sure you have typed the correct hostname?', 'wp-data-access' ) . "</li>\n";
229 + $message .= '<li>' . __( 'Are you sure the database server is running?', 'wp-data-access' ) . "</li>\n";
240 230 $message .= "</ul>\n";
241 231 $message .= '<p>' . sprintf(
242 232 /* translators: %s: Support forums URL. */
243 - __( 'If you&#8217;re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress Support Forums</a>.' ),
244 - __( 'https://wordpress.org/support/forums/' )
233 + __( 'If you&#8217;re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress Support Forums</a>.', 'wp-data-access' ),
234 + __( 'https://wordpress.org/support/forums/', 'wp-data-access' )
245 235 ) . "</p>\n";
246 236 $this->bail( $message, 'db_connect_fail' );
237 + // phpcs:enable
247 238 return false;
248 239 } elseif ( $this->dbh ) {
249 240 if ( !$this->has_connected ) {
250 241 $this->init_charset();
@@ -253,10 +244,12 @@
253 244 $this->set_charset( $this->dbh );
254 245 $this->ready = true;
255 246 $this->set_sql_mode();
256 247 $this->select( $this->dbname, $this->dbh );
248 + // phpcs:enable
257 249 return true;
258 250 }
251 + // phpcs:enable
259 252 return false;
260 253 }
261 254
262 255 /**
@@ -281,9 +274,11 @@
281 274 if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
282 275 $this->timer_start();
283 276 }
284 277 if ( !empty( $this->dbh ) && $this->use_mysqli ) {
278 + // phpcs:disable
285 279 $this->result = mysqli_query( $this->dbh, $query );
280 + // phpcs:enable
286 281 }
287 282 $this->num_queries++;
288 283 if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
289 284 $this->log_query(
@@ -297,9 +292,11 @@
297 292 }
298 293
299 294 public function wpda_fetch_from_cursor() {
300 295 if ( $this->use_mysqli && 'mysqli_result' === get_class( $this->result ) ) {
296 + // phpcs:disable
301 297 return mysqli_fetch_object( $this->result );
298 + // phpcs:enable
302 299 }
303 300 return null;
304 301 }
305 302