WordPress.org

Make WordPress Core

Changeset 13715


Ignore:
Timestamp:
03/16/2010 05:17:55 PM (10 years ago)
Author:
wpmuguru
Message:

first pass on optional global terms, see #12589

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-link-categories.php

    r12818 r13715  
    201201    <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
    202202</div>
    203 <?php if ( !is_multisite() ) { ?>
     203<?php if ( !global_terms_enabled() ) { ?>
    204204<div class="form-field">
    205205    <label for="slug"><?php _e('Link Category slug') ?></label>
  • trunk/wp-admin/edit-tag-form.php

    r13162 r13715  
    3838            <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
    3939        </tr>
    40 <?php if ( !is_multisite() ) { ?>
     40<?php if ( !global_terms_enabled() ) { ?>
    4141        <tr class="form-field">
    4242            <th scope="row" valign="top"><label for="slug"><?php echo _x('Slug', 'Taxonomy Slug'); ?></label></th>
  • trunk/wp-admin/includes/ms.php

    r13618 r13715  
    521521
    522522function sync_category_tag_slugs( $term, $taxonomy ) {
    523     if ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) {
     523    if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
    524524        if ( is_object( $term ) ) {
    525525            $term->slug = sanitize_title( $term->name );
  • trunk/wp-admin/includes/schema.php

    r13713 r13715  
    660660
    661661    if ( !is_multisite() ) {
    662 
    663         $wpdb->query( "INSERT INTO $wpdb->sitecategories (cat_id, cat_name, category_nicename, last_updated) SELECT term_id, `name`, slug, NOW() FROM $wpdb->terms" );
    664 
    665662        $site_admins = array( $site_user->user_login );
    666663        $users = get_users_of_blog();
     
    709706        'upload_space_check_disabled' => '0',
    710707        'subdomain_install' => intval( $subdomain_install ),
     708        'global_terms_enabled' => global_terms_enabled() ? '1' : '0'
    711709    );
    712     if ( is_multisite() )
    713         $sitemeta[ 'global_terms_enabled' ] = get_site_option( 'global_terms_enabled', '0' );
    714     else
    715         $sitemeta[ 'global_terms_enabled' ] = '0';
    716710
    717711    $insert = '';
  • trunk/wp-admin/includes/upgrade.php

    r13713 r13715  
    111111    $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
    112112
    113     if ( is_multisite() ) {
     113    if ( global_terms_enabled() ) {
    114114        $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
    115115        if ( $cat_id == null ) {
     
    131131    $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
    132132
    133     if ( is_multisite() ) {
     133    if ( global_terms_enabled() ) {
    134134        $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
    135135        if ( $blogroll_id == null ) {
     
    19181918  KEY site_id (site_id)
    19191919) $charset_collate;
    1920 CREATE TABLE $wpdb->sitecategories (
    1921   cat_ID bigint(20) NOT NULL auto_increment,
    1922   cat_name varchar(55) NOT NULL default '',
    1923   category_nicename varchar(200) NOT NULL default '',
    1924   last_updated timestamp NOT NULL,
    1925   PRIMARY KEY  (cat_ID),
    1926   KEY category_nicename (category_nicename),
    1927   KEY last_updated (last_updated)
    1928 ) $charset_collate;
    19291920CREATE TABLE $wpdb->signups (
    19301921  domain varchar(200) NOT NULL default '',
     
    19461937}
    19471938endif;
     1939
     1940/**
     1941 * Install global terms.
     1942 *
     1943 * @since 3.0
     1944 *
     1945 */
     1946if ( !function_exists( 'install_global_terms' ) ) :
     1947function install_global_terms() {
     1948    global $wpdb, $charset_collate;
     1949    $ms_queries = "
     1950CREATE TABLE $wpdb->sitecategories (
     1951  cat_ID bigint(20) NOT NULL auto_increment,
     1952  cat_name varchar(55) NOT NULL default '',
     1953  category_nicename varchar(200) NOT NULL default '',
     1954  last_updated timestamp NOT NULL,
     1955  PRIMARY KEY  (cat_ID),
     1956  KEY category_nicename (category_nicename),
     1957  KEY last_updated (last_updated)
     1958) $charset_collate;
     1959";
     1960// now create tables
     1961    dbDelta( $ms_queries );
     1962}
     1963endif;
    19481964?>
  • trunk/wp-admin/ms-edit.php

    r13713 r13715  
    108108        }
    109109        update_site_option( "dashboard_blog", $dashboard_blog_id );
     110        // global terms
     111        if ( !global_terms_enabled() && '1' == $_POST[ 'global_terms_enabled' ] ) {
     112            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     113            // create global terms table
     114            install_global_terms();
     115        }
    110116        $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled' );
    111117        $checked_options = array('mu_media_buttons', 'menu_items');
  • trunk/wp-includes/functions.php

    r13677 r13715  
    448448        $site_id = $wpdb->siteid;
    449449
    450     $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'dashboard_blog', 'can_compress_scripts');
     450    $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'dashboard_blog', 'can_compress_scripts', 'global_terms_enabled' );
    451451
    452452    $core_options_in = "'" . implode("', '", $core_options) . "'";
     
    36923692
    36933693/**
     3694 * are global terms enabled
     3695 *
     3696 *
     3697 * @since 3.0.0
     3698 * @package WordPress
     3699 *
     3700 * @return bool True if multisite and global terms enabled
     3701 */
     3702function global_terms_enabled() {
     3703    if ( is_multisite() && '1' == get_site_option( 'global_terms_enabled' ) )
     3704        return true;
     3705
     3706    return false;
     3707}
     3708
     3709/**
    36943710 * gmt_offset modification for smart timezone handling
    36953711 *
  • trunk/wp-includes/ms-functions.php

    r13563 r13715  
    12111211    global $wpdb;
    12121212
     1213    if ( !global_terms_enabled() )
     1214        return $term_id;
     1215
    12131216    $term_id = intval( $term_id );
    12141217    $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
Note: See TracChangeset for help on using the changeset viewer.