2024: Domino Containers - The Next Step. News from the Domino Container commu...
Introduction to Drupal 7 - Updating core, themes and modules. applying patches
1. Introduction to Drupal 7
Session 8.1
Updating core, themes and modules
Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 1
2. Agenda
• Backing up your system
• Why and when to make updates
• Updating Drupal core
• Updating modules and themes
• Patching
Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 2
3. 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
4. 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
5. 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
6. 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
8. 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
9. Using Backup and migrate module
• Administration > Configuration > System >
Backup and Migrate
Drupalist: Kalin Chernev Course by Init Lab (http://initlab.org) 9
10. 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
14. 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
15. 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
16. 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
17. 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
18. 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
19. 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