diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-04 12:01:10 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-04 12:01:10 +0000 |
commit | f4b9932ffd83269edcd5270b20f4a2aa3f692304 (patch) | |
tree | ce9f214787ae2c5f594ceee2427ee34b2a972c09 /wp-content/mu-plugins | |
parent | a59d193f9f2591a89141cfa7f6909aa17a66dfcd (diff) | |
download | wordpress-mu-f4b9932ffd83269edcd5270b20f4a2aa3f692304.tar.gz wordpress-mu-f4b9932ffd83269edcd5270b20f4a2aa3f692304.tar.xz wordpress-mu-f4b9932ffd83269edcd5270b20f4a2aa3f692304.zip |
We only want to sync after the db has been upgraded
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1061 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-content/mu-plugins')
-rw-r--r-- | wp-content/mu-plugins/sync-taxonomy.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/wp-content/mu-plugins/sync-taxonomy.php b/wp-content/mu-plugins/sync-taxonomy.php index 99f8942..6aeb49d 100644 --- a/wp-content/mu-plugins/sync-taxonomy.php +++ b/wp-content/mu-plugins/sync-taxonomy.php @@ -27,6 +27,9 @@ $wpdb->term_relationships = $wpdb->prefix . "term_relationships"; function sync_link2cat( $link_id ) { global $wpdb; + + if ( get_option('db_version') != 6124 ) + return; if( function_exists( 'get_term' ) ) { $wpdb->query( "DELETE FROM {$wpdb->link2cat} WHERE link_id = '{$link_id}'" ); @@ -66,6 +69,9 @@ add_action( 'add_link', 'sync_link2cat' ); function sync_post2cat( $post_id ) { global $wpdb; + if ( get_option('db_version') != 6124 ) + return; + if( function_exists( 'get_term' ) ) { $wpdb->query( "DELETE FROM {$wpdb->post2cat} WHERE post_id = '{$post_id}'" ); $terms = $wpdb->get_results( "SELECT {$wpdb->term_taxonomy}.term_id FROM {$wpdb->term_taxonomy}, {$wpdb->term_relationships} WHERE {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id AND {$wpdb->term_relationships}.object_id = '{$post_id}' AND {$wpdb->term_taxonomy}.taxonomy = 'category'" ); @@ -110,6 +116,9 @@ function sync_terms_edit_link( $cat_ID ) { function sync_terms_edit( $cat_ID, $taxonomy ) { global $wpdb; + if ( get_option('db_version') != 6124 ) + return; + if( function_exists( 'get_term' ) ) { $cat = $wpdb->get_row( "SELECT * FROM {$wpdb->terms}, {$wpdb->term_taxonomy} WHERE {$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id AND {$wpdb->term_taxonomy}.term_id = '$cat_ID'" ); $wpdb->query( "UPDATE {$wpdb->categories} SET cat_name = '" . $wpdb->escape( $cat->name ) . "', category_nicename = '" . $wpdb->escape( $cat->slug ) . "', category_description = '" . $wpdb->escape( $cat->description ) . "', category_parent = '{$cat->parent}' WHERE cat_ID = '$cat_ID'" ); @@ -130,6 +139,9 @@ add_filter( 'edit_link_category', 'sync_terms_edit_link'); function sync_terms_create( $cat_ID ) { global $wpdb; + if ( get_option('db_version') != 6124 ) + return; + if( strpos( $_SERVER[ 'HTTP_REFERER' ], 'link-add.php' ) ) { $taxonomy = 'link_category'; } else { @@ -156,6 +168,9 @@ add_filter( 'create_link_category', 'sync_terms_create'); function sync_terms_delete( $cat_ID ) { global $wpdb; + if ( get_option('db_version') != 6124 ) + return; + if( function_exists( 'get_term' ) ) { $wpdb->query( "DELETE FROM {$wpdb->categories} WHERE cat_ID = '$cat_ID'" ); $wpdb->query( "DELETE FROM {$wpdb->post2cat} WHERE cat_ID = '$cat_ID'" ); @@ -299,6 +314,9 @@ function do_backfill( $term_ids = array() ) { function make_tags_global( $global_id, $cat_ID ) { global $wpdb; + if ( get_option('db_version') != 6124 ) + return; + if( $global_id == $cat_ID ) return; @@ -311,6 +329,9 @@ add_action( 'update_cat_id', 'make_tags_global', 10, 2 ); function redo_relationships() { global $wpdb, $blog_id; + if ( get_option('db_version') != 6124 ) + return; + $upgradetaxonomysecret = get_taxonomy_secret(); if ( !isset( $_GET['redorelationships'] ) || $upgradetaxonomysecret != $_GET['redorelationships'] ) |