diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
commit | 87bb8cd69cc593fe6bed330fb1791eac9df87167 (patch) | |
tree | 6b2ad252df89d2a1863198fd44b321b59e42ef54 /wp-admin/import | |
parent | 0cbda3349a2571904ea063fdd73e018299919589 (diff) | |
download | wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.gz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.xz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.zip |
Merge with WordPress, rev 6285 and untested
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/import')
-rw-r--r-- | wp-admin/import/utw.php | 4 | ||||
-rw-r--r-- | wp-admin/import/wp-cat2tag.php | 56 |
2 files changed, 16 insertions, 44 deletions
diff --git a/wp-admin/import/utw.php b/wp-admin/import/utw.php index b321f25..120f50c 100644 --- a/wp-admin/import/utw.php +++ b/wp-admin/import/utw.php @@ -157,7 +157,7 @@ class UTW_Import { // run that funky magic! $tags_added = $this->tag2post(); - echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags where added!'), $tags_added ) . '<br /></p>'; + echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were added!'), $tags_added ) . '<br /></p>'; echo '<form action="admin.php?import=utw&step=4" method="post">'; wp_nonce_field('import-utw'); @@ -273,4 +273,4 @@ $utw_import = new UTW_Import(); // add it to the import page! register_importer('utw', 'Ultimate Tag Warrior', __('Import Ultimate Tag Warrior tags into the new native tagging structure.'), array($utw_import, 'dispatch')); -?>
\ No newline at end of file +?> diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php index ee4104e..d38e17a 100644 --- a/wp-admin/import/wp-cat2tag.php +++ b/wp-admin/import/wp-cat2tag.php @@ -63,7 +63,7 @@ class WP_Categories_to_Tags { print '</ul>'; - print '<p class="submit"><input type="submit" name="maybe_convert_all_cats" value="' . __('Convert All Categories') . '" /> <input type="submit" name="submit" value="' . __('Convert »') . '" /></p>'; + print '<p class="submit"><input type="submit" name="submit" value="' . __('Convert »') . '" /></p>'; print '</form>'; } @@ -140,11 +140,23 @@ class WP_Categories_to_Tags { foreach ( $posts as $post ) { if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") ) $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')"); + clean_post_cache($post); } } else { + $tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'"); + if ( $tt_ids ) { + $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id"); + foreach ( (array) $posts as $post ) + clean_post_cache($post); + } + // Change the category to a tag. $wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'"); + $terms = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = '{$category->term_id}' AND taxonomy = 'category'"); + foreach ( (array) $terms as $term ) + clean_category_cache($term); + // Set all parents to 0 (root-level) if their parent was the converted tag $wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'"); } @@ -160,41 +172,9 @@ class WP_Categories_to_Tags { print '</ul>'; } - function convert_all_confirm() { - print '<div class="narrow">'; - - print '<h3>' . __('Confirm') . '</h3>'; - - print '<p>' . __('You are about to convert all categories to tags. Are you sure you want to continue?') . '</p>'; - - print '<form action="admin.php?import=wp-cat2tag" method="post">'; - wp_nonce_field('import-cat2tag'); - print '<p style="text-align:center" class="submit"><input type="submit" value="' . __('Yes') . '" name="yes_convert_all_cats" /> <input type="submit" value="' . __('No') . '" name="no_dont_do_it" /></p>'; - print '</form>'; - - print '</div>'; - } - - function convert_all() { - global $wpdb; - - $this->populate_all_categories(); - foreach ( $this->all_categories as $category ) - $this->categories_to_convert[] = $category->term_id; - $this->convert_them(); - } - function init() { - if (isset($_POST['maybe_convert_all_cats'])) { - $step = 3; - } elseif (isset($_POST['yes_convert_all_cats'])) { - $step = 4; - } elseif (isset($_POST['no_dont_do_it'])) { - die('no_dont_do_it'); - } else { - $step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1; - } + $step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1; $this->header(); @@ -214,14 +194,6 @@ class WP_Categories_to_Tags { case 2 : $this->convert_them(); break; - - case 3 : - $this->convert_all_confirm(); - break; - - case 4 : - $this->convert_all(); - break; } } |