From 86fa0697c84949f28efc9a2ad91a7dfbe78d2dd0 Mon Sep 17 00:00:00 2001
From: S H Mohanjith <moha@mohanjith.net>
Date: Thu, 5 Dec 2013 01:09:23 +0200
Subject: [PATCH] SHOW TABLES is extremely resource intesive query, use SHOW
TABLES LIKE instead
---
wp-admin/install-helper.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php
index c98b28c..e2405bc 100644
|
a
|
b
|
if ( ! function_exists('maybe_create_table') ) :
|
| 53 | 53 | */ |
| 54 | 54 | function maybe_create_table($table_name, $create_ddl) { |
| 55 | 55 | global $wpdb; |
| 56 | | foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { |
| | 56 | foreach ($wpdb->get_col("SHOW TABLES LIKE '{$table_name}'",0) as $table ) { |
| 57 | 57 | if ($table == $table_name) { |
| 58 | 58 | return true; |
| 59 | 59 | } |
| … |
… |
function maybe_create_table($table_name, $create_ddl) {
|
| 61 | 61 | //didn't find it try to create it. |
| 62 | 62 | $wpdb->query($create_ddl); |
| 63 | 63 | // we cannot directly tell that whether this succeeded! |
| 64 | | foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { |
| | 64 | foreach ($wpdb->get_col("SHOW TABLES LIKE '{$table_name}'",0) as $table ) { |
| 65 | 65 | if ($table == $table_name) { |
| 66 | 66 | return true; |
| 67 | 67 | } |