Make WordPress Core

Ticket #26419: patch.diff

File patch.diff, 1.2 KB (added by codix, 11 years ago)
  • wp-admin/install-helper.php

    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') ) : 
    5353 */
    5454function maybe_create_table($table_name, $create_ddl) {
    5555        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 ) {
    5757                if ($table == $table_name) {
    5858                        return true;
    5959                }
    function maybe_create_table($table_name, $create_ddl) { 
    6161        //didn't find it try to create it.
    6262        $wpdb->query($create_ddl);
    6363        // 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 ) {
    6565                if ($table == $table_name) {
    6666                        return true;
    6767                }