本文整理汇总了PHP中PMXI_Import_Record::delete_missing_records方法的典型用法代码示例。如果您正苦于以下问题:PHP PMXI_Import_Record::delete_missing_records方法的具体用法?PHP PMXI_Import_Record::delete_missing_records怎么用?PHP PMXI_Import_Record::delete_missing_records使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMXI_Import_Record
的用法示例。
在下文中一共展示了PMXI_Import_Record::delete_missing_records方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
//.........这里部分代码省略.........
$history_log->set(array('time_run' => time() - strtotime($history_log->date), 'summary' => sprintf(__("%d %ss created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, $custom_type->labels->singular_name, $import->updated, $import->deleted, $import->skipped)))->update();
}
unset($file);
PMXI_Plugin::$session->set('pointer', PMXI_Plugin::$session->pointer + $pointer);
PMXI_Plugin::$session->save_data();
$log_data = ob_get_clean();
if ($log_storage) {
$log = @fopen($log_file, 'a+');
@fwrite($log, $log_data);
@fclose($log);
}
$iteration_execution_time = time() - $iteration_start_time;
wp_send_json(array('imported' => $import->imported, 'created' => $import->created, 'updated' => $import->updated, 'skipped' => $import->skipped, 'percentage' => ceil($processed_records / $import->count * 100), 'warnings' => PMXI_Plugin::$session->warnings, 'errors' => PMXI_Plugin::$session->errors, 'log' => $log_data, 'done' => false, 'records_per_request' => $import->options['records_per_request'], 'iteration_execution_time' => $iteration_execution_time));
}
}
}
}
}
// Move to the next file, set pointer to first element
if ($ajax_processing) {
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path)) {
@unlink($path);
}
PMXI_Plugin::$session->set('pointer', 1);
$pointer = 0;
$lp = PMXI_Plugin::$session->local_paths;
array_shift($lp);
PMXI_Plugin::$session->set('local_paths', $lp);
PMXI_Plugin::$session->save_data();
} else {
break;
}
}
}
}
// delete missing records
if (PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->local_paths) or !$ajax_processing) {
ob_start();
$is_all_records_deleted = $import->delete_missing_records($logger, $import->iteration);
$log_data = ob_get_clean();
if ($log_storage) {
$log = @fopen($log_file, 'a+');
@fwrite($log, $log_data);
@fclose($log);
}
$iteration_execution_time = time() - $iteration_start_time;
if ($ajax_processing and !$is_all_records_deleted) {
wp_send_json(array('imported' => $import->imported, 'created' => $import->created, 'updated' => $import->updated, 'skipped' => $import->skipped, 'deleted' => $import->deleted, 'percentage' => 99, 'warnings' => PMXI_Plugin::$session->warnings, 'errors' => PMXI_Plugin::$session->errors, 'log' => $log_data, 'done' => false, 'records_per_request' => $import->options['records_per_request'], 'iteration_execution_time' => $iteration_execution_time));
}
}
if (PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->local_paths) or !$ajax_processing or !empty($import->canceled)) {
$import->set(array('processing' => 0, 'triggered' => 0, 'queue_chunk_number' => 0, 'registered_on' => date('Y-m-d H:i:s'), 'iteration' => ++$import->iteration))->update();
if ("ajax" != $import->options['import_processing'] and $log_storage) {
$log_file = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
if (PMXI_Plugin::$session->action != 'continue') {
@file_put_contents($log_file, PMXI_Plugin::$session->log);
} else {
$log = @fopen($log_file, 'a+');
@fwrite($log, PMXI_Plugin::$session->log);
@fclose($log);
}
}
wp_cache_flush();
foreach (get_taxonomies() as $tax) {
delete_option("{$tax}_children");
_get_term_hierarchy($tax);
}
$import->set(array('registered_on' => date('Y-m-d H:i:s'), 'executing' => 0))->update();
wp_defer_term_counting(false);
wp_defer_comment_counting(false);
// add history log
$custom_type = get_post_type_object($import->options['custom_type']);
$history_log->set(array('time_run' => time() - strtotime($history_log->date), 'summary' => sprintf(__("%d %ss created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, $custom_type->labels->singular_name, $import->updated, $import->deleted, $import->skipped)))->update();
// clear import session
PMXI_Plugin::$session->clean_session($import->id);
// clear session data (prevent from reimporting the same data on page refresh)
// [indicate in header process is complete]
$msg = !empty($import->canceled) ? addcslashes(__('Canceled', 'wp_all_import_plugin'), "\n\r") : addcslashes(__('Complete', 'wp_all_import_plugin'), "\n\r");
if ($ajax_processing) {
ob_start();
}
do_action('pmxi_after_xml_import', $import->id);
$import->delete_source($logger);
$import->options['is_import_specified'] and $logger and call_user_func($logger, 'Done');
echo <<<COMPLETE
<script type="text/javascript">
//<![CDATA[
(function(\$){\t
\t\$('#status').html('{$msg}');\t
\twindow.onbeforeunload = false;
})(jQuery);
//]]>
</script>
COMPLETE;
// [/indicate in header process is complete]
if ($ajax_processing) {
wp_send_json(array('imported' => $import->imported, 'created' => $import->created, 'updated' => $import->updated, 'skipped' => $import->skipped, 'percentage' => 100, 'warnings' => PMXI_Plugin::$session->warnings, 'errors' => PMXI_Plugin::$session->errors, 'log' => ob_get_clean(), 'done' => true, 'records_per_request' => $import->options['records_per_request']));
}
}
}