diff --git a/composer.patches.json b/composer.patches.json index a4c74dc170085b4355d1b014705897bb77464cdc..fafa5cee585ec5960146f04abefd2925de56cbd3 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -18,11 +18,9 @@ }, "wpackagist-plugin/hyperdb": { "A few fixes to the global wpdb_hash instance (moved into wpdb)": "patches/hyperdb/0106-a-few-fixes-to-the-global-wpdb_hash-instance-moved-i.patch", - "Profiling: changing the define AI_DB_PROFILER to true will enable query logging (use with caution!)": "patches/hyperdb/0116-Performance-tweaks.patch", - "Prevent mysql-proxy to cache the admin section": "patches/hyperdb/0117-prevent-mysql-proxy-to-cache-the-admin-section.patch", "Awful workaround (?)": "patches/hyperdb/0126-awful-workaround.patch", "Added optional logging": "patches/hyperdb/0158-Added-optional-logging.patch", - "Adding extreme debugging when wp_debug is true": "patches/hyperdb/0161-adding-extreme-debugging-when-wp_debug-is-true.patch" + "Add support for SHOW TABLES LIKE queries": "patches/hyperdb/show-tables-like.patch" }, "wpackagist-plugin/more-privacy-options": { "Do send mail on privacy setting change": "patches/plugins/more-privacy-options.patch" diff --git a/patches/hyperdb/0116-Performance-tweaks.patch b/patches/hyperdb/0116-Performance-tweaks.patch deleted file mode 100644 index 11546cd9a5876d19b6634882e1087892783809a5..0000000000000000000000000000000000000000 --- a/patches/hyperdb/0116-Performance-tweaks.patch +++ /dev/null @@ -1,49 +0,0 @@ -From b07f1d25505e064dc076ff68ec81bf19c459a3db Mon Sep 17 00:00:00 2001 -From: Joe Oblivian <0blivian@insiberia.net> -Date: Thu, 15 Sep 2011 20:43:47 +0200 -Subject: [PATCH 116/229] Performance tweaks: - -- Cache more aggressively -- Use persistent connections - -Profiling: changing the define AI_DB_PROFILER to true will enable query logging (use with caution!) ---- -diff --git a/wp-content/db.php b/wp-content/db.php -index 18d53a1b..99ff86ed 100644 ---- a/wp-content/db.php -+++ b/wp-content/db.php -@@ -1,4 +1,6 @@ - <?php -+//AI patch: set to true if you want to activate query profiling -+define('AI_DB_PROFILER', false); - - /* - Plugin Name: HyperDB -@@ -1441,6 +1443,23 @@ class hyperdb extends wpdb { - - } // class hyperdb - --$wpdb = new hyperdb(); -+/** -+ * AI custom: Logs all queries for debugging purposes -+ */ -+function ai_log_db_queries($query, $time, $backtrace=null, hyperdb $obj ) { -+ $fh = fopen( ABSPATH . '/profiling/noblogs_queries_'. date('Ymd') . '.log', 'a'); -+ if (!$fh) { -+ return array($query, $time, $backtrace); -+ } -+ fwrite($fh, sprintf("##\n#Date: %s\n#Query time: %s\n%s\n", date('r'), $time, $query)); -+ fclose($fh); -+ return array($query, $time, $backtrace); -+} - -+ -+$wpdb = new hyperdb(); -+if ( AI_DB_PROFILER === true ) { -+ $wpdb->save_queries = true; -+ $wpdb->save_query_callback = 'ai_log_db_queries'; -+} - require( DB_CONFIG_FILE ); --- -2.17.1 - diff --git a/patches/hyperdb/0117-prevent-mysql-proxy-to-cache-the-admin-section.patch b/patches/hyperdb/0117-prevent-mysql-proxy-to-cache-the-admin-section.patch deleted file mode 100644 index 219c6f29bfb3e0eca6837b649f52f38103d1b4d0..0000000000000000000000000000000000000000 --- a/patches/hyperdb/0117-prevent-mysql-proxy-to-cache-the-admin-section.patch +++ /dev/null @@ -1,28 +0,0 @@ -From aeb256f01ca5cf7d9f8aa8e46b821f4a9896aa14 Mon Sep 17 00:00:00 2001 -From: Joe Oblivian <0blivian@insiberia.net> -Date: Sun, 18 Sep 2011 19:52:42 +0200 -Subject: [PATCH 117/229] prevent mysql-proxy to cache the admin section - ---- - wp-content/db.php | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/wp-content/db.php b/wp-content/db.php -index 99ff86ed..79c189e5 100644 ---- a/wp-content/db.php -+++ b/wp-content/db.php -@@ -872,6 +872,11 @@ class hyperdb extends wpdb { - $statement_after_query = $this->run_callbacks( 'statement_after_query' ); - $query_for_log = $query; - -+ // A/I: prevent mysql-proxy to cache the admin section -+ if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/') !== false) { -+ $query .= ' /* NO CACHE */'; -+ } -+ - $this->timer_start(); - if ( $statement_before_query ) { - $query_for_log = "$statement_before_query; $query_for_log"; --- -2.17.1 - diff --git a/patches/hyperdb/0158-Added-optional-logging.patch b/patches/hyperdb/0158-Added-optional-logging.patch index 373d9f1c1acafa59983f518ee1a726febe074c70..33f5df02f75c43f18a44b8c854dc04ecf0a707df 100644 --- a/patches/hyperdb/0158-Added-optional-logging.patch +++ b/patches/hyperdb/0158-Added-optional-logging.patch @@ -11,15 +11,6 @@ diff --git a/wp-content/db.php b/wp-content/db.php index abc3353e..0f9f5a1e 100644 --- a/wp-content/db.php +++ b/wp-content/db.php -@@ -55,7 +55,7 @@ define( 'HYPERDB_SERVER_GONE_ERROR', 2006 ); // MySQL server has gone away - class hyperdb extends wpdb { - - /** -- * A/I patch! -+ * A/I patch! - * store a FlexiHash() instance here. - */ - var $hash_map; @@ -680,16 +680,19 @@ class hyperdb extends wpdb { $success = false; $this->last_connection = compact('dbhname', 'host', 'port', 'user', 'name', 'tcp', 'elapsed', 'success'); @@ -50,26 +41,6 @@ index abc3353e..0f9f5a1e 100644 } if ( ! $success || ! isset( $this->dbhs[$dbhname] ) || ! $this->is_mysql_connection( $this->dbhs[$dbhname] ) ) { -@@ -723,8 +726,8 @@ class hyperdb extends wpdb { - $collate = null; - - $this->set_charset($this->dbhs[$dbhname], $charset, $collate); -- -- if ( !isset( $charset ) ) -+ -+ if ( !isset( $charset ) ) - $charset = null; - - if ( !isset( $collate ) ) -@@ -885,7 +888,7 @@ class hyperdb extends wpdb { - if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/') !== false) { - $query .= ' /* NO CACHE */'; - } -- -+ - $this->timer_start(); - if ( $statement_before_query ) { - $query_for_log = "$statement_before_query; $query_for_log"; -- 2.17.1 diff --git a/patches/hyperdb/0161-adding-extreme-debugging-when-wp_debug-is-true.patch b/patches/hyperdb/0161-adding-extreme-debugging-when-wp_debug-is-true.patch deleted file mode 100644 index 102f498d18f40db69cd3c4620f91f6dc6bdacc99..0000000000000000000000000000000000000000 --- a/patches/hyperdb/0161-adding-extreme-debugging-when-wp_debug-is-true.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0d0a76d87eba5cf15114c21478d73e1d4a80c93f Mon Sep 17 00:00:00 2001 -From: Joe <joe@autistici.org> -Date: Fri, 3 May 2013 16:42:59 +0200 -Subject: [PATCH 161/229] adding extreme debugging when wp_debug is true - ---- - wp-content/db.php | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/wp-content/db.php b/wp-content/db.php -index 0f9f5a1e..2bd49b41 100644 ---- a/wp-content/db.php -+++ b/wp-content/db.php -@@ -416,6 +416,11 @@ class hyperdb extends wpdb { - - $this->run_callbacks( 'dataset_found', $dataset ); - -+ if (WP_DEBUG === true) { -+ $_ai_msg = sprintf("We choose dataset %s for query '%s'", $this->dataset, $query); -+ $this->print_error($_ai_msg); -+ } -+ - if ( empty( $this->hyper_servers ) ) { - if ( $this->is_mysql_connection( $this->dbh ) ) - return $this->dbh; --- -2.17.1 - diff --git a/patches/hyperdb/show-tables-like.patch b/patches/hyperdb/show-tables-like.patch new file mode 100644 index 0000000000000000000000000000000000000000..66042dd224b7fcaa8f9cadaa17184cc59f0b65ba --- /dev/null +++ b/patches/hyperdb/show-tables-like.patch @@ -0,0 +1,17 @@ +diff --git a/wp-content/db.php b/wp-content/db.php +index f900d305..f819e225 100644 +--- a/wp-content/db.php ++++ b/wp-content/db.php +@@ -306,6 +312,12 @@ class hyperdb extends wpdb { + . ')\W([\w-]+)\W/is', $q, $maybe) ) + return $maybe[1]; + ++ // SHOW TABLES LIKE (used in some plugins) ++ if ( preg_match('/^\s*' ++ . 'SHOW\s+TABLES\s+LIKE\s+' ++ . '\W(\w+)\W/is', $q, $maybe) ) ++ return $maybe[1]; ++ + // Big pattern for the rest of the table-related queries in MySQL 5.0 + if ( preg_match('/^\s*(?:' + . '(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM'