A backup plugin with a 400 MB appetite, a 1 GB server still serving live traffic, and a box that swap-thrashed until real visitors started timing out. Then the same plugin hung for six hours restoring a big multisite, doing row-by-row URL replacement across millions of rows. Too heavy at one end, too slow at the other. The fleet migration ended up with three ways to move a site, picked automatically: the plugin for ordinary sites, a streaming tar and mysqldump for the tiny boxes, and a direct database import for the giants.
Category: Code
Success: backup complete. So where’s the file?
All-in-One WP Migration printed “Success: Backup complete.” and wrote nothing. No archive, and no error on the command line. The admin screen told the real story: the plugin couldn’t create the guard files it drops into its backups folder, so it quietly gave up before writing a byte. On Bitnami that folder belongs to the bitnami user, but PHP runs as daemon, the group, with no write bit. The fix is the right owner plus chmod 2775, baked into the migration tooling so it never comes up again. A success message is a claim. Check the file is actually there.
Off Bitnami: migrating a WordPress fleet to managed Lightsail
Bitnami’s WordPress image on Lightsail is on its way out, which left me with roughly sixty live sites sitting on a foundation with a use-by date. This is the overview of moving all of them to AWS’s own managed blueprint. One site at a time, through a ten-phase pipeline that records every finished step to disk so a re-run picks up exactly where it broke. Old servers get stopped, not deleted, and sit there for a week in case something turns up. The constraints that shaped it, from no IAM roles on Lightsail to 300 host-key prompts, each get their own post in the series.
Read more "Off Bitnami: migrating a WordPress fleet to managed Lightsail"
I fixed this in August. It came back in September.
In August a forms plugin couldn’t write under uploads on a freshly migrated server, so I wrote a repair script for uploads. In September the migration plugin couldn’t “create” a file that already existed, nowhere near uploads. Same cause both times. Files unpacked by the admin user came out 755 and 644, and setgid on the parent carries the group across but not the permission bits. The real fix is setgid plus a umask of 002 at provision time, with a wider repair sweep for boxes already out there. When a repair script takes a path argument, be suspicious of the path.
Read more "I fixed this in August. It came back in September."
The plugin that killed the site on activation
A private update checker I’d built took a WordPress site down the moment a plugin was activated. The culprit was load order. Active plugins register their update slug before init, then my must-use plugin tried to register the same slug again on init, and the update library reports a duplicate with E_USER_ERROR, which is fatal with debugging on. The fix was one line: ask the library’s slug-in-use filter first and skip anything already claimed. Two bits of code that each “just register the slug” are fine, right up until they both do it in the same request.
Defer JavaScript in WordPress – fixed
I was recently contacted by a past WordPress site client, desperate because they couldn’t create new posts or pages, and all of their media had gone! Why had the site broken? Was it something I did a couple of years ago coming back to bite me? Time to do some debugging.
I’ll cut a long story short, and say that I did all the usual things here – updated core, theme, and plugins, ran a security check to verify no compromised files, used the excellent Health Check & Troubleshooting plugin, all to no avail. My final, dreadful thought – has somebody made changes to my repository managed, custom child theme‽
Dear reader, even with **DO NOT EDIT** notices front and centre in the themes files, somebody had gone ahead and made edits to those files, and while they had fixed the issue on the front end, they had badly broken the admin.
“What was the issues that they fixed?” I hear you ask – Deferring loading of JavaScript to decrease the load time of pages. The method used to achieve this is a simple snippet which can be found on numerous sites with a simple search, is often coupled with a request or aim to “get a better GTMetrix score”, and almost every snippet presented is WRONG.
