Ticket #8977: maybe_create_table.diff
| File maybe_create_table.diff, 814 bytes (added by jamescollins, 4 years ago) |
|---|
-
upgrade.php
926 926 */ 927 927 function maybe_create_table($table_name, $create_ddl) { 928 928 global $wpdb; 929 foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 930 if ($table == $table_name) { 931 return true; 932 } 933 } 929 if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name ) 930 return true; 934 931 //didn't find it try to create it. 935 932 $q = $wpdb->query($create_ddl); 936 933 // we cannot directly tell that whether this succeeded! 937 foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 938 if ($table == $table_name) { 939 return true; 940 } 941 } 934 if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name ) 935 return true; 942 936 return false; 943 937 } 944 938
