$start = microtime(true);
echo " user profile";
exec('mysql -h' . $this->slaveDbHost . ' ' . $this->sourceDb . ' ' . $this->sourceDBuser . ' ' . $this->sourceDBpassword . ' -N -q -e "SET NAMES binary;SELECT SQL_NO_CACHE user.userid AS user_id, ABS(SUBSTRING(birthday, 4, 2)) AS dob_day, ABS(SUBSTRING(birthday, 1, 2)) AS dob_month, ABS(SUBSTRING(birthday, 7, 4)) AS dob_year, \'\' AS status, 0 AS status_date, 0 AS status_profile_post_id, usertextfield.signature, user.homepage, REPLACE(REPLACE(REPLACE(REPLACE(userfield.field2, \'&\', \'&\'), \'<\', \'<\'), \'>\', \'>\'), \'"\', \'\\"\') AS location, REPLACE(REPLACE(REPLACE(REPLACE(userfield.field4, \'&\', \'&\'), \'<\', \'<\'), \'>\', \'>\'), \'"\', \'\\"\') AS occupation, COALESCE((SELECT GROUP_CONCAT(DISTINCT relationid SEPARATOR \',\') FROM ' . self::$tablePrefix . 'userlist as userlist WHERE userlist.userid = user.userid AND userlist.type = \'buddy\'), \'\') AS following, \'\' AS ignored, LOWER(SUBSTRING(PASSWORD(MD5(CONCAT(user.username, user.userid))), 2)) AS csrf_token, \'0\' AS avatar_crop_x, \'0\' AS avatar_crop_y, REPLACE(REPLACE(REPLACE(REPLACE(userfield.field1, \'&\', \'&\'), \'<\', \'<\'), \'>\', \'>\'), \'"\', \'\\"\') AS about, \'\' AS custom_fields, ' . (self::$isVB4 ? 'CAST(user.fbuserid AS UNSIGNED INTEGER)' : "'0'") . ' AS external_auth, UNIX_TIMESTAMP() AS password_date FROM ' . self::$tablePrefix . 'user as user LEFT JOIN ' . self::$tablePrefix . 'usertextfield as usertextfield ON (usertextfield.userid = user.userid) LEFT JOIN ' . self::$tablePrefix . 'userfield as userfield ON (userfield.userid = user.userid) ORDER BY user.userid" ' . self::$extraOutCommand . ' > ' . self::$dataDir . 'xf_user_profile.txt');
echo " (" . number_format(intval(shell_exec('wc -l ' . self::$dataDir . 'xf_user_profile.txt'))) . ' records in ' . number_format(microtime(true) - $start, 2) . "s)...\r\n";