back

Knowlegde

Knowledge Centre

Port your sites to Drupal 9

by Laura | 01.08.2019

Port your sites to Drupal 9

With Drupal 9 on the way(3rd, June 2020), that means we should prepare to port our sites by keeping all the dependencies, libraries and modules, up to date.

Everywhere I go I hear: "Keep up with Drupal 8 and you are prepared for an EASY 9 upgrade."

 

Why is this?

 

Drupal 8 depends on Symfony 3 and we are preparing for it' s END of LIFE in November 2021. Regarding this change, the new major release of Drupal will be Drupal 9 which will depend on Symfony 4.

So we'll keep in mind a few things that are important:

       1. The minimum Symfony version will be 4.

 

       2. The PHP requirement will be at least 7.2 or higher. See (https://symfony.com/doc/current/reference/requirements.html)

 

       3. Some deprecated modules will be removed:

       

      4. All deprecated code will be removed, an example will be the function file_unmanaged_copy which copies a file to a new location without database changes or hook invocation.

article
Top
default
function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
  @trigger_error('file_unmanaged_copy() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::copy(). See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
  try {
    $file_system = \Drupal::service('file_system');
    // Build a destination URI if necessary.
    if (!isset($destination)) {
      $destination = file_build_uri($file_system
        ->basename($source));
    }
    return $file_system
      ->copy($source, $destination, $replace);
  } catch (FileException $e) {
    return FALSE;
  }
}

 

This function will be removed before Drupal 9.0.0 . Instead we will use the following service:

 

\Drupal::service('file_system')->copy($source, $destination);

 

An advantage of using it will be the dependency injection using the container.

       5. Drupal 8.8 is the last version to deprecate for Drupal 9.

 

       6. Drupal 7 sites don't need to wait until 9, that's because Drupal 9 is identical with Drupal 8.

 

       7. Use the drupal-check tool for checking deprecations of Drupal code and discover bugs https://github.com/mglaman/drupal-check/

 

“The first release of Drupal 9 will be very similar to the last minor release of Drupal 8, as the primary goal of the Drupal 9.0.0 release will be to remove deprecated code and update third-party dependencies. By keeping your Drupal 8 sites up to date, you should be well prepared for Drupal 9.” - Dries Buytaert, Drupal Project Lead

 

Documentation: drupal.org/docs/9

  • Knowlegde
    Knowledge Centre
    Replace a field's content based on another field using AJAX
    Laura
    EN
  • Knowlegde
    Knowledge Centre
    Drupal 8 or Drupal 9
    Laura
    EN
  • Knowlegde
    Knowledge Centre
    GDPR at Softescu governing B2B activities
    Laura
    EN

Post a Comment.