Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#6505 closed defect (bug) (worksforme)

WordPress Simple Tagging Import Problem

Reported by: makawork's profile Makawork Owned by:
Milestone: Priority: high
Severity: major Version: 2.5.1
Component: Import Keywords:
Focuses: Cc:

Description

I upgraded my WordPress 2.3 to 2.5. Everything seems to work fine except importing tags (Simple Tagging).

It says that I have 18.030 tags in 1st Step, but I couldn't import all my tags to WordPress (I just imported 4810 tags)

I don't get any error messages and operation stops @ "Adding Tags to Posts…" (Step 2)

Change History (6)

#1 @na3s
16 years ago

I made a duplicate ticket, with a scarily identical name, so I am going to transfer it's information over here. This user provided very little information:

Simple Tagging Import is NON-FUNCTIONAL. When attempting to import tags the following occurs:

1) Step 1 -> Runs smoothly, counts the rows in WPPREFIX_stp_tags table, presents the user with number and 'Step 2' button. 2) Step 2 -> Appears to run, for 1-2 minutes, and then the loading stops and it displays "Adding Tags to Posts…" it does not go ANYWHERE after this, and is broken halfway through the import.

When examining this further, I have concluded that it successfuly adds the tags from the WPPREFIX_stp_tags table to the wp_terms table, but fails to add the tags to the posts; hence failing to create the relationships between a post and it's tag(s).

This bug prevents any user relying on Simple Tagging in previous versions to upgrade to 2.5.x. It makes the upgrade task impossible.

I tested this bug in 3 browsers (Safari, IE, firefox), the bug remains consistent.

When working on this bug it will be important to keep in mind that many users will have already gotten halfway through the (broken) Simple Tagging import process. Therefor, the script will need to recognize a broken transaction (tags already imported, but no relationships made)

#2 @na3s
16 years ago

  • Milestone changed from 2.7 to 2.5.2
  • Severity changed from normal to major
  • Version set to 2.5.1

I have spent some time trying to debug this, but cannot locate the source of this issue. Within the function 'tag2post' the function 'wp_add_post_tags returns' false. The parameters being fed into this function are $the_post and $the_tag, both of which seem to have no errors, and the correct types (an integer and a string). I have a feeling it may be an error somewhere in the file wp-includes/post.php, but have no way of verifying this. Below is an alternate tag2post function I used while attempting to debug this issue; it may be of use to someone.

function tag2post ( ) {
	global $wpdb;

	// get the tags and posts we imported in the last 2 steps
	$posts = get_option('stpimp_posts');
	$total = count($posts);
	
	// start at one
	$tags_added = 0;
	
	//make a pretty scrollable boxy
	echo '<div style="height:300px;width:auto;overflow:scroll;">';
	echo '<strong><u>TOTAL:'.$total.'</u></strong><br />';	
	// loop through each post and add its tags to the db
	foreach ( $posts as $this_post ) {
		$the_post = (int) $this_post->post_id;
		$the_tag = $wpdb->escape($this_post->tag_name);
		
		//echo some data about each row.
		$wtfoutput = $tags_added."->|".$the_post."|<em>(".gettype($the_post).")</em> |".$the_tag."|<em>(".gettype($the_tag).")</em>";
		
		// try to add the tag to a broken function and output a friendly status message.
		if(wp_add_post_tags($the_post, $the_tag)) {
			$wtfoutput .= ' <strong style="color:#00ff00;">Success!</strong><br />'."\r\n";
		} else {
			$wtfoutput .= ' <strong style="color:#ff0000;">Shitty.</strong><br />'."\r\n";
		}
		echo $wtfoutput;
		$tags_added++;
	}
	echo "</div>";
	if ($tags_added == $total) {
		echo '<strong>COMPLETE!<strong>';
	} else {
		echo '<strong>Bad News...<strong>'.$tags_added.' != '.$total;
	}
	

	// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
	return $tags_added;
}

#3 @ryan
16 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#4 @DD32
15 years ago

  • Component changed from General to Import
  • Owner anonymous deleted

#5 @Denis-de-Bernardy
15 years ago

suggesting wontfix from lack of traction. tags have presumably been open ages ago.

#6 @filosofo
15 years ago

  • Milestone 2.9 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Reopen with additional information.

Note: See TracTickets for help on using tickets.