Make WordPress Core


Ignore:
Timestamp:
03/16/2018 02:14:04 AM (7 years ago)
Author:
flixos90
Message:

Multisite: Introduce metadata for sites.

A new global multisite table wp_blogmeta is added to the database schema, and a set of *_site_meta() API functions are introduced.

The implementation fails gracefully when the new table is not yet available, which may happen especially shortly after the core update, before the network has been upgraded to the new database schema. The presence of the table is detected once and stored as a global setting on the main network.

Core does not yet use site metadata, but there are several use-cases to be implemented or explored in the near future, and it allows plugins to extend sites with arbitrary data, which will come in particularly handy with the upcoming REST API endpoint for sites.

Props spacedmonkey, johnjamesjacoby, jeremyfelt, flixos90.
Fixes #37923.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r42761 r42836  
    267267  PRIMARY KEY  (blog_id),
    268268  KEY db_version (db_version)
     269) $charset_collate;
     270CREATE TABLE $wpdb->blogmeta (
     271  meta_id bigint(20) unsigned NOT NULL auto_increment,
     272  blog_id bigint(20) NOT NULL default '0',
     273  meta_key varchar(255) default NULL,
     274  meta_value longtext,
     275  PRIMARY KEY  (meta_id),
     276  KEY meta_key (meta_key($max_index_length)),
     277  KEY blog_id (blog_id)
    269278) $charset_collate;
    270279CREATE TABLE $wpdb->registration_log (
Note: See TracChangeset for help on using the changeset viewer.