Как обновить drupal 8
Перейти к содержимому

Как обновить drupal 8

  • автор:

Как обновить Drupal 8?

Создаем сайт на Drupal 8. Как обновить ядро Drupal 8?

Приветствую в этом уроке. На связи Дмитрий Назаров и это видео посвящено обновлению Drupal 8.

Спешу рассказать вам о том, как обновить вашу версию drupal на сайте. Для загрузки новой версии CMS я использую Ajenti, но также подойдет и File Zilla. В прочем, что писать, смотрите сами :).

P.S. Не забудьте создать резервную копию базы данных и сайта. Как это сделать смотрите в этом видео.

Updating without Composer

I’ve previously used Drush to update my Drupal-installations. They are installed without using Composer, and currently on version 8.7.3. However, when I try to use Drush (drush v8.1.15, using drush up) to install the currently newest version the update fails when untarring the new core. When googling I see conflicting answers about what to do — among suggestions are Drush9, updating using composer (which I tested — does not work since the page is not installed using Composer) and others. What would be the simplest, least likely way to destroy the page while being able to update (with regards to security updates)?

17.8k 6 6 gold badges 67 67 silver badges 121 121 bronze badges
asked Sep 15, 2019 at 11:15
Lars Rødal Lars Rødal
195 7 7 bronze badges

Rebuild your site locally using Composer. Then update locally using Composer. Then upload the updated packages to your live site and run database updates.

Sep 15, 2019 at 11:55

Latest releases of Drupal 8 work with Drush 9 only. There is a project out there that will convert your site to be composer controlled if that’s what you desire.

Sep 15, 2019 at 12:28

I would prefer to not go the composer-route if it is not needed — but if that is what I have to do to get security updates I guess I will. Looks like updating Drush could work though.

Sep 15, 2019 at 20:59

2 Answers 2

The latest releases of Drupal 8 are «supported but not recommended» on Drush 8. Drush 8 is still necessary if you are not using Composer to build your site. Composer is recommended for all Drupal 8 sites because sooner or later you are likely to need a module that requires Composer. If your site does not yet need such a module, though, then it is possible to continue to use Drush 8 and the pm-update command.

A few months back drupal.org changed all of the URLs used to download Drupal images; in order to continue to use Drush 8, you need the latest version, which has been updated to use the new URL scheme. Please update to Drush 8.3.0, and you should be fine.

answered Sep 15, 2019 at 14:34
greg_1_anderson greg_1_anderson
21.4k 2 2 gold badges 36 36 silver badges 46 46 bronze badges

Thanks for this! I updated drush to 8.3.0 now — but still get the error. However, looks like the initial failed download is cached, but I can’t seem to find a way to clear the cache?

Sep 15, 2019 at 21:00

Nevermind — cleared the cache manually — still got an error. That error was caused since the droplet had ran out of Inodes. 8.3.0 worked like a charm. 🙂

Sep 15, 2019 at 21:43

I am sure many expert users will consider this heretical advice. It may or may not work for you depending on your hosting arrangements.

I’m with a shared hosting provider using a cpanel interface. Their cpanel has the Softaculous installer.

I have found that I can simply update drupal core using their scripts in 1 click.

No drush. No Composer. No fuss.

Of course it does not update contrib modules (which can still be updated using the admin/modules/update interface) or libraries (which would need to be updated manually) but I have found this route way less stressful and complex with the relatively simple sites I am working with.

Pro developers of course need more sophisticated tools and more time efficient ways of updating multiple sites, and the manual route does take longer if you are updating multiple libraries.

I hope those developers so enamored with Composer don’t kill off that functionality once they hear of this! (Please don’t :-))

Updating Drupal 8 with Composer : a step by step tutorial

I finally got around to launching the alpha of my personal website last week using Drupal 8, which I’d been planning to get around to for quite some time. I’ve managed to migrate my blog posts across and just need to work on adding the images, this time using the power of the Paragraphs module for all content.

In the past 8 days since launching, a few updates have become available. As many Drupal friends are a little anxious of Composer, I thought it would be good to document my steps for everyone to see.

Prerequisites

Composer project template

To create this website I used the drupal-project composer template, which is the recommended way of setting up a new Drupal 8 project. To start my project I ran composer create-project drupal-composer/drupal-project .

Knowledge of configuration management

Importing configuration with drush cim and exporting with drush cex .

1. Check what needs updating with the UI

As you can see from the image above, I need to update Drupal core and 2 contrib modules. I can now proceed to open my site in terminal (iTerm 2 to be exact) so I can run composer.

1. Check what needs updating with Composer

You can also run the command composer outdated which gives you a full list, including the Symfony components that Drupal 8 is now dependent on. Don’t worry, all you need to pay attention to are the items starting drupal/ .

Since writing this article, I have discovered the wonderful composer outdated —direct command which gives a shorter list of top level projects that have dependencies. Updating the projects shown here with —with-dependencies at the end of your composer update commands will automatically get the dependent projects.

Along with Drupal core, you’ll notice that entity_browser and metatag are there as expected, but we also see entity_browser_form and views_bulk_operations have updates too.

2. Updating Drupal core

Before you do anything, I would recommend importing configuration as a fellow developer may have added some new config that you haven’t yet imported to your local environment with drush cim .

You can update Drupal core by running the command composer update drupal/core .

Instead of what i typed in the screenshot below, I would recommended you use composer update drupal/core —with-dependencies in case your composer.lock file references a particular version.

I finalised this update to core by updating the database, exporting any new configuration & clearing all caches by running drush updb , drush cex , drush cr . It is important to remember to export config as database updates can add, remove or update your config files.

I then looked through the site to see if all looked well and it did.

Before committing I checked the git diff and saw the below in part of it.

It is good to have this as a separate commit from any other updates so it is easier to see what changed, but also giving you the ability to revert just that if needed later.

3. Updating Drupal contrib modules

This is super easy, you just need to run composer update drupal/MODULENAME . I would recommend that you use composer update drupal/MODULENAME —with-dependencies .

We saw earlier that the Metatag module needed updating, so I ran composer update drupal/metatag .

I finalised this update to core by updating the database, exporting any new configuration & clearing all caches by running drush updb , drush cex , drush cr .

Before committing I checked the git diff and saw the below in part of it.

I hope you found this tutorial useful. Did you get into any interesting adventures when updating your Drupal 8 site with Composer? I’d love to hear your experiences so please comment below, or drop me an email at hello@chandeepkhosa.com

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *