Wednesday, November 6, 2013

Four on the Floor

If you want a real thrill, try making changes to a live WordPress site after a recent deployment and numerous unknown changes by a third party half an hour before marketing needs the updated site for a client meeting...

Yes, this is what has happened to me, not once, but twice in the past two weeks!  We find ourselves bereft of a relevant testing environment, in the midst of trying to create local testing environments and a subdomain environment in addition to github.  However, before all of those dev environments got set up correctly, we had to debug a few items from the recent re-deployment/migration.

Step One: Change the featured image for a page so Facebook gets it right, and break the site!  Okay, the whole site didn't break, but we suddenly lost the very page we were trying to fix.  Lost as in it didn't display AND we couldn't find the file on the FTP.  Upon trying to move the local version of the file, we found we suddenly didn't have permissions to change that directory. Enter "Sam", in charge of recent re-deployment, who enlightened us to the fact that after the deployment, "Owner" of most files and directories had changed to "Apache" from "Our Organization".  After changing the ownership back, we were able to get the file back on the website, the page worked again, AND I figured out how to get Facebook to display the correct thumbnail for the specific page using their "developer" documentation.  Actually, some of the better documentation I've seen (including you, WordPress).

Step Two: Unable to upload images through the wp-admin screen.  Attempted to deactivate and reactivate a few plugins, as recommended in the aforementioned WordPress documentation, and lo and behold half of the styling for the site was lost!  Oh my!  At this point I literally had to sit down because I had no clue what the problem was or how to fix it.  Before restoring a backup of the whole site (I know, I know, stop panicking, Jessica), I fished around the office for some help from other developers not working on this specific site.

After some handy "inspection of element", we discovered the essential css had been lost.  Part of the problem was that we were used to using the Appearance --> Edit CSS part of the Jetpack plugin to easily add and override CSS.  Probably not the cleanest or most efficient, but since the site has dozens of style.css files, this seemed like the intuitive choice.  Some mysterious element called "Custom CSS" had disappeared from the site quite a while ago, as we saw from a recent download of the site to my computer.  So we went back to the now defunct test site, went into Edit CSS, copied the whole file, pasted into the theme's style.css with a few "!important"s thrown in for good measure, and lo and behold the style came back and two hours later I was exactly where I'd started.  I was beginning to feel like the only thing I could accomplish was not making the site worse, and if it was the same at the end of the day as at the beginning of the day, then I was doing well.  Sheesh.

Needless to say, these are not the best nor permanent fixes.  I would love to be able to test the site back into normal health, but ironically that is proving more difficult than it seems since every attempt as creating a new testing site under a subdomain manages to somehow, you guessed it, break part of the live site.

Things I have learned:

  • WordPress is not simple.  It is complicated and often unpredictable.  Especially plugins.
  • Don't feel brave.  Instead, make a backup, then try the very smallest change possible.
  • Sites break every day.  Today just happens to be your day.  Tomorrow will be someone else's.
  • An efficient, intuitive testing system must be setup when the site is created.  Unless you want a site that never changes ever again. 
  • The database(s) in WordPress are essential.  Even though they may appear "black box" like, take them into consideration when creating backups, development sites, and local versions.  Learn to work with and love them, not ignore and delegate them. 


No comments:

Post a Comment