PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
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 5.5.42 All 160 releases
← All changes | WPDataAccess/Connection/WPDADB.php +23 -4 5.5.225.5.84 View file →
@@ -1,5 +1,5 @@
1 -<?php // phpcs:ignore Standard.Category.SniffName.ErrorCode
1 +<?php
2 2 /**
3 3 * Suppress "error - 0 - No summary was found for this file" on phpdoc generation
4 4 *
5 5 * @package WPDataAccess\Connection
@@ -254,9 +254,28 @@
254 254 return true;
255 255 }
256 256 }
257 257
258 - /**
258 + /**
259 + * Disable remote database connection
260 + *
261 + * @param string $database Remote database connection name.
262 + * @return bool
263 + */
264 + public static function dis_remote_database( $database, $disabled ) {
265 + self::load_remote_databases();
266 +
267 + if ( false === self::get_remote_database( $database, true ) ) {
268 + return false;
269 + } else {
270 + self::$remote_databases[ $database ]['disabled'] = $disabled;
271 + self::save_remote_databases();
272 +
273 + return true;
274 + }
275 + }
276 +
277 + /**
259 278 * Update remote connection
260 279 *
261 280 * @param string $database Database name.
262 281 * @param string $host Host name.
@@ -346,9 +365,9 @@
346 365 * @return mixed|\wpdb
347 366 */
348 367 public static function get_db_connection( $schema_name ) {
349 368 global $wpdb;
350 - if ( 'rdb:' === substr( $schema_name, 0, 4 ) ) {
369 + if ( 'rdb:' === substr( (string) $schema_name, 0, 4 ) ) {
351 370 // Remote database (other ip|port).
352 371 self::load_remote_databases();
353 372 if ( ! isset( self::$db_connections[ $schema_name ] ) ) {
354 373 if (
@@ -417,9 +436,9 @@
417 436 */
418 437 public static function iswpdb( $schema_name ) {
419 438 global $wpdb;
420 439 if ( null === self::$lower_case_table_names ) {
421 - $lower_case_table_names = $wpdb->get_results( "SHOW VARIABLES LIKE 'lower_case_table_names'", 'ARRAY_N' ); // db call ok; no-cache ok.
440 + $lower_case_table_names = $wpdb->get_results( "SHOW VARIABLES LIKE 'lower_case_table_names'", 'ARRAY_N' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
422 441 if ( is_array( $lower_case_table_names ) && isset( $lower_case_table_names[0][1] ) ) {
423 442 self::$lower_case_table_names = $lower_case_table_names[0][1];
424 443 } else {
425 444 self::$lower_case_table_names = 0;