The website development sphere has never been static. New frameworks and upgraded versions of existing ones appear every day and online platforms follow suit. This is the main reason why the work of web developers will also never be the same: we help websites to meet all the innovative requirements and most modern security standards.
Despite the fact that currently Drupal 7 is used by the majority of Drupal web designers, the eighth version is slowly gaining momentum. Today, we are going to figure out how to migrate content to Drupal 8 and why it is worth the effort.
Drupal 8: Story of Its Appearance and Development
The Drupal platform has been on the market for eighteen years. Since 2000, it has served as a reliable CMS for numerous websites, be they a personal blog or a governmental service. In September 2018, Drupal Association released the latest stable version of the CMS (8.6.1), which is a great improvement over the 8.0.0 version released 3 years ago.
The Drupal community tracks the adoption of different versions and, currently, the 7th release is the most used. Nevertheless, the following graph clearly displays how this version is gradually losing its positions to Drupal 8.
So, why would you want to seek professional help in upgrading a website to Drupal 8? Before proceeding to the brief tutorial, let us figure out why entrepreneurs find the latest configuration beneficial for their business.
Drupal 8: Major Benefits for a Business
The eighth version is beneficial for both businesses and developers. The website will be fully optimized for the current market demands, and the administration workflows become notably smoother and faster with the renovated system.
1. High Efficiency
What do they say about the speed? The slower the website operates, the faster it kills the prospects of the business. Drupal 8 handles the cacheing like a true magician with the help of the BigPipe module. First, only the page’s cacheable parts are sent to the browser, and the dynamic elements go next – it allows websites to fly.
2. Amazing Interactivity
3. Lightning Fast Deployment
The process of importing or exporting changes in Drupal 8 is easier than ever. It features an upgraded management system, for which deploying new modules and components takes very little time.
4. Support for Multiple Locales
As the World Wide Web is a global phenomenon, multilingual interfaces have become a crucial factor for companies striving to succeed. Working with the eighth version, site admins can add the content in several languages and/or input methods while never leaving the management panel thanks to the in-built translation feature and support for multiple locales.
5. Perfect Fit for Any Device
Being mobile-friendly is not a choice – it is a vital necessity for any web platform. This is fundamental in modern trade. Drupal 8 offers ready responsive templates and admin panels out of the box so users with any device will have the easiest possible access to a website.
Drupal continually improves with each release, so there is no better time to learn the process of Drupal-to-Drupal migration. Sooner or later, you will have to master this knowledge.
Drupal 8 Migration Process: Three Ways
Drupal-to-Drupal data migration starts with preparation. The first thing you must understand is that the source website based on Drupal 6 or 7 is not affected in any way – all the data is transferred into a completely new installation. Nevertheless, migrating a live website will harm its operation. Thus, it would help to restore one of the latest backups to a separate instance.
Things to do first:
- List of plugins on the source website. Make sure that all the currently connected modules are truly needed and helpful. Compile a list of these. Next, you must check if these plugins have versions for Drupal 8 or alternatives with similar or better functionality. Additionally, updated modules may have changed operation principles or features that will require making changes to the website's content or structure – be thorough in your research. Moreover, you should note all the possible compatibility issues between different add-ons and known issues. In some cases, it would be advantageous to wait until the plugin that is critical for the website's operation is bug-fixed before conducting the migration.
- List of modules that should be connected to the target website. The information, collected at a previous stage, will serve as a base to compile a list of modules that must be integrated with a target website after the data from source is migrated. It should also include the above-mentioned data about bugs, issues, functions, and versions.
- List the possible migration problems and resolve inconsistencies. The official Drupal website has a page dedicated to the review of all the known issues that may happen during the process of migration, and core changes between the major Drupal versions. Make a list of the former that apply in your case (together with prospective solutions) and resolve the latter.
- Upgrade all the connected modules and the platform itself on the source website to the latest minor versions available.
Method 1. Drupal 8 Migration Using the Web Browser User Interface
For this, additionally, you will need to connect the following core Drupal 8 modules to the target instance: Migrate, Migrate Drupal, Migrate Plus, and Migrate UI. Make sure all of them are enabled before starting the process.
Open the /upgrade page (https://onlineshop.com/upgrade, for example) on a target instance. You will need to define the version of the platform on the source site, fill in the database connection details, and paths to public/private directories into the respective fields.
The next page will display the results of the preliminary analysis – which modules of the source have the upgraded versions or alternatives at the target, and which do not. Make sure that this configuration corresponds to your vision of the upgraded website, concluded during the preparation stage. If something is not right, you can return to the preparations.
By pressing the "Perform Upgrade" button, you will start the process of the migration itself. Depending on the size and complexity of the website, the migration can take some time. The system will “keep you posted” with status messages.
When the process is finished, the report will be displayed, summarizing how the migration went. To find out the reasons for the errors (if any), just follow the link right under the message – it will open the transfer log with all the details.
Method 2. Drupal 8 Migration Using Drush
Drush is a Drupal command line shell. While most developers would opt for the GUI migration, Drush is a great help tool when you are dealing with a complex project and the upgrade is divided into isolated stages. First of all, you need Drush itself. If it is not already installed on your website, download and initiate it using Composer: composer require drush/drush. Additionally, you will need the following modules: Migrate Upgrade, Migrate Plus, Migrate Manifest, and Migrate Tools.
The process is started with the drush migrate-upgrade command provided by the Migrate Upgrade module. An additional --configure-only option orders the engine only to generate a configuration for each migration stage, which allows executing them in a convenient order.
The complete command syntax will look like this:
drush migrate-upgrade --legacy-db-url=mysql://user:[email protected]/db --legacy-db-prefix=drupal_ --legacy-root=https://example.com --configure-only
Here, mysql is DBMS type, user and password – DB access credentials; server and db – database URL; drupal_ – database prefix; https://example.com – source website URL.
After running the migrate-upgrade command with a --configure-only option, the list of prepared individual migration configs can be reviewed using drush migrate-upgrade. You can run the most preferable configs individually using drush migrate-import config_name (config_name here is the name of the migration config that should be executed), or launch the full process using drush migrate-import --all.
Method 3. Custom Drupal-to-Drupal Migration
There are several ways to customize your Drupal 8 migration, and you can read more about it on the official page. In this article, we would like to mention ways to create a custom migration logic.
- Firstly, you can build custom plugins for this. Drupal describes this technique in the Migrate API Overview guide. You can find several examples of how to manage fields, users, and migration configs.
- Another useful method is hook_migrate_prepare_row() that accepts such parameters as Row $row, MigrateSourceInterface $source, and MigrationInterface $migration.
- And finally, you can use the hook_migration_plugins_alter() method, which allows changing migration configs, prepared by the drush migrate-upgrate --configure-only command.
The latest Drupal release is a growing trend on the market and any developer working with this CMS should skillfully manage the Drupal 8 migrate process. In the above article, we provided the basic review of possible migration options starting with the easiest – using the browser UI up to the customization capabilities and tools to execute them. If you need more detailed manuals, the official site has plenty. Whether you’re working with a landing page or a huge trading platform, the Drupal community has tips and hints for any occasion.