Make WordPress Core

Ticket #4147: tax_link_cat.diff

File tax_link_cat.diff, 2.3 KB (added by ryan, 19 years ago)

Introduce TAXONOMY_LINK_CATEGORY

  • wp-includes/category.php

     
    22
    33define('TAXONOMY_CATEGORY', 1);
    44define('TAXONOMY_TAG', 2);
     5define('TAXONOMY_LINK_CATEGORY', 4);
    56
    67function get_all_category_ids() {
    78        global $wpdb;
     
    7576        $exclusions = apply_filters('list_cats_exclusions', $exclusions, $r );
    7677        $where .= $exclusions;
    7778
     79        if ( 'link' == $type )
     80                $where .= ' AND ( type & ' . TAXONOMY_LINK_CATEGORY . ' != 0 ) ';
     81        else
     82                $where .= ' AND ( type & ' . TAXONOMY_CATEGORY . ' != 0 ) ';
     83
    7884        if ( $hide_empty && !$hierarchical ) {
    7985                if ( 'link' == $type )
    8086                        $where .= ' AND link_count > 0';
    8187                else
    8288                        $where .= ' AND category_count > 0';
    83         } else {
    84                 $where .= ' AND ( type & ' . TAXONOMY_CATEGORY . ' != 0 ) ';
    8589        }
    86 
    8790       
    8891
    8992        if ( !empty($number) )
  • wp-admin/upgrade-functions.php

     
    182182        if ( $wp_current_db_version < 4772 )
    183183                upgrade_210();
    184184
     185        if ( $wp_current_db_version < 5267 )
     186                upgrade_220();
     187
    185188        if ( $wp_current_db_version < 4351 )
    186189                upgrade_old_slugs();
    187190
     
    565568        }
    566569}
    567570
     571function upgrade_220() {
     572        global $wpdb, $wp_current_db_version;
     573
     574        // Set category type
     575        if ( $wp_current_db_version < 5267 ) {
     576                $wpdb->query("UPDATE $wpdb->categories SET type = type | " . TAXONOMY_CATEGORY . " WHERE category_count > 0");
     577                $wpdb->query("UPDATE $wpdb->categories SET type = type | " . TAXONOMY_LINK_CATEGORY . " WHERE link_count > 0");
     578        }
     579}
     580
    568581function upgrade_old_slugs() {
    569582        // upgrade people who were using the Redirect Old Slugs plugin
    570583        global $wpdb;
  • wp-admin/upgrade-schema.php

     
    2121  tag_count bigint(20) NOT NULL default '0',
    2222  posts_private tinyint(1) NOT NULL default '0',
    2323  links_private tinyint(1) NOT NULL default '0',
    24   type tinyint NOT NULL default '1',
     24  type tinyint NOT NULL default '0',
    2525  PRIMARY KEY  (cat_ID),
    2626  KEY category_nicename (category_nicename)
    2727) $charset_collate;