WordPress.org

Make WordPress Core

Ticket #18451: charset_collate method.diff

File charset_collate method.diff, 1.7 KB (added by simonwheatley, 7 years ago)

charset_collate method

  • wp-includes/wp-db.php

     
    14911491        function supports_collation() {
    14921492                return $this->has_cap( 'collation' );
    14931493        }
     1494        /**
     1495         * The database character collate.
     1496         *
     1497         * @uses $wpdb
     1498         *
     1499         * @return string The database character collate.
     1500         **/
     1501        public function charset_collate() {
     1502                $charset_collate = '';
    14941503
     1504                if ( ! empty($this->charset) )
     1505                        $charset_collate = "DEFAULT CHARACTER SET $this->charset";
     1506                if ( ! empty($this->collate) )
     1507                        $charset_collate .= " COLLATE $this->collate";
     1508
     1509                return $charset_collate;
     1510        }
     1511
    14951512        /**
    14961513         * Determine if a database supports a particular feature
    14971514         *
  • includes/schema.php

     
    88 * @subpackage Administration
    99 */
    1010
     11// Declare these as global in case schema.php is included from a function.
     12global $wpdb, $wp_queries;
     13
    1114/**
    1215 * The database character collate.
    1316 * @var string
    1417 * @global string
    1518 * @name $charset_collate
    1619 */
    17 $charset_collate = '';
     20$charset_collate = $wpdb->charset_collate();
    1821
    19 // Declare these as global in case schema.php is included from a function.
    20 global $wpdb, $wp_queries;
    21 
    22 if ( ! empty($wpdb->charset) )
    23         $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    24 if ( ! empty($wpdb->collate) )
    25         $charset_collate .= " COLLATE $wpdb->collate";
    26 
    2722/** Create WordPress database tables SQL */
    2823$wp_queries = "CREATE TABLE $wpdb->terms (
    2924 term_id bigint(20) unsigned NOT NULL auto_increment,