Disclaimer: In case some future employer / potential client runs across this on the interwebs some day, please keep in mind that my reckless attitude here is due to this being my site and a site that's not of much importance outside occasional Drupal ramblings. I certainly take much more care when handling sites that aren't mine or that can't handle being down for days while I work my way out of whatever mess I've made.
Update the morning after: Well, it turns out there was more than the theme still broken. Comment Notify either isn't working yet on D7 or just doesn't like me. It left me with two empty comments and it looks like the body of them didn't get saved at all. I've turned Comment Notify off and comments are working again, now.
---
A few days ago I came to this rather neglected site intending to post one of my rare blog entries. Before I did that, I had a look at how out of date the updates where and boy were they ever. With 1.5 hours of childfree time ahead of me, I got to the latest on Drupal 6 and then, totally on a whim, pushed it further. I did a quick check to see if I was missing any critical contrib on Drupal 7, which I wasn't, and so settled in to upgrade. It's a simple blog site without much contrib. How hard can it be, I thought. Famous last words anyone?
I did a database dump before I started this process but that's where best practices and I parted company. I was winging it, just going from memory and bumbling along. With my data safe and no one paying me for my time, I wasn't too worried. I disabled contrib, set the theme to Garland, grabbed a copy of Drupal 7, copied it over, and ran update.php. No errors and everything looked like it went well. I was impressed with how easy it all was. Until I went to the main page. Hmm... No content. Garland was there in all its blue splendor, the friendly note reminding me that I was in offline mode was there, the block titles were there. But the content was all gone. In the blocks, on the main page, in the admin pages. Nada. No navigation, either. I was stumbling around in the dark without the benefit of memorized URLs since the admin structure has drastically changed since D6. Not good.
The first thing that came to mind was that silver bullet of Drupal: clear the cache. But how exactly do I do that with no navigation and no content? (Truncating the cache table had no effect) I got on IRC to get some help with finding path for it and ended up going round with Sun and a few others trying to figure out what was wrong. Sun wanted me to file a bug but I couldn't in good conscience do that knowing that there was a pretty good chance I had screwed it up. Not that I didn't spend some time grumbling at Drupal over Twitter and threatening to go back to Drupal 6, but I wasn't about to actually file a bug report without more solid evidence that Drupal was to blame.
At this point my 1.5 hours were up and I had to leave to go get my son from school. On the way, I mulled the problem over and my mistake dawned on me. Did you spot it in the 2nd paragraph up there? In hindsight, it's clear as day and I bet most people reading that were muttering, "You missed a step" up there. Yup, I did, a big one. I really don't know exactly what happened there. I mean, I know it's best practice to delete the existing files before untarring new ones. I've drilled that into people in contrib over and over. And I do follow it all the time in contrib. But, see, doing an rm -rf on an entire contrib directory is easy... Picking out which files belong to Drupal core and which don't is messy. I've gotten a bit lazy over the 20 point releases where copying over the top works and I do it anyway even knowing I shouldn't because, honestly, how often do whole files get deleted in a point upgrade? It's been well over a year since my last major core upgrade and they've been few and far between in the last 6 years. 20 point upgrades across multiple sites, well, that's enough to get in a bad habit and that, combined with my whole winging it attitude, burned me badly. Because, folks Garland really, really doesn't like being just copied over the top of. Makes for a bad, difficult to recover from mess. So don't do it. Seriously. (PS: Yeah, yeah, drush yada yada I'll look at it again some day :P )
So I came back from getting my son, got him occupied, and snuck back to the computer to test my theory. I did a proper file replacement and checked the site. No change. Of course, it's cached. And truncating the table wasn't enough. I needed to trigger the registry rebuild. I tried enabling admin menu in the database. No dice. So I started poking around in code to see if there was a path I could visit to trigger it. No luck there but I had a brainstorm. The contact module was enabled... I added in a call to cache_clear_all() in the contact.module code, visited /contact, and tada, the site popped into existence. Yay!
By this point I had had enough of screwing up and decided to be careful. I went to the module admin page and picked just 1 module to enable, and went over to update.php to do the sensible thing and upgrade contrib one at a time. Only to get a bunch of errors from disabled modules. Turns out update.php for some crazy reason updates modules you don't have enabled. So much for being careful. Another lesson in what not to do... Don't download all the contrib at once. Drupal can't upgrade what it can't find.
So, finally, core is upgraded, contrib is upgraded. The front page looks ok, nodes... Oops. Can't get to any nodes. Some error about redirecting in a way that will never finish. I've got two suspected modules: Global Redirect and Redirect, which replaced Path Redirect that I had on before. I pick Redirect to try first, disable, and, sure enough, that was it. Haven't got back to it to figure out why it was broken. Given my track record, here, I'm sure it was my fault. LOL! I'm just glad I actually went to a node before putting the site back online. The lesson here is really part of the overall lesson: always upgrade a test site first.
Now everything seems to be ok other than the theme. I go grab the D7 version of Sky, which I've been using on here forever, install it, figure out where to set it enabled and default, and go look at the front page. Uh... Why is the front page using Seven (the admin theme)? Click on some nodes - same deal. I try IRC to see if there's something more I have to do to select a new theme but no response. I give Bartik a try and that works just fine. Back to Sky. Nope. Or, wait... Finally I clue in on the thumbnail. Why is that brown? After all, Sky is a dark grey theme with some wispy clouds. Nope, not anymore. Seems Jacine's living under a brown sky these days. Ok, not really. But the gist is that Sky was never ported. There's a new base theme she's working on that is re-using the name space. To her credit, this is clearly stated on the project page. And I would have known that had I read it. So there's another what not to do tip: don't just check that there's a D7 version of your contrib stuff; make sure it still does what you want it to do in D7.
After spending a few hours trying and not liking various D7 contrib themes, I decided it's time this site gets something custom. I'm thinking a beach theme, sand, shells, to go along with the name. But that's going to take me some time to do and I don't want to keep the site down forever. After all, I do have that blog post I want to publish. So the site is going to hang out on Bartik for a while and back online we go. And that blog post? Well, I'll get to that tomorrow... :)
Comments
What I'm trying to ask is,
What I'm trying to ask is, "did MICHELLE forgot to upgrade test site first ?".
Worry about the time, you could save time and improve Adv Forum! Or create a module to inherit domain access settings to feed-item(Feeds/FeedAPI) or even give some extra homework to child ? Your time is very valuable to Drupal (not talking about money)
Didn't "forget"... Just didn
Didn't "forget"... Just didn't feel like it. Remember, all this upgrading was purely on a whim. There was no planning, no testing, just a lot of diving in and seeing what happens. Yeah, I wasted some time doing it, but, then, I waste time if I watch a TV show or surf the web, too. So, no, I'm not particularly worried that i spent the time on this rather than improving AF, which I already spend quite a bit of time doing, or writing a DA module, when I'm not going to be using DA anymore, or giving homework to my child when he gets enough of that from school. No one is paying me for my time. I didn't waste anyone's money nor bring down anyone's site but my own. My time may be valuable to Drupal but that doesn't mean I need to donate every last minute of it.
Hi Michelle,
Hi Michelle,
thanks for the very entertaining read. Your article reminded me to adhere to best practices as often as I can. Please keep us posted about the mistakes we shouldn't make. ;)
Excellent article :)
I found your article a very interesting read. I am sure it will make others aware of a correct way of upgrading :) rather than your way of doing it LOL :D
In my case...when I really find the time...I will probably create a whole new website from scratch based on Drupal 7 - not much content to transfer so can afford my way of doing things :D
Kevin
good info
for thanks your comment is very good