Thursday, 21 November 2013

#1 How to Update Drupal 7 Modules and Drupal Core

This rough transcript is not by Peter Yoworski and will include a few mistakes

How to Update Drupal 7 Modules and Drupal Core - Advanced Ubercart series #1

Hullo and welcome to . I am Peter Yoworski, the Toronto website developer specialising in Drupal. This is the first video tutorial in our second video tutorial series on creating an ecommerce site using Drupal & Ubercart. This video tutorial like the first is brought to you in collaboration between myself and the team. We thought that it would be great to continue our learning and take a look at some advanced topics covering Drupal & Ubercart.

In this video series we are going to take a look at updating our ecommerce site, which we forgot to do in the previous video tutorial series, so that is why we will be covering it today, and we will also look at things like the Feeds Module, which allows you to import massses of products into your actual site, to get your site up and running in no time. Then we will take a look at advanced theming concepts. We will be covering things like the ?Less Framework, doing a bit of CSS, talking about how to do your own theme. I know we started talking about that in the first video tutorial series[0'55"] but we didn't get into the chunky vegetables of theming, so we'll be looking at that in this video tutorial series.

We'll also be looking at some - you know: some "use case scenareos" for Ubercart. So, briefly, we've dealt with file downloads and such but hwe haven't got into the chunky vegetables of what you can do with Ubercart. So maybe we'll take a look at a event registration site, im, maybe a question and answer site, that kind of thing.
We'' be covering those types of topics and some topics that people have posted on the video tutorials, wanting to see some discussion around certain concepts. If there is anything you would like to see out of this video tutorial series, please comment now; put it online, because in the next few months we will be shaping-up how the final finishing touches will look. So if there is anything you want to see please let me know so that I can incorporate it. [1'41]
That said, we are going to go ahead and we are going to update our site. That is something we should have done in the first video tutorial series when we went live, but unfortunately I forgot to show it to you, so I want to make sure that right away. What this allows you to do is ensure that your site is secure and that you have the most recent security patches for all your modules, as well as Drupal core. [2'00"]
In recording these video tutorials, usually I like to walk-through [the process myself] and then record them [the videos] to ensure that I don't stutter or screwing things up. Not that I don't stutter to begin with in these video tutorials. But in doing that I actually forgot to back-up the entire site so when I updated and walked through the whole thing, I actually updated the site we were going to update together. [2' 25"] My Ubercart Tutorial Series [site] is now up to date and has got probabaly the most recent version of Drupal Core, so we can't actually update this site. [2'28"]
What we are going to do is update my local development site that I use for my other video tutorials: TWD box 7. It is going to be the exact same concept, but it is going to be on a local server rather than our FTP server. I will flag for you what that means when we are actually doing things, but beyond that , it is not going to be much of a difference. [2'46"]
The first thing we want to do when we update our site is that we want to go ahead and put our site into maintenance mode. The reason why we do this is because we want no change in the database; we do not want anything happening when we are working on our site: [3'00"] make sure that we are not going to screw anything up. The way that we do that is that we go to
>configuration >development >maintenance mode
Now: when you get here, you are going to go ahead and check this little box that says
Put site into maintenance mode
You are able to customise your own message [to viewers of the closed site]. I am going to leave this [default message] which Drupal Core provides me. You can put whatever you want. You know: "thanks for your patience - back in five minutes"; whatever you want to say. So you go ahead and
Now, if I open a new browser, and I go to [my site on] localhost/twdbox7/ , we get a
TWD D7 Sandbox
Site Under Minenance
TWD D7 Sandbox is currently under maintenance. We should be back shortly. Thank you for your patience.
That's what was typed in; that's what users will see. Unless they have permission to administer the site, which I hope they do not. So that's that. We are now into maintenance [mode]. And now we should back-up the site. [3'43"]
The manual way that we do this, if you remember from the first video tutorial series, is....
I realise now that I probably do not have the module set-up. Oh - no, I do. That's great.
In the first video tutorial series we downloaded Backup and Migrate . We are now ready to go ahead and actually use that module. [4'00"]
System >backup and migrate
We are going to manually backup our database using default settings
So I am going to go ahead and back-up now, and you will see that it comes-up as an actual file that I can save to my desktop. Good. Now I have a backup of my database in case I really screw everything up.
While we are here, as a sidebar, we should have set-up schedules when we set-up the site, to make sure that we always have our site incrementally backing-up. You just go ahead and hit +add schedule here. You've just got to make sure that our private file system is set up. It is pretty straightforward. You can walk through this type of thing: you choose a schedule name, default settings (just leave it as default; you don't need it to do anything crazy). Buckup every - I would say every
unless you have a super-active site. Otherwise it would be kind of wierd.

The destination: obviously I don't have my destination listed here because I don't have my file system ready. When you have done that, you will have a destination available to you. That is the way to go about doing that.
So, we are going to go about doing a backup. [5'00"] The other thing that we want to do, if we are going to backup files on our site, and in case we screw-up.... Actually when I was preparing for this video tutorial series I and this video I actually really did screw up the site. So when you are preparing to update your site you should go ahead and backup all your files. Everything. Open up your FTP server, or client, rather. Download your entire site: all your Drupal installations. By that, I mean: I shall walk you through what ours actually look like. [5'25"]
So here is my site - TWDbox7 - so just copy everything in there, download it, in case you scew-up and you need to get the site back up right away. That's it. We are now ready to go. [5'40"]
You will see that we are getting these messages about security updates.
When we set-up our site in the first video tutorial series, when we were choosing which modules to enable, we anabled the Update Manager. What that update manager does is that it keeps track of when you have to update your modules in your site. [5'57"] But it can can secure the install and update web interface so that you can do a one click download and install of everything. I am going to show you how to do that. It is actually pretty easy. You just go to >modules>update and here are all your modules that we need to update. This list is obviously going to be a little bit different for you, and I apologise for doing this to the site without you guys, but you just go ahead and click "all" [top of the list next to NAME] of the files here, and you are going to download these updates.
You will see here that
Muanual updates required
Updates of Drupal Core are not supported at this time
Drupal Core (security update)
This is because Drupal Update Manager cannot actually do Drupal Core by itself. And so we will manually walk through how to do that. Meanwhile we will go ahead and click
, and you can see that Javascript bar going across [the screen] to show the progress. I am not going to make you painfully wait through all that, so I will see you when this is done.
So: there we go. Now we are done. And you will see here that we have got this
Perform updates in site maintenance mode (strongly recommended)
We are obviously still in maintenance mode, so that is good. What this [continue button] will do is actually update the modules for us now. It does not update php which is another thing that we will have to do. So we will go ahead and click
Now we are back here with a bar going across the screen showing progress while we update the site. I'll just skip past this so you don't have to sit through the wait for it.
So there we go. So we have updated everything - well we have not updated everything, but we have updated [7'15"] all of our modules. We see that they are all installed successfully.
Next steps
  • Your modules have been downloded and updated
  • Run database upates
The next thing that we are going to do is run database updates. We will go ahead and we will click that. So now we are here on the / file [page]. We hit

The version of Drupal you are ubpdating from has been automatically detected.
3 Pending Updates
admin_menu module

advanced_forum module
devel module
What it means is that these modules are going to make changes to the database, depending on what they have already installed in the database, so we will go ahead and hit

Then, again, you are going to get the status bar confirming the updates. It's usually pretty quick. Usually you get a summery of what has changed here, but obviously we're not actually getting that, so things should not be too bad. We've got no failures, so we are good to go. [7' 54"]

That's updating the modules. I didn't mention that I was taking for granted that you were doing this as the super-user. That is, user 1 from your site, with access to everything. If you are not, and you can't find - you know, you have enabled the update manager and you can't find it, or you can't find the backup and migrate, it is going to be a permissions issue. So you want to go back and make sure that the role that you are using has permission to do everything that we just did. You would do that by going to
people >permissions >roles here and having a walk-through to check that everything is as it should be.

So, as I mentioned, we updated the modules but we have not updated drupal core. I'll show you how to do that because it has to be done manually. And after that I am going to show you an alternative to all of this that will really streamline your life and make things a lot easier, and that is to use Drush, which stands for the DRUpal SHell. What it is I guess is actuall command line scripting, or a series of scripts that you can use to make things a lot easier. It's maintained on and it's listed there a project, but it's not an actual project module that you install. I guess it is something that you install to your server and then use to manipulate, you know, common functionalities [9'00"] or common tasks that you will be using on your Drupal site to make things a lot easier. Updating is one. Backup is another. It's really cool because a lot of modules will hook into it and you can do some pretty neat stuff. So I will walk you through that afterwoulds. [9'15"] But now I am going to show you...

how to manually update Drupal Core.

As I mentioned, we doing this all locally; you are going to have to pretend that we are doing it by FTP.[9'22"]
Here I am going to go through all this and copy everything except my /sites/ folder - so I have selected everything [by cut-and-paste] . What I am going to do is go a bit crazy, and I am going to delete everything
Delete multiple items
are you sure you want to permenantly delete these 27 items?
I'll click Yes because we are in the right place here, and delete all of this. What this actually does is it removes all of Drupal Core. The reason why we do that is that when we update, we are going to replace all the core files, and we want to make sure that we do not screw anything up; we want to make sure that there are no conflicts when we put in the new files for the new version. [deleting finishes]
So that's all gone.
The reason why we did not do the /sites/ folder is because, as I mentioned previously, we never hack Drupal Core. Don't touch any of the core folders. [10'00"] The only thing you should be touching is your /sites/ folder. That's were your set-up to the database, and you files should all be. Everything you set-up should be in your /sites/ folder, and you should never go into your core /modules/ folder or your core /themes/ folder to do anything. That is why, in the previous video tutorial series, when we were playing around with a theme, we copied that theme into /sites/all/themes/ and then played with it a little bit there. And the reason for that is that when you hit "update", you are going to over-ride anything that you do.
So I am going to go to a [new set-up of] Drupal 7.21 which is the most recent version at the time of this recording and I am going to copy everything except the /sites/ folder, because we already have that. I am going to put everything into my [directory which is] TWD7 sandbox.

So once I do that, I am going to go back to my site and we are just going to re-load it, and I hope that I did not seriously screw anything up like I did when I was first rehearsing this video tutorial series.
We can see the site. It comes-up. It's still got a home. My tabs are OK; everything looks good. [11'00"] So the files are good but the one thing we have not done is updated the database. So we go to [headed "Drupal Database Update" with a drupal logo] and hit . [A screen with a box headed "pending updates" is shown.] You will see that we have got pending updates. So we know what Drupal is going to update in the database. Specifically system nodule and forum module. They are going to be updated. So we go ahead and hit
Updates were attempted. If you see no failures below you may proceed happily back to your site. Otherwise, you may need to update your database manually. All errors have been logged.
  • Front Page
  • Administration pages
Great. So with that updated we can go back to our front page. Now we have updated our modules, and we have updated Drupal Core, so the site is fully up-to-date. We can confirm that by going to >reports >available updates
.We see no available ... at least that it has found but that is because we have not checked manually
check manually
obviously it's going to initialise, .... I am going to skip this for you guys. So I will see you back later. Done. We should have all new check results. So we are all good. [everything shows with a green background].

One thing that's not listed here is an actual theme because I am not using a custom, or rather a contributed theme. I am using Bartik. I don't see anything about my theme being out of date. You might. Before you go ahead and update [12'00"] I would check to see what the actual updates pertain to because if you have modified that theme, which is more than likely, you don't want to just go ahead and just update it because you will loose all of your modifications.

So that's it. The last thing that we have to do is take our site out of maintenance mode. So we put it back to go online and we just do that by un-checking the
Put site into maintenance mode
Before we conclude, I am going to show you two things.

This video tutorial assumed that your web site was not your hard disc and that is where you were doing all your maintenance. If for whatever reason you couln't, the way to manually would be that you would go to your site, so you would FTP in, in the command shell, or whatever way you are going to log-in. Either way, you would go to /sites/all/modules/ . Let's say I was updating the admin module. The admin menu. We would go ahead and we would delete that [file]. That's assuming you have not hacked this up. Which is something you should never do because you do not get the benefits of the Drupal Community [in helping to spot faults] on that.
Then I would go to - I've downloaded the module from, gone to the project page where I can download the module, [13'00"] downloaded the most recent versiuon, extracted it, and all I would do is upload if to my site. So, if I go back here, the admin module now has the most recent code. The next thing I would do (and I would obviously still be in maintenance mode) is that I would go to / [with an ordinary browser], and run through the updates on that.
If you want to do that for each of your modules the way to do it is obviously to go to the page for each of your
modules, download them, upload them, and them obviously run


Now, I promised that I would show you something about Drush. [13'25"] So, what Drush is, as I mentioned, is a series of scripts that you can use for common tasks on your site. So if you feel a little bit uncomfortable with this, this could be the end of the video tutorial for you. [13'42] But if you want to see some cool things about how to take your site to the next level, or rather your adminstration of your site to the next level, work with me here.
We are going to go to - download that. Get that installed on your web server. I'm sorry that I can't help you with all the questions about that: some of it is super-technical and way beyond my skill set. But the Drush team is awesome and I am almost positive that if you run into any issue, someone else has run into it, and there will be an answer on for you to help fix that. I ran into that trying to install Drush on Windows, and the Drush team have an aweseome Drush installer for Windows now. I've installed that. That's why I am in this Drush command prompt. So I am actually getting into my [WAMP] server, and I am into the TWDbox7 site [which is the site on the hard disc]. Now if I type stutus, Drush knows what site I am looking at and gives me all the information about it. [ you would need to look at this video at large scale to see what is on the Drush prompt ]

As I mentioned before, we had to backup our site and we had to update Drupal. We can do that in only two steps with Drush. All of these commands [on the Drush screen] - all of this stuff that happened here - this is all the Drush commands that are available in Drush, because of either Drush providing it, or other modules hooking into it. If you remember, we used backup and migrate module, and that actually hooks into Drush as well. So if we look at these, we have all the commands for backup and migrate. I can see that I have got to backup the site's database with the module right away. [15'00"]
II can just go XXXX , hit OK, and I am getting a bunch of errors because it's not actually set-up for my file system here, but Drush, typically, if I had done this on a liver server, would in two seconds have created a file, downloaded it, boom!: on the site. I can go and FTP in and grab that if I want to.
Then I can go DRUSH UP and what Drush is going to do right now is that it is going to go through all my modules, and trough drupal core, see if anything needs updating. So let's go ahead and do that. It would update my database at the same time. Because we have already walked-through [a more manual update] and did everything, it is not going to have anything to do, but Drush would have gone ahead, downloaded all of the modules, installed all the modules, it would have run that through /, and it would have gone through all of the stages that we manually, and it would have taken them off my back and done automatically with one simple script. So that is pretty cool. [15'52]
That's just scratching the surface. Here [on the list of commands] are other things that Drush will do. You will see that Views provides some commands, Voting API provides some commands. [16'00"] You can also write your own scripts. If you do a quick search [for scripts you can find ones] to disable all of your modules that are non-core; you can enable all of your modules that are non core, you know, if you are doing a site migration or that kind of thing. So it is really cool. Among other things that you can do I definately recommend that you go and take a look at Drush. [16'19]

That's the end of this video tutorial. Just to recap,
  • The first thing to do when you are updating your site: put it into maintenance mode
  • The second thing to: backup the database
  • Then you are going to go ahead and do your modules,
  • Drupal core, and run update.php for both of those
  • Make sure that there aren't any problems
Take that maintenance mode back off, to allow users back onto your site, and you should be good to go.

So that's it for this video tutorial. Hopefully you learned something. Hopefully this was helpful. We'll see you again in the next video tutorial where we will be talking about mass importation using the feeds module, and possibly UC_feeds. As always, if this helps, give me a thumbs-up. Its always good to see people appreciating. See you in the next video tutorial.


  1. This comment has been removed by a blog administrator.

  2. This comment has been removed by a blog administrator.

  3. This comment has been removed by a blog administrator.

  4. Nice blog...Very useful information is providing by ur blog. Great beginning php tutorials Very clear and helpful for beginners.

  5. Searching for the Best Dating Site? Create an account to find your perfect date.

  6. hello Get technical support regarding to printers.
    Visit here,
    gclub casino online