I want to create a plugin that does some work in the background. I have a user interface in the admin backend where I have some buttons:
- start fetching posts
- stop fetching
When I press start fetching the plugin fetches some texts from an external API and creates a WordPress post for each text. But that are about 500.000 texts which have to be fetched. Since WordPress is based on PHP and I am not able to activate ZTS (thread-safety) for PHP on my webserver, each request for each text is made sequentially
- send request to API
- process the response
- create a WordPress post (and maybe category) for the text
- if there are texts left, goto 1.
So for about 500.000 texts this takes a lot of time. I wanted to know if you have an idea or a solution how to make the script faster or maybe how to use multi-threading, even if I don’t have the ability to activate ZTS.