13.7. Updating a Theme
- A contributed theme has been installed and there is an update available for it. See 第 11.5 节 “Downloading and Installing a Theme from Drupal.org” and 第 13.4 节 “Keeping Track of Updates”.
- If your site is live, you should test this process in a development environment before running it on your production site. See 第 11.8 节 “Making a Development Site”.
- You have created a full site backup. See 第 12.3 节 “Concept: Data Backups”.
- If you want to use the user interface, the core Update Manager module must be installed. See 第 4.3 节 “Installing a Module” for instructions on installing core modules.
- If you want to use Drush, Drush must be installed. See 第 3.2 节 “Concept: Additional Tools”.
You can use the administrative interface or Drush to update a contributed theme. If you are updating a custom theme rather than a contributed theme, if you see a message saying Installing modules and themes requires FTP access to your server, or if the steps below do not work to obtain the new theme files, follow the steps in 第 11.6 节 “Manually Downloading Module or Theme Files”, and then continue with step 6 in the instructions for administrative interface below.
- Put your site in maintenance mode. See 第 11.2 节 “Enabling and Disabling Maintenance Mode”.
- In the Manage administrative menu, navigate to Reports > Available updates > Update (admin/reports/updates/update).
Find and check the theme in the list. Click Download these updates for the theme.

- Click Continue.
- Click Run database updates. If you obtained the new theme files manually, start with this step, and reach the database updates page by typing the URL example.com/update.php in your browser.
- Click Continue to run the updates. The database update scripts will be executed.
- Click Administration pages to return to the administration section of your site.
- Take your site out of maintenance mode. See 第 11.2 节 “Enabling and Disabling Maintenance Mode”.
- Clear the Drupal cache (refer to 第 12.2 节 “Clearing the Cache”).
- Find the project name for the theme you wish to update, which is the last segment of the theme’s project page URL. For example, if the project URL is https://www.drupal.org/project/mayo, the project name is "mayo".
Run the following Drush command, giving the project name (for example,
mayo) as a parameter:drush up mayo
- Follow the instructions on the screen.
- Review the site log, see 第 12.4 节 “Concept: Log”, once the updates are complete to check for errors.
- 第 13.6 节 “Updating a Module”
Attributions
Written by Boris Doesborg.
Source file: security-update-theme.asciidoc
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion