Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > feedmelinks.com/import/de-dupe-lists.inc.php
<%
	# 4. now we exhaustively loop over LINKS.RAW(looking at just the
	# links) and TAGS.RAW against the users links in the FML
	# database, and stream the files back out to disk, marking
	# an X before any link or tag found in the DB. This is a
	# convenience feature for users who have been using FML for
	# awhile, so that duplicate links are handled and merged
	# properly. Save the new files as LINKS.READY and TAGS.READY

	$lp = open_user_file_for_write( $config->get_deduped_links_cache_file_name() );
	$tp = open_user_file_for_write( $config->get_deduped_tags_cache_file_name() );

	$dupes = 0;

	for( $i = 0; $i < $ls; $i++ ) {
		$line = rtrim( $links[$i] );
		$l = preg_split( "/$delimeter/", $line );
		if( users_link_exists( $u, $l[0] )) {
			fwrite( $lp, "X {$links[$i]}" );
			++$dupes;
		} else
			fwrite( $lp, $links[$i] );
	}

	for( $i = 0; $i < $ts; $i++ ) {
		$line = rtrim( $tags[$i] );
		if( users_tag_exists( $u, $line )) {
			fwrite( $tp, "X {$tags[$i]}" );
			++$dupes;
		} else
			fwrite( $tp, $tags[$i] );
	}
	fclose( $lp );
	fclose( $tp );

	l( "$u had $dupes dupes on import" );
	#tell( "Debugging Check:", "Successfully wrote 2 new READY files." );
%>

Return current item: FeedMeLinks, Social BookmarkingSince2002