[wp-hackers] Mass-Import Process to run in background
Nicholas Ciske
nl at thoughtrefinery.com
Wed Apr 23 17:16:01 UTC 2014
You break it into chunks -- usually via ajax requests (or meta-refresh if you cant to go old school).
Basically, you make a call to process X rows, that call returns when it's done, you update the % done accordingly, then make the next call to process another X rows.
As long as each call completes within the timeout (be conservative for crappy shared hosting), you just keep hammering away until the import is complete.
The WooCommerce CSV importer is a pretty good model for this (not free, but solid code).
A free plugin model would be an ajax thumbnail tool like:
https://wordpress.org/plugins/ajax-thumbnail-rebuild/
_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske
On Apr 23, 2014, at 11:32 AM, Alex Hempton-Smith <hempsworth at gmail.com> wrote:
> Hi all,
>
> I have large amounts of CSV data (around about 7k rows) to import, each row
> being a new post (CPT) and various meta fields.
>
> I can open and print out the contents of the file to the browser fine, but
> I just know running that import will time-out.
>
> Within a WordPress plugin, how do a run a large process like that? And even
> better, provide some kind of 'percentage complete' feedback to the user?
>
> Thanks,
> Alex
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list