Wordpress — why stop wp_insert_post()? -
trying load 4.5 million records in wordpress. import stops @ ~ 90 thousands. why so? if remove function wp_insert_post(), cycle runs (89 times). no errors in logs. please me
<? require_once('../../wp-load.php'); $host='host'; $database='database'; $user='user'; $pswd='pswd'; $dbh = mysqli_connect($host, $user, $pswd) or die("Не могу соединиться с mysql."); mysqli_select_db($dbh, $database) or die("Не могу подключиться к базе."); ($l = 0; $l <= 89; $l++) { $limit = $l * 50000; $sql = "select `npi`, `provider_last_name_legal_name`, `provider_first_name`, `provider_middle_name`, `provider_name_prefix_text`, `provider_name_suffix_text`, `provider_first_line_business_mailing_address`, `provider_second_line_business_mailing_address`, `provider_business_practice_location_address_city_name`, `provider_business_practice_location_address_state_name`, `provider_business_practice_location_address_postal_code`, `provider_business_practice_location_address_telephone_number`, `provider_business_practice_location_address_fax_number`, `provider_gender_code`, `provider_first_line_business_practice_location_address` `npi` `used` != 1 , `provider_last_name_legal_name` != '' limit ".$limit.", 50000"; $res = mysqli_query($dbh, $sql); $i = 0; while ($row = mysqli_fetch_array($res, mysqli_assoc)) { $post_title = $row['provider_first_name'] . ' ' . $row['provider_middle_name'] . ' ' . $row['provider_last_name_legal_name']; $defaults = array( 'post_status' => 'publish', 'post_type' => 'doctor', 'post_author' => 1, 'post_title' => $post_title ); /* $post_id = wp_insert_post($defaults, $wp_error); update_post_meta($post_id, 'npi_number', $row['npi']); update_post_meta($post_id, 'provider_name_prefix_text', $row['provider_name_prefix_text']); update_post_meta($post_id, 'provider_name_prefix_text', $row['provider_name_prefix_text']); update_post_meta($post_id, 'provider_name_suffix_text', $row['provider_name_suffix_text']); update_post_meta($post_id, 'provider_first_line_business_mailing_address', $row['provider_first_line_business_mailing_address']); update_post_meta($post_id, 'provider_second_line_business_mailing_address', $row['provider_second_line_business_mailing_address']); update_post_meta($post_id, 'provider_business_practice_location_address_city_name', $row['provider_business_practice_location_address_city_name']); update_post_meta($post_id, 'provider_business_practice_location_address_state_name', $row['provider_business_practice_location_address_state_name']); update_post_meta($post_id, 'zip', $row['provider_business_practice_location_address_postal_code']); update_post_meta($post_id, 'provider_business_practice_location_address_telephone_number', $row['provider_business_practice_location_address_telephone_number']); update_post_meta($post_id, 'provider_business_practice_location_address_fax_number', $row['provider_business_practice_location_address_fax_number']); update_post_meta($post_id, 'provider_gender_code', $row['provider_gender_code']); update_post_meta($post_id, 'provider_first_line_business_practice_location_address', $row['provider_first_line_business_practice_location_address']); update_post_meta($post_id, 'is_npi', '1'); */ $i++; unset($post_title, $row, $post_id, $defaults); } echo 'cycle: '.$l.'<hr>'; unset($post_title, $row, $post_id, $defaults); } ?>
Comments
Post a Comment