Introduction to Drupal 7 - Updating core, themes and modules. applying patches

21
Introduction to Drupal 7 Session 8.1 Updating core, themes and modules 1 Course by Init Lab (http://initlab.org) Drupalist: Kalin Chernev

description

Slides and tutorials on how to update Drupal 7 core, modules and themes. Plus how to patch in an easy way in Windows with NetBeans.

Transcript of Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Page 1: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Introduction to Drupal 7

Session 8.1

Updating core, themes and modules

1 Course by Init Lab (http://initlab.org) Drupalist: Kalin Chernev

Page 2: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Agenda

• Backing up your system

• Why and when to make updates

• Updating Drupal core

• Updating modules and themes

• Patching

2 Course by Init Lab (http://initlab.org) Drupalist: Kalin Chernev

Page 3: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Backup

• Absolutely important: never do anything on your system before backing it up!

• How to backup – 2 parts:

– Make a copy of your system files

– Export a dump of your database

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 3

Page 4: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Why and when

• Why: keeping your system secure and up-to-date

• When:

– On new versions of modules

– On security updates

– New features is introduced in the community

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 4

Page 5: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Exporting a dump from phpmyadmin

• The most conventional way to export a database backup is access the phpmyadmin

• Use the export functionalities

– Tar.gz is the best compression

– You may want to exclude cache tables

– Better than cpanel way of exporting data

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 5

Page 6: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Exporting from phpmyadmin

• Enter the phpmyadmin control panel

• Select the database you’d like to export

• Use the Export tab on top

• Keep the SQL type of export

• Select gzipped compression level

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 6

Page 7: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Exporting from phpmyadmin

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 7

Page 8: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Backup and migrate module

• Backup and migrate is a useful Drupal module

• Advantages – Easy to use with configurations

– No need to have access to phpmyadmin

– Cache tables are not dumped by default

– Choice of way to export the data

– Automatic regular backups are possible

• Be careful: – System performance may suffer from the automatic

regular backups

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 8

Page 9: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Using Backup and migrate module

• Administration > Configuration > System > Backup and Migrate

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 9

Page 10: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Updating Drupal core

• All files except the “sites” folder

• Sometimes the .htaccess is changed

• Sometimes the robots.txt file is changed

• Also additional PHP files are added

• You have to keep backup of your custom files and restore them after the update

• Run update.php script

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 10

Page 11: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Updating Drupal core

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 11

Page 12: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Run update.php

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 12

Page 13: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Apply pending changes

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 13

Page 14: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Updating modules and themes

• Backup initial files version locally

• Remove old files

• Add new files

• Run update.php script

• Check for errors – Dynamic sections using the module functionality

– General browsing the website

• If there are errors: try cleaning the cache

• If the errors do not go away: read the forums

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 14

Page 15: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Patching

• Anatomy of a patch

• When to patch: new features are added by community, but the module maintainer hasn’t introduced them in the module yet

• git or not git

• The NetBeans way for Windows

• The Linux way

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 15

Page 16: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Anatomy of a patch

• A patch is a document that shows the differences between 2 versions of one or more files.

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 16

Page 17: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Applying a patch in Windows

• To apply patches using NetBeans:

• Open the project and right-click on the file or folder you want to patch.

• Tools > Apply Diff Patch...

• Browse to and select the patch file you want to apply. > Click "Patch".

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 17

Page 18: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Applying a patch in Linux

• patch -pnum <patchfile

• or

• patch < /path/to/file

• patch [options] [originalfile [patchfile]]

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 18

Page 19: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

git

• Git is the drupal.org versioning system

• Many functionalities to facilitate the creation and applying of patches

• Requires more technical knowledge to use

• The best versioning system you can choose to use if you’re going to use a versioning system anyway

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 19

Page 20: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Time for questions

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 20

Page 21: Introduction to Drupal 7 - Updating core, themes and modules. applying patches

Contacts

Kalin Chernev

– E: [email protected]

– T: twitter.com/kalinchernev

– U: http://shtrak.eu/kalata

Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 21