Thank you for the detailed explanation but unfortunately, this is a known issue that is not yet solved. I’d try the same things you tried, so I don’t have other ideas :/
I’m still not completely sure why it happens (I could never replicate it locally so trying to fix it was always a lot of guessing), but it might be:
- scanning for actual files – I already optimized this part as much as I knew how, or
- there is just too much UI to render – because this plugin lists all of the files at once (they are just hidden/collapsed, but it’s all there in DOM). That was actually the main reason to create this plugin. Because the only existing plugin I could find at the time (https://wordpress.org/plugins/add-from-server/) had pagination so I had to open each directory, select all, and then do import many times.
So this approach worked fine for my needs at the time, but many people reported this memory issue already, and any solution I could think of (simpler list of files, no list, paginated list, etc.) would require rewriting almost the whole plugin. So I never found time to do it.
Hi erolsk8,
First of all, thank you for developing this plugin.
But pls consider to add an option(a checkbox) for slower importing, the plugin saturates the server resources.
it’s really aggressive, specially on slower servers, no need to rush 🙂
Hi @miladaliyari, known issue I explained above was before the actual import, so just while scanning the files.
Importing should already be quite optimized since it imports files in batches of 10 which shouldn’t require much resources (it just adds a few database records per file, but no file is moved, copied, etc.). Maybe some other plugins listen to some of these updates and run their own actions.
I just tried to import 3259 images in WordPress 6.2 (PHP 7.2.34) on an actual (cheap/basic) server, so not locally – and it worked fine. The only issue I found was that it stopped when my computer went to sleep (because it was taking so long). But then I just ran import again and it continued where it left off. I imagine that similar thing could happen if your WP login session expires. And slowing it down even more would just make this more likely to happen.