Ticket #21734: 21734.2.diff
File 21734.2.diff, 15.8 KB (added by , 12 years ago) |
---|
-
wp-admin/edit-tag-form.php
diff --git wp-admin/edit-tag-form.php wp-admin/edit-tag-form.php index 0d4a121..b87dc9f 100644
do_action($taxonomy . '_pre_edit_form', $tag, $taxonomy); ?> 41 41 <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> 42 42 <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> 43 43 </tr> 44 <?php if ( !global_terms_enabled() ) { ?>45 44 <tr class="form-field"> 46 45 <th scope="row" valign="top"><label for="slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label></th> 47 46 <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" /> 48 47 <p class="description"><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td> 49 48 </tr> 50 <?php } ?>51 49 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> 52 50 <tr class="form-field"> 53 51 <th scope="row" valign="top"><label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label></th> -
wp-admin/edit-tags.php
diff --git wp-admin/edit-tags.php wp-admin/edit-tags.php index 1317e75..462d625 100644
if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $t 214 214 $help .= '<ul>' . 215 215 '<li>' . __( '<strong>Name</strong> - The name is how it appears on your site.' ) . '</li>'; 216 216 217 if ( ! global_terms_enabled() ) 218 $help .= '<li>' . __( '<strong>Slug</strong> - The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; 217 $help .= '<li>' . __( '<strong>Slug</strong> - The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; 219 218 220 219 if ( 'category' == $taxonomy ) 221 220 $help .= '<li>' . __( '<strong>Parent</strong> - Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; … … if ( current_user_can($tax->cap->edit_terms) ) { 361 360 <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> 362 361 <p><?php _e('The name is how it appears on your site.'); ?></p> 363 362 </div> 364 <?php if ( ! global_terms_enabled() ) : ?>365 363 <div class="form-field"> 366 364 <label for="tag-slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label> 367 365 <input name="slug" id="tag-slug" type="text" value="" size="40" /> 368 366 <p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p> 369 367 </div> 370 <?php endif; // global_terms_enabled() ?>371 368 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> 372 369 <div class="form-field"> 373 370 <label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label> -
wp-admin/includes/class-wp-terms-list-table.php
diff --git wp-admin/includes/class-wp-terms-list-table.php wp-admin/includes/class-wp-terms-list-table.php index d03b096..ae9e9a1 100644
class WP_Terms_List_Table extends WP_List_Table { 341 341 <span class="title"><?php _ex( 'Name', 'term name' ); ?></span> 342 342 <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span> 343 343 </label> 344 <?php if ( !global_terms_enabled() ) { ?>345 344 <label> 346 345 <span class="title"><?php _e( 'Slug' ); ?></span> 347 346 <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span> 348 347 </label> 349 <?php } ?>350 348 </div></fieldset> 351 349 <?php 352 350 -
wp-admin/includes/ms.php
diff --git wp-admin/includes/ms.php wp-admin/includes/ms.php index c686e6a..83ddc54 100644
function format_code_lang( $code = '' ) { 493 493 return strtr( $code, $lang_codes ); 494 494 } 495 495 496 function sync_category_tag_slugs( $term, $taxonomy ) {497 if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {498 if ( is_object( $term ) ) {499 $term->slug = sanitize_title( $term->name );500 } else {501 $term['slug'] = sanitize_title( $term['name'] );502 }503 }504 return $term;505 }506 add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );507 508 496 function _access_denied_splash() { 509 497 if ( ! is_user_logged_in() || is_network_admin() ) 510 498 return; -
wp-admin/includes/schema.php
diff --git wp-admin/includes/schema.php wp-admin/includes/schema.php index f5309a3..60c4449 100644
We hope you enjoy your new site. Thanks! 898 898 'add_new_users' => '0', 899 899 'upload_space_check_disabled' => '0', 900 900 'subdomain_install' => intval( $subdomain_install ), 901 'global_terms_enabled' => global_terms_enabled() ? '1' : '0',902 901 'initial_db_version' => get_option( 'initial_db_version' ), 903 902 'active_sitewide_plugins' => array(), 904 903 ); -
wp-admin/includes/upgrade.php
diff --git wp-admin/includes/upgrade.php wp-admin/includes/upgrade.php index d71163e..512da50 100644
function wp_install_defaults($user_id) { 108 108 /* translators: Default category slug */ 109 109 $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug')); 110 110 111 if ( global_terms_enabled() ) { 112 $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) ); 113 if ( $cat_id == null ) { 114 $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) ); 115 $cat_id = $wpdb->insert_id; 116 } 117 update_option('default_category', $cat_id); 118 } else { 119 $cat_id = 1; 120 } 111 $cat_id = 1; 121 112 122 113 $wpdb->insert( $wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 123 114 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); … … function upgrade_network() { 1234 1225 } 1235 1226 } 1236 1227 1237 // 3.01238 if ( $wp_current_db_version < 13576 )1239 update_site_option( 'global_terms_enabled', '1' );1240 1241 1228 // 3.3 1242 1229 if ( $wp_current_db_version < 19390 ) 1243 1230 update_site_option( 'initial_db_version', $wp_current_db_version ); … … function upgrade_network() { 1263 1250 delete_site_option( 'allowed_themes' ); 1264 1251 } 1265 1252 } 1253 1254 // 3.5 1255 if ( $wp_current_db_version < 20149 && global_terms_enabled() ) { 1256 // TODO: install plugin 1257 } 1266 1258 } 1267 1259 1268 1260 // The functions we use to actually do stuff … … function pre_schema_upgrade() { 1960 1952 1961 1953 } 1962 1954 1963 /**1964 * Install global terms.1965 *1966 * @since 3.0.01967 *1968 */1969 if ( !function_exists( 'install_global_terms' ) ) :1970 function install_global_terms() {1971 global $wpdb, $charset_collate;1972 $ms_queries = "1973 CREATE TABLE $wpdb->sitecategories (1974 cat_ID bigint(20) NOT NULL auto_increment,1975 cat_name varchar(55) NOT NULL default '',1976 category_nicename varchar(200) NOT NULL default '',1977 last_updated timestamp NOT NULL,1978 PRIMARY KEY (cat_ID),1979 KEY category_nicename (category_nicename),1980 KEY last_updated (last_updated)1981 ) $charset_collate;1982 ";1983 // now create tables1984 dbDelta( $ms_queries );1985 }1986 endif; -
wp-admin/maint/repair.php
diff --git wp-admin/maint/repair.php wp-admin/maint/repair.php index e0c594e..3cfeacb 100644
if ( ! defined( 'WP_ALLOW_REPAIR' ) ) { 32 32 33 33 $tables = $wpdb->tables(); 34 34 35 // Sitecategories may not exist if global terms are disabled.36 if ( is_multisite() && ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->sitecategories'" ) )37 unset( $tables['sitecategories'] );38 39 35 $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Return tables with table prefixes. 40 36 41 37 // Loop over the tables, checking and repairing as needed. -
wp-admin/network/settings.php
diff --git wp-admin/network/settings.php wp-admin/network/settings.php index e75d95f..37e9b94 100644
if ( $_POST ) { 85 85 update_site_option( 'banned_email_domains', '' ); 86 86 } 87 87 88 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', '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' , 'global_terms_enabled');88 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', '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' ); 89 89 $checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); 90 90 foreach ( $checked_options as $option_name => $option_unchecked_value ) { 91 91 if ( ! isset( $_POST[$option_name] ) ) -
wp-includes/functions.php
diff --git wp-includes/functions.php wp-includes/functions.php index 242b055..6ff2760 100644
function wp_get_mime_types() { 1799 1799 'mid|midi' => 'audio/midi', 1800 1800 'wma' => 'audio/wma', 1801 1801 'mka' => 'audio/x-matroska', 1802 // Misc application formats 1802 // Misc application formats 1803 1803 'rtf' => 'application/rtf', 1804 1804 'js' => 'application/javascript', 1805 1805 'pdf' => 'application/pdf', … … function wp_get_mime_types() { 1857 1857 * 1858 1858 * @uses apply_filters() Calls 'upload_mimes' on returned array 1859 1859 * @uses wp_get_upload_mime_types() to fetch the list of mime types 1860 * 1860 * 1861 1861 * @return array Array of mime types keyed by the file extension regex corresponding to those types. 1862 1862 */ 1863 1863 function get_allowed_mime_types() { -
wp-includes/ms-default-filters.php
diff --git wp-includes/ms-default-filters.php wp-includes/ms-default-filters.php index 4541014..34716d8 100644
add_action( 'template_redirect', 'maybe_redirect_404' ); 33 33 add_filter( 'allowed_redirect_hosts', 'redirect_this_site' ); 34 34 35 35 // Administration 36 add_filter( 'term_id_filter', 'global_terms', 10, 2 );37 36 add_action( 'publish_post', 'update_posts_count' ); 38 37 add_action( 'delete_post', '_update_blog_date_on_post_delete' ); 39 38 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 ); -
wp-includes/ms-functions.php
diff --git wp-includes/ms-functions.php wp-includes/ms-functions.php index 202c3ab..cfdd19a 100644
function wpmu_log_new_registrations( $blog_id, $user_id ) { 1513 1513 } 1514 1514 1515 1515 /** 1516 * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.1517 *1518 * @since 3.0.01519 *1520 * @see term_id_filter1521 *1522 * @param int $term_id An ID for a term on the current blog.1523 * @return int An ID from the global terms table mapped from $term_id.1524 */1525 function global_terms( $term_id, $deprecated = '' ) {1526 global $wpdb;1527 static $global_terms_recurse = null;1528 1529 if ( !global_terms_enabled() )1530 return $term_id;1531 1532 // prevent a race condition1533 $recurse_start = false;1534 if ( $global_terms_recurse === null ) {1535 $recurse_start = true;1536 $global_terms_recurse = 1;1537 } elseif ( 10 < $global_terms_recurse++ ) {1538 return $term_id;1539 }1540 1541 $term_id = intval( $term_id );1542 $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );1543 1544 $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );1545 if ( $global_id == null ) {1546 $used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );1547 if ( null == $used_global_id ) {1548 $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );1549 $global_id = $wpdb->insert_id;1550 if ( empty( $global_id ) )1551 return $term_id;1552 } else {1553 $max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );1554 $max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );1555 $new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );1556 $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );1557 $global_id = $wpdb->insert_id;1558 }1559 } elseif ( $global_id != $term_id ) {1560 $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );1561 if ( null != $local_id )1562 $local_id = global_terms( $local_id );1563 if ( 10 < $global_terms_recurse )1564 $global_id = $term_id;1565 }1566 1567 if ( $global_id != $term_id ) {1568 if ( get_option( 'default_category' ) == $term_id )1569 update_option( 'default_category', $global_id );1570 1571 $wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );1572 $wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );1573 $wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );1574 1575 clean_term_cache($term_id);1576 }1577 if( $recurse_start )1578 $global_terms_recurse = null;1579 1580 return $global_id;1581 }1582 1583 /**1584 1516 * Ensure that the current site's domain is listed in the allowed redirect host list. 1585 1517 * 1586 1518 * @see wp_validate_redirect() -
wp-includes/ms-load.php
diff --git wp-includes/ms-load.php wp-includes/ms-load.php index 58826e7..124a861 100644
function ms_not_installed() { 246 246 $msg .= __( 'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_a_WordPress_Network">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' ); 247 247 $msg .= ' ' . __( 'If you’re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>'; 248 248 foreach ( $wpdb->tables('global') as $t => $table ) { 249 if ( 'sitecategories' == $t )250 continue;251 249 $msg .= '<li>' . $table . '</li>'; 252 250 } 253 251 $msg .= '</ul>'; -
wp-includes/option.php
diff --git wp-includes/option.php wp-includes/option.php index 33897b6..00c2cf1 100644
function wp_load_core_site_options( $site_id = null ) { 174 174 if ( empty($site_id) ) 175 175 $site_id = $wpdb->siteid; 176 176 177 $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts' , 'global_terms_enabled');177 $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts'); 178 178 179 179 $core_options_in = "'" . implode("', '", $core_options) . "'"; 180 180 $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) ); -
wp-includes/wp-db.php
diff --git wp-includes/wp-db.php wp-includes/wp-db.php index 9df8329..725e17c 100644
class wpdb { 239 239 * @var array 240 240 */ 241 241 var $ms_global_tables = array( 'blogs', 'signups', 'site', 'sitemeta', 242 ' sitecategories', 'registration_log', 'blog_versions' );242 'registration_log', 'blog_versions' ); 243 243 244 244 /** 245 245 * WordPress Comments table … … class wpdb { 390 390 var $site; 391 391 392 392 /** 393 * Multisite Sitewide Terms table394 *395 * @since 3.0.0396 * @access public397 * @var string398 */399 var $sitecategories;400 401 /**402 393 * Multisite Site Metadata table 403 394 * 404 395 * @since 3.0.0