@#$%^& WordPress ate my post!

I finally had a candidate board layout for sending to a board house to start production of my recording preamps.  There were quite a few changes, so to test the layout I etched one single sided, with a few minor hacks to deal with that.  I populated it and it didn’t work right.  The high and low reference voltages for the 3914 that displays the voltage on the AGC averaging cap were off.  Did I really blow the values in the divider chains that determined those values?  Troubleshooting time.

Calculating the resistors for a 3914 from the datasheet is doable, but I’ve already done it and even carefully recorded both the technical details and design decisions here in these Project Notes just so I wouldn’t ever have to do it from scratch again.  <searches for “3914”>  It’s not there!  WTH?

<searches local disk>  I found the .png exports of the little schematics I did in Eagle for the explanation.  I’m positive I wrote this up and posted it here.  What’s going on?

Searching posts mentioning 3914, I found a note in this post about WordPress losing some updates.  I’d had an edit window open longer than they support, and when I tried to save, it discarded my latest work and sent me to a login screen.  Since I’d been inactive for a while before entering the last paragraphs, the autosave feature didn’t kick in to help.  Not that it would have helped much:  One other time I tried to use an autosaved version and was completely stymied by the inscrutable user interface to restoring old versions.  Since it only saves one old version, in stumbling around trying to use the saved one I lost it.  Your autosave feature isn’t very useful if a motivated user can’t figure out how to use it, WordPress!

I was about to go through the 3914 resistor calculations again, and document it again, when I remembered I’d done backups of the database.  Might the lost details still be in the backup? I found the 12MB file in the nicely labeled _db_backups directory and pulled it down.  Doing a string search in that .sql file, I found the writeup!  It was unformatted, ugly, and difficult to read, but it was there.  Worst case, I can resurrect the details from there, easing the task of rewriting it all.

But it’s a backup.  Can I get the system to do it for me?  How do you restore a backup?  Ugh – if I restore that one, I lose all the recent stuff.  OK, I could do a new backup, renaming and keeping track of the files, get the old stuff back, save it somehow, and restore the new backup to get back where I started.  Unless of course something went wrong, which seemed all too likely.

In googling how to restore, someone made the clever suggestion of making a completely separate second WordPress installation and restoring to that one, leaving the good instance safe and sound.  So I did that, with the new one in the wordpress2 directory paralleling the original wordpress directory.  I even succeeded in importing the backup database, though I had to do it from a file on my PC rather than on the web host.  And I could see the missing writeup!

But it was worse than I expected:  It wasn’t just a couple of paragraphs that were missing – it was a whole post!  I can’t believe I would have intentionally deleted it, so I have no idea what happened.  But if there was one post missing, how many more had disappeared?  There’s direct SQL access to databases from by MyPhpAdmin (after you find it, which always takes several tries.  Howto: Log in, My Account, Web Hosting, my hosting, Databases, My SQL, choose database, log in to that database, expand the database in the left hand pane, choose a table.)  Using Browse Distinct Entries on the post_title field of the wp_posts table I did queries on both new and old databases to get sorted listings of all the post titles.  There were 499 in the old db, 735 in the new.  When I diffed the lists, to my relief there was only one title in the old list that wasn’t in the new list.  (And that was the one with the 3914 details.)  Whew!

OK there’s only one post to deal with.  How to restore a single post?

I could use SQL from MyPhpAdmin to export a row from any table in one database, even formatting it as an Insert command so it could be applied to another.  But while there were a few obvious relations, I don’t understand the database structure well enough to be positive I could hack everything in seamlessly.  Rats.

So I tried to log in to the admin page, edit the old post, copy the content – probably from the HTML view – and paste it into a new post in the good database.  Nope.  I couldn’t log into the wordpress2 instance.  No matter what I did, it always logged me into the original instance.  Rats.

So I just viewed the post from the old imported database, highlighted and copied all the text in the browser, started a new post in the good database, and pasted the text in.  It lost italics, links, heading formatting, and of course all the pictures.  So I painstakingly restored all that stuff manually.  The pictures were still there, but hard to find.  I found that by hovering over a picture in the old post, I could see the file name.  Searching for that name (or a substring) made it quite quick to find the pictures as I was putting them back in.  There were a couple of pictures with 2 instances in the media library – maybe I’d updated a picture and uploaded a new version?  I didn’t try to make sure I got the latest versions.  But I did get it all done.

And finally I could read the note, relearn how the resistor calcs worked, and was able to finish troubleshooting and repairing the board that started the whole thing.  Ugh.

This entry was posted in WordPress. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *