exec('mysql -h' . $slave_db_host . ' ' . $source_db . ' -N -e "SET @position = -1, @previous = 0;SELECT post.postid AS post_id, post.threadid AS thread_id, post.userid AS user_id, post.username, post.dateline AS post_date, post.pagetext AS message, post.postid AS ip_id, IF(post.visible = 0, \'moderated\', IF(post.visible = 2, \'deleted\', \'visible\')) AS message_state, attach AS attach_count, IF(@previous = post.threadid, @position:=@position+1, @position:=(0 * @previous:=post.threadid)) AS position, (SELECT COUNT(*) FROM reputation WHERE reputation.postid = post.postid AND reputation > 0) AS likes, \'a:0:{}\' AS like_users, COALESCE(infraction.infractionid, 0) AS warning_id, \'\' AS warning_message FROM post AS post LEFT JOIN infraction ON(infraction.postid = post.postid) WHERE post.threadid ORDER BY post.threadid, post.postid" | sed -r \'s/\[quote="?([^]";]*?);([^]";]*?)"?\]/[quote="\1, post: \2"]/ig;s/\[noparse\]/\[plain\]/ig;s/\[\/noparse\]/\[\/plain\]/ig;s/\[strike\]/\[s\]/ig;s/\[\/strike\]/\[\/s\]/ig;s/\[video\]http\:\/\/www.youtube.*v=([^&[]*?).*\[\/video\]/\[media=youtube\]\1\[\/media\]/ig\' > /tmp/postdump.txt');