| 开发者 |
bauhaustech
marvila |
|---|---|
| 更新时间 | 2026年6月24日 07:52 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPL-3.0-or-later |
| 版权网址: | 版权信息 |
special_attachments column are imported one per background iteration, instead of all at once.
It does not modify Tainacan core — it registers an additional importer through the tainacan-register-importers hook, so it keeps working across Tainacan updates.
This is an independent add-on developed by Bauhaus Tech. It is not affiliated with, endorsed by, or part of the Tainacan project.
The problem it solves
A CSV import in which a single item has many attachments (e.g. 150 images in special_attachments) fails with:
PHP Fatal error: Maximum execution time of 360 seconds exceeded in .../class-wp-image-editor-imagick.php
…and then restarts from the beginning, duplicating items.
The stock Tainacan CSV importer imports all of an item's attachments inside a single after_inserted_item() call. Each file triggers wp_generate_attachment_metadata(), which generates thumbnails through Imagick — an expensive operation. The background process only checks its soft time limit (~20s) between task() iterations; since the 150 attachments run inside a single iteration, that limit is never checked mid-loop. The item alone exceeds PHP's hard max_execution_time, the process dies mid-task without persisting progress, and the cron healthcheck re-dispatches the batch from the last checkpoint — recreating already-imported items.
How it works
Instead of importing attachments inline, this importer:
max_execution_time still fails (pathological case).handle() checkpoint, not per iteration (forcing a per-iteration checkpoint would require changing Background_Importer::task() in core). A fatal within the same 20s window may reprocess what was done since the last checkpoint. The definitive fix is the equivalent change upstream in Tainacan.csv-resumable-importer-for-tainacan folder to /wp-content/plugins/, or install the ZIP via Plugins → Add New → Upload Plugin.No. It registers an additional importer through Tainacan's tainacan-register-importers hook and subclasses the core CSV importer. Tainacan updates do not overwrite it.
No. Delimiter, mapping, server_path and the special columns (special_document, special_thumbnail, special_attachments[|APPEND|REPLACE]) work exactly as in the native importer. Only the way attachments are processed changes.
No. It is an independent add-on by Bauhaus Tech, not affiliated with the Tainacan project.
It removes the real-world cause (a single item importing many attachments in one uninterruptible call). See "Known limitations" for the residual edge cases that would require a core change.
special_attachments one per background iteration.