1.5 Updating Your Instance
Depending on how you've installed your Drupal instance, you may notice an error or warning bar signaling your instance is a little out of date. In my case, DigitalOcean didn't install the latest version on my droplet. So in this lesson, I'll show you how to find the latest version of Drupal and install it on your web host.
1.Introduction5 lessons, 42:22
2.Creating Content5 lessons, 42:14
3.Working with Views5 lessons, 34:11
4.Further Configuration3 lessons, 18:12
5.Building a Full Site From Scratch14 lessons, 1:24:52
6.Conclusion1 lesson, 02:26
1.5 Updating Your Instance
Okay. So let's go through the process of updating our instance of Drupal core from 8.1.3 up to the latest version of 8.2.5. Now if you do a little bit of research around the Internet, you're gonna find a couple different explanations on how to do this. And what I have found when I am actually trying to accomplish this on DigitalOcean with their one-click install this doesn't seem to work quite as smoothly as you would hope. So typically what you're gonna find is that they're gonna say go over to your terminal and use an administrative tool that's installed by default with Drupal called Drush, D-R-U-S-H. Now if you just type that in to your Command prompt and hit Enter, you're gonna see there's a ton of commands here. So basically any sort of site maintenance that you want to do that you could do through the user interface you could also do from the Command line which is a very nice feature. It's nice to be able to script these types of things and be able to update and do all those kinds of nice things which is what Drush is meant for. Now there is some, or there are a few different ways to do some updating. There's this pm update which is going to allow you to update Drupal core and the projects and apply any pending database updates, which is really good which is what we would basically want to do. And so the process, since we're dealing with a new installation there's really nothing that I need to worry about but you would typically backup your data and do all that kind of stuff. And then you would at least via the instructions that I have found you would typically do the Drush instruction called pm update. And then I can say I want to update Drupal, which is supposed to update Drupal core and I attempt to do that and there is a higher bootstrap level needed to be able to run the pm update command. And I believe that this is more of a limitation of how things are installed here on my DigitalOcean droplet. I could be wrong but I feel like that is where some of these issues arise. So if you're following along with me and you get that type of an error, sometimes you might get additional information, it might be a little bit more specific about some things to try or maybe what you might want to do to get past this. Unfortunately I haven't been able to piece those things together and get them all to work nicely, but I have been able to find some documentation and some notes of my own to help get through this update process so we don't have to look at that security error and warning anymore. So obviously like I said before, backing up your or your instance and even your machine is probably a good thing before you start doing upgrades or updates to your software, like I said before I don't really have anything else on here and this is a clean installation so if something goes horribly wrong I can always just blow this one away and create another one. So the first thing that we're gonna wanna do is we're actually gonna want to go navigate into our Drupal installation. So in my case that's going to be in var www/html/drupal. So that's gonna be my location of where this is actually installed. So as you can see here, I have a number of directories and files that are loaded in here. Now, the next thing that you're going to wanna do, is you're going to want to put your site into Maintenance mode. Now you can typically do that via Drush, which I have once again not had success doing, but you can also do that through the user interface. So if I head over here to admin, and I go to Configuration, and then I go to Development, and then I select Maintenance mode. So in here I can put my site into Maintenance mode, and this way visitors will only see the Maintenance mode message. And then this can give the message that you wanna display while you're in Maintenance mode, and I can go ahead and select Save configuration. So now this means that I am in Maintenance mode, if I head back to Site now, you can see that we are currently operating in Maintenance mode. That's because I'm logged in and I have access to be able to see that. So then I'm actually going to head back over to my terminal, so now that I know that I'm in Maintenance mode I have to start clearing a lot of this stuff out. So basically we're going to blow away just about everything that's in this directory and we're going to download and install the latest and greatest version. So in order to do that I'm actually going to use the Remove command RF and I want to get rid of core, the core directory, as well as the vendor directory. So that command is going to take care of that, so if I do list the contents here again you're gonna see that those two folders are gone. And then basically I really want to get rid of pretty much everything else that's in here. So I'm just gonna do a Remove and I want to do star.star and let's go ahead and do that. So now we are going to be left with pretty much nothing. There's a couple folders here left but honestly, that's gonna be fine cuz we're gonna wind up replacing a lot of the stuff that is here anyway. So basically you just wanna clear away a bunch of the residual stuff that's left over from the 8.1.3 installation that was put there by DigitalOcean. So now the next thing that we wanna do is we actually want to download the latest version of Drupal, and the easiest way to do that I find is through some sort of Command line utility here. You could use pretty much anything you want, I'm gonna use wget because I know that's here. So I'm gonna go to https//www.drupal.org and I can go to the files URL projects/drupal- and then I give this the version. Now the latest version is 8.2.5 and this is actually a tar.gz file. So I'm gonna go ahead and download that now and it should be a fairly quick process. As you can see here it doesn't take too long, it's not too terribly long, obviously depending on your connection speed with your virtual machine. So now that I have that I want to unzip it. So I am simply going to use the tar command here and I'm going to unzip my new file that I downloaded. So let's go ahead and unzip that, it's going to extract all of it to this local directory. But what it actually did was if I were to take a look here it downloaded the Drupal file and then it extracted everything in to Drupal 8.25 folder which is not really gonna help us very much. So now what we want to do is we actually want to copy all of that out to the previous directory. So then we are simply going to use the Copy command and we are going to copy everything from that directory, and I wanna copy it to my current directory. So that's going to begin that process, and then we are finally going to do all the files and folders. So let's go ahead and clear this out and now if you take a look at what's going on here we've got quite a few things in here. So we've pretty much recreated and blown away pretty much everything that was in there and downloaded the new 8.25 version and then installed it over top. Now at this point we actually have to run a special command that has been installed as part of this update process, and that is actually an update.php script that we actually need to do from the user interface or from our actual websites. So I'm gonna switch back over to my browser here and I'm going to go to my URL here and I'm actually going to attempt to run the update.php. Now when I attempt to do this you're going to see that I get to this point where I want to update my database. So I'm gonna select Continue. Here we're gonna see that there's 14 pending updates, I'm going to apply the pending updates. And this should only take a few moments and it's gonna go through and finish this process. And as you can see here my Drupal database has been updated. Now one thing you might have to pay attention to is if you attempt to run update.php, and for some reason it won't let you do it, It winds up giving you some sort of error that says something about update free access within your settings. There is a way to fix that, I'll show you here how to do that. So let's go ahead and clear this out. So the Main Settings file that contains all of the configuration settings for your Drupal file is found within in the sites/default folder. So if I go ahead and see what's in here you're gonna see I have these settings.PHP file, so you can use whatever sort of text editor that you have lying around. Like I said before if you're running this locally then it would definitely beneficial for you have some sort of text editor that you're comfortable with. But since I am SSHed into a remote system, text editor's not gonna help me, so I could just use vi or whatever sort of command line text editor that you want. So I can come in here and take a look and there's, it's a fairly lengthy file, there's a lot of things going on in here. But like I said if the error that you received said something about update free access, then all you need to do is search this file. So I'm gonna use / and I'm gonna look for update free access with the under bars in between the words. And you're gonna get down to this line where it says $settings update free access equal to false. So if you're attempting to update your Drupal installation using update.php but you're not logged in using either account with the administrative software updates permission or site maintenance account, then you're gonna get an error. And if for some reason you do get that error all you have to do is change this false to a true, and then Save and close this file and then rerun that update file or that update.php that you see here, and then you should get this interface. And then once you're done going through this update process you should definitely come back here and change this back to false, which basically just means if you don't have access, if you're not logged in, or if you don't have administrative access to this site then this process will fail. And rightly so you shouldn't be able to do any sort of database updates If the sites and maintenance mode and you're not an administrator or something along those lines. So it's just something to keep in mind. So now we have updated our actual core implementation of Drupal to 8.2.5, we have updated our Drupal database. Now we can go ahead and head back to our site. As you can see here, and I am actually going to go back to Manage and I'm going to go back to Configuration. I'm gonna go to the Development section here, I'm gonna go to Maintenance mode and I'm gonna take this out of Maintenance mode. I'll save my configuration. Now my configuration has been set, I can come back to Reports. If I take a look at available updates here, depending on how you did this and how smoothly everything went, you might still continue to get errors here, but if you just refer to the page it should catch back up and realize what's going on. But as you can see here now we have Drupal Core 8.2.5, and we're ready to go. So if I go back and take a look at some of these sections that error should be gone now and I should no longer see it on this site.