Drupal 8 User Guide: 13.5. Updating the Core Software (Updated 2019-08-30)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Updating the Core Software with Joe Shindelar This tutorial covers how to update the core software using the administrative interface or with Drush. By the end of this tutorial, you'll know how to update the core software either through the administrative interface or by using Drush commands. If you want to use Drush to perform the update, you'll need to make sure that Drush is installed first. It's also a good idea to test this process on a development version of your site. If you haven't already, now would be a good time to create a development version of your site. See the written version of this tutorial for links to each of the prerequisites. At a high level, the steps involved are as follows: 1, make a backup just in case anything goes wrong. 2, put your site into maintenance mode. 3, update the core software's code to the latest version. 4, run the database update script. 5, take the site out of maintenance mode. And 6, clear the cache for good measure. Let's walk through an example. First, make a complete backup of your site. In this case, I've made a backup using the MySQL dump command and created this sql.gz file, which is all of the database content for my site, as well as a zip of the directory that contains all of the code that I'm going to be updating and replacing. In order for these updates to work, you'll need to be either logged in as a user with the Administer Software Updates permission, or you can open the settings.php file under Sites, Default, settings.php. In the settings.php file, scroll down until you find the line $settings["update_free_access"]. Like so. Which, for security reasons, is set to False by default. As needed, you can temporarily change the setting to True, which overrides the need to be logged in when performing updates. I can change that here. The next thing that you'll want to consider is temporarily disabling any caching technique your application might be using, like Varnish or Memcache, just to ensure that they don't get in the way while performing an update. Then, put your site in maintenance mode. That can be done by clicking on Configuration and then under Development, Maintenance mode, and checking the box for Put site into maintenance mode, and clicking Save configuration. The next step is to download the updated code. At this point, you've got to make a decision. If you're managing your site's files with Composer, you'll want to use Composer to get the updated files. This is covered in another tutorial. If you are not using Composer, you'll need to manually download the code from Drupal.org. In previous versions of Drush, you could use drush dl to download Drupal core, but that is no longer an option in current versions of Drush. To download it from Drupal.org, navigate to Drupal.org and then click Download & Extend, select the current version of Drupal Core, and then click to download either the tar.gz or the zip file for the latest version. Once you've done that, you can extract it into a temporary directory. And then you need to copy all the appropriate files from this new code that you just downloaded over the code that currently makes up your site. Let's go ahead and do that. Be aware of hidden files. Things like the .htaccess file that comes with Drupal Core are important to update as well. I'll start by first removing the code from my existing site that I no longer need, which is everything that I haven't customized. In this case, that's all the files and folders, excluding the modules, sites and themes directory. I'll leave those as is because they contain my customizations. I can come over here and grab all of the updated code except for the modules, sites and themes directory. And then I can come over here in the code that I just downloaded and grab all the updated files except the ones that I don't need, modules, sites and themes, and place those into my directory here of my existing site, basically just updating all of the code with the latest version. Once you've completed that step of updating the code, you need to run the database update script. Note that if you use Composer to manage your files, you'll pick back up here in the update process. You can run the updates in 1 of 2 ways. Either by visiting the update.php script in your browser. Once there, you can click the Continue button. It'll list any pending database updates that you could review if you would like. And then click Apply pending updates. Once completed, you'll get a list of all of the successful updates. If you get any errors or warnings, you can re-run the update script again until all of the updates have been completed successfully. Alternatively, if you're using Drush, you can run the drush updb command, which will do the same thing, run the database update scripts. Once that's complete, if you changed the settings.php file earlier, you'll need to revert that now. Open settings.php in your editor, and change the "update_free_access" line back from TRUE to FALSE. Then, back on your site, you can take your site out of maintenance mode. Click on Administration pages. That takes you back to your site. You'll see the message here that you're operating in maintenance mode. You can click Go online, take the site out of maintenance mode, and finally, to verify that it worked, you can navigate to Reports and then Status report and confirm that you're running the latest version of the core software. In this tutorial, we learned how to upgrade the core code after a security update either manually or via Drush, as well as how to run the database update script, in order to keep our site up-to-date and secure.
Info
Channel: Drupalize.Me
Views: 1,093
Rating: 5 out of 5
Keywords: Drupal, Drupalize.Me, training, lesson, tutorial, learn Drupal, Drupal 8, Drupal tutorial, Drupal tips, Drupal video, Drupal 8 User Guide
Id: DqYqxp4xByk
Channel Id: undefined
Length: 5min 58sec (358 seconds)
Published: Fri Aug 30 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.