Ticket #32310: patch.diff
File patch.diff, 1.0 KB (added by , 9 years ago) |
---|
-
wp-admin/includes/upgrade.php
1759 1759 } 1760 1760 } 1761 1761 1762 return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" ); 1762 if (_get_table_collation($table) != 'utf8mb4_unicode_ci') 1763 return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" ); 1764 1765 return true; 1763 1766 } 1764 1767 1765 1768 /** 1769 * Get the collation of a table utf8mb4. 1770 * 1771 * @since 4.2.0 1772 * 1773 * @param string $table The table to check. 1774 * @return string like utf8mb4_unicode_ci. 1775 */ 1776 function _get_table_collation($table) { 1777 global $wpdb; 1778 1779 $table_detail = $wpdb->get_results("show table status like '".$table."'"); 1780 if (empty($table_detail)) return false; 1781 $table_detail = array_shift($table_detail); 1782 1783 return $table_detail->Collation; 1784 } 1785 1786 /** 1766 1787 * Retrieve all options as it was for 1.2. 1767 1788 * 1768 1789 * @since 1.2.0