WordPress.org

Make WordPress Core

Ticket #49188: 49188.diff

File 49188.diff, 17.8 KB (added by xkon, 23 months ago)

first pass for core tables ( single site )

  • src/wp-admin/includes/class-wp-site-health.php

    diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
    index 0da1f9e607..5534c6b743 100644
    a b class WP_Site_Health { 
    2525        private $timeout_missed_cron = null;
    2626        private $timeout_late_cron   = null;
    2727
     28        /**
     29         * Array to gather core tables.
     30         *
     31         * @since 5.4.0
     32         * @var array
     33         */
     34        private $core_tables = array();
     35
     36        /**
     37         * Array to gather errored tables that
     38         * don't have the correct structure.
     39         *
     40         * @since 5.4.0
     41         * @var array
     42         */
     43        private $errored_tables = array();
     44
     45        /**
     46         * Serialized structures of core tables.
     47         *
     48         * @since 5.4.0
     49         * @var array
     50         */
     51        private $serialized_tables = array(
     52                'posts'              => 'a:23:{i:0;a:6:{s:5:"Field";s:2:"ID";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:11:"post_author";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:9:"post_date";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:13:"post_date_gmt";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:4;a:6:{s:5:"Field";s:12:"post_content";s:4:"Type";s:8:"longtext";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:5;a:6:{s:5:"Field";s:10:"post_title";s:4:"Type";s:4:"text";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:6;a:6:{s:5:"Field";s:12:"post_excerpt";s:4:"Type";s:4:"text";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:7;a:6:{s:5:"Field";s:11:"post_status";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:7:"publish";s:5:"Extra";s:0:"";}i:8;a:6:{s:5:"Field";s:14:"comment_status";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:4:"open";s:5:"Extra";s:0:"";}i:9;a:6:{s:5:"Field";s:11:"ping_status";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:4:"open";s:5:"Extra";s:0:"";}i:10;a:6:{s:5:"Field";s:13:"post_password";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:11;a:6:{s:5:"Field";s:9:"post_name";s:4:"Type";s:12:"varchar(200)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:12;a:6:{s:5:"Field";s:7:"to_ping";s:4:"Type";s:4:"text";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:13;a:6:{s:5:"Field";s:6:"pinged";s:4:"Type";s:4:"text";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:14;a:6:{s:5:"Field";s:13:"post_modified";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:15;a:6:{s:5:"Field";s:17:"post_modified_gmt";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:16;a:6:{s:5:"Field";s:21:"post_content_filtered";s:4:"Type";s:8:"longtext";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:17;a:6:{s:5:"Field";s:11:"post_parent";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:18;a:6:{s:5:"Field";s:4:"guid";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:19;a:6:{s:5:"Field";s:10:"menu_order";s:4:"Type";s:7:"int(11)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:20;a:6:{s:5:"Field";s:9:"post_type";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:4:"post";s:5:"Extra";s:0:"";}i:21;a:6:{s:5:"Field";s:14:"post_mime_type";s:4:"Type";s:12:"varchar(100)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:22;a:6:{s:5:"Field";s:13:"comment_count";s:4:"Type";s:10:"bigint(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}}',
     53                'comments'           => 'a:15:{i:0;a:6:{s:5:"Field";s:10:"comment_ID";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:15:"comment_post_ID";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:14:"comment_author";s:4:"Type";s:8:"tinytext";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:20:"comment_author_email";s:4:"Type";s:12:"varchar(100)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:4;a:6:{s:5:"Field";s:18:"comment_author_url";s:4:"Type";s:12:"varchar(200)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:5;a:6:{s:5:"Field";s:17:"comment_author_IP";s:4:"Type";s:12:"varchar(100)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:6;a:6:{s:5:"Field";s:12:"comment_date";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:7;a:6:{s:5:"Field";s:16:"comment_date_gmt";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:8;a:6:{s:5:"Field";s:15:"comment_content";s:4:"Type";s:4:"text";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:9;a:6:{s:5:"Field";s:13:"comment_karma";s:4:"Type";s:7:"int(11)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:10;a:6:{s:5:"Field";s:16:"comment_approved";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"1";s:5:"Extra";s:0:"";}i:11;a:6:{s:5:"Field";s:13:"comment_agent";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:12;a:6:{s:5:"Field";s:12:"comment_type";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:13;a:6:{s:5:"Field";s:14:"comment_parent";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:14;a:6:{s:5:"Field";s:7:"user_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}}',
     54                'links'              => 'a:13:{i:0;a:6:{s:5:"Field";s:7:"link_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:8:"link_url";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:9:"link_name";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:10:"link_image";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:4;a:6:{s:5:"Field";s:11:"link_target";s:4:"Type";s:11:"varchar(25)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:5;a:6:{s:5:"Field";s:16:"link_description";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:6;a:6:{s:5:"Field";s:12:"link_visible";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"Y";s:5:"Extra";s:0:"";}i:7;a:6:{s:5:"Field";s:10:"link_owner";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"1";s:5:"Extra";s:0:"";}i:8;a:6:{s:5:"Field";s:11:"link_rating";s:4:"Type";s:7:"int(11)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:9;a:6:{s:5:"Field";s:12:"link_updated";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:10;a:6:{s:5:"Field";s:8:"link_rel";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:11;a:6:{s:5:"Field";s:10:"link_notes";s:4:"Type";s:10:"mediumtext";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:12;a:6:{s:5:"Field";s:8:"link_rss";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}}',
     55                'options'            => 'a:4:{i:0;a:6:{s:5:"Field";s:9:"option_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:11:"option_name";s:4:"Type";s:12:"varchar(191)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"UNI";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:12:"option_value";s:4:"Type";s:8:"longtext";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:8:"autoload";s:4:"Type";s:11:"varchar(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:3:"yes";s:5:"Extra";s:0:"";}}',
     56                'postmeta'           => 'a:4:{i:0;a:6:{s:5:"Field";s:7:"meta_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:7:"post_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:8:"meta_key";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:3:"YES";s:3:"Key";s:3:"MUL";s:7:"Default";N;s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:10:"meta_value";s:4:"Type";s:8:"longtext";s:4:"Null";s:3:"YES";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}}',
     57                'terms'              => 'a:4:{i:0;a:6:{s:5:"Field";s:7:"term_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:4:"name";s:4:"Type";s:12:"varchar(200)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:4:"slug";s:4:"Type";s:12:"varchar(200)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:10:"term_group";s:4:"Type";s:10:"bigint(10)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}}',
     58                'term_taxonomy'      => 'a:6:{i:0;a:6:{s:5:"Field";s:16:"term_taxonomy_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:7:"term_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:8:"taxonomy";s:4:"Type";s:11:"varchar(32)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:11:"description";s:4:"Type";s:8:"longtext";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}i:4;a:6:{s:5:"Field";s:6:"parent";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:5;a:6:{s:5:"Field";s:5:"count";s:4:"Type";s:10:"bigint(20)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}}',
     59                'term_relationships' => 'a:3:{i:0;a:6:{s:5:"Field";s:9:"object_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:1;a:6:{s:5:"Field";s:16:"term_taxonomy_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:10:"term_order";s:4:"Type";s:7:"int(11)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}}',
     60                'termmeta'           => 'a:4:{i:0;a:6:{s:5:"Field";s:7:"meta_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:7:"term_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:8:"meta_key";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:3:"YES";s:3:"Key";s:3:"MUL";s:7:"Default";N;s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:10:"meta_value";s:4:"Type";s:8:"longtext";s:4:"Null";s:3:"YES";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}}',
     61                'commentmeta'        => 'a:4:{i:0;a:6:{s:5:"Field";s:7:"meta_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:10:"comment_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:8:"meta_key";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:3:"YES";s:3:"Key";s:3:"MUL";s:7:"Default";N;s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:10:"meta_value";s:4:"Type";s:8:"longtext";s:4:"Null";s:3:"YES";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}}',
     62                'users'              => 'a:10:{i:0;a:6:{s:5:"Field";s:2:"ID";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:10:"user_login";s:4:"Type";s:11:"varchar(60)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:9:"user_pass";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:13:"user_nicename";s:4:"Type";s:11:"varchar(50)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:4;a:6:{s:5:"Field";s:10:"user_email";s:4:"Type";s:12:"varchar(100)";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:5;a:6:{s:5:"Field";s:8:"user_url";s:4:"Type";s:12:"varchar(100)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:6;a:6:{s:5:"Field";s:15:"user_registered";s:4:"Type";s:8:"datetime";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:19:"0000-00-00 00:00:00";s:5:"Extra";s:0:"";}i:7;a:6:{s:5:"Field";s:19:"user_activation_key";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}i:8;a:6:{s:5:"Field";s:11:"user_status";s:4:"Type";s:7:"int(11)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:9;a:6:{s:5:"Field";s:12:"display_name";s:4:"Type";s:12:"varchar(250)";s:4:"Null";s:2:"NO";s:3:"Key";s:0:"";s:7:"Default";s:0:"";s:5:"Extra";s:0:"";}}',
     63                'usermeta'           => 'a:4:{i:0;a:6:{s:5:"Field";s:8:"umeta_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"PRI";s:7:"Default";N;s:5:"Extra";s:14:"auto_increment";}i:1;a:6:{s:5:"Field";s:7:"user_id";s:4:"Type";s:19:"bigint(20) unsigned";s:4:"Null";s:2:"NO";s:3:"Key";s:3:"MUL";s:7:"Default";s:1:"0";s:5:"Extra";s:0:"";}i:2;a:6:{s:5:"Field";s:8:"meta_key";s:4:"Type";s:12:"varchar(255)";s:4:"Null";s:3:"YES";s:3:"Key";s:3:"MUL";s:7:"Default";N;s:5:"Extra";s:0:"";}i:3;a:6:{s:5:"Field";s:10:"meta_value";s:4:"Type";s:8:"longtext";s:4:"Null";s:3:"YES";s:3:"Key";s:0:"";s:7:"Default";N;s:5:"Extra";s:0:"";}}',
     64        );
     65
    2866        /**
    2967         * WP_Site_Health constructor.
    3068         *
    class WP_Site_Health { 
    19662004                                        'label' => __( 'Debugging enabled' ),
    19672005                                        'test'  => 'is_in_debug_mode',
    19682006                                ),
     2007                                'core_table_structures'      => array(
     2008                                        'label' => __( 'Core Table Structures' ),
     2009                                        'test'  => 'core_table_structures',
     2010                                ),
    19692011                        ),
    19702012                        'async'  => array(
    19712013                                'dotorg_communication' => array(
    class WP_Site_Health { 
    23052347
    23062348                set_transient( 'health-check-site-status-result', wp_json_encode( $site_status ) );
    23072349        }
     2350
     2351        /**
     2352         * Test if core tables have the correct structure.
     2353         *
     2354         * @since 5.4.0
     2355         *
     2356         * @return array The test results.
     2357         */
     2358        public function get_test_core_table_structures() {
     2359                global $wpdb;
     2360
     2361                $result = array(
     2362                        'label'       => __( 'Your core table structures are OK' ),
     2363                        'status'      => 'good',
     2364                        'badge'       => array(
     2365                                'label' => __( 'Performance' ),
     2366                                'color' => 'blue',
     2367                        ),
     2368                        'description' => sprintf(
     2369                                '<p>%s</p>',
     2370                                __( 'WordPress might not be working properly as a result of wrong database table structures.' )
     2371                        ),
     2372                        'actions'     => sprintf(
     2373                                '<p><a href="%s" target="_blank" rel="noopener noreferrer">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
     2374                                /* translators: Documentation explaining debugging in WordPress. */
     2375                                esc_url( __( 'https://codex.wordpress.org/Database_Description#Table_Details' ) ),
     2376                                __( 'Learn more about the database tables.' ),
     2377                                /* translators: Accessibility text. */
     2378                                __( '(opens in a new tab)' )
     2379                        ),
     2380                        'test'        => 'core_table_structures',
     2381                );
     2382
     2383                $this->core_tables = $wpdb->tables;
     2384
     2385                if ( is_multisite() ) {
     2386                        $this->core_tables = array_merge( $this->core_tables, $wpdb->ms_global_tables );
     2387                }
     2388
     2389                foreach ( $this->core_tables as $table ) {
     2390                        $db_table = serialize( $wpdb->get_results( "DESCRIBE {$wpdb->$table};", ARRAY_A ) );
     2391
     2392                        if ( array_key_exists( $table, $this->serialized_tables ) && $db_table !== $this->serialized_tables[ $table ] ) {
     2393                                array_push( $this->errored_tables, $table );
     2394                        }
     2395                }
     2396
     2397                if ( ! empty( $this->errored_tables ) ) {
     2398                        $result['status'] = 'critical';
     2399                        $result['label']  = __( 'There are some issues with your core table structures' );
     2400
     2401                        $result['description'] .= sprintf(
     2402                                '<p>' . __( 'The following tables appear to have the wrong structure. Due to this you might experience issues with indexes or creating new Users, Posts etc. You can review the table structures via phpMyAdmin or any database manager.' ) .'</p><p><code>' . implode( ', ', $this->errored_tables ) .'</code></p>'
     2403                        );
     2404                }
     2405
     2406                return $result;
     2407        }
    23082408}