This translation is still under construction
I am going to share my experience with the upgrade of the websites I manage from Drupal 9 to Drupal 10.
First a warning. DO NOT upgrade with Ubuntu 22.04 with PHP 8.1.2. This gives unpredictable results. I read the warning too late on the Drupal site after several failed attempts. I switched to a raspberry PI4 with the 64 bit OS and php 8.1.22 and an SSD drive.
This upgrade is not the ideal way as I describe it. For example, composer only worked with sudo and I couldn't get drush to work as a separate command, but it also works with ./vendor/bin/drush. PHPMYADMIN didn't feel like it either, but the MYSQL command line always works. The username I used was PI with sudo rights.
Because my production websites use the /home dir as a base, I wanted to use this on the PI as well. This required modifying apache2.conf with the following addition after /var/www
<Directory /home/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Backups.
First I did a clear cache in the production environment. This makes a difference in the size of the backup.
I made a backup of the production environment and the database on the PI in Cpanel. Unpacked the site and copied the structure of the website to the home directory. So this is the section websiteusername/public_html/..... Also the syncdir, private dir and event. tmp dir placed in the websiteusername/ More is not necessary such as settings, email, etc.
Adjustments:
- Now you only need to uncheck the line with trusted hosts in the settings.php
- If necessary, adjust .htaccess if it contains additional rules regarding https redirects.
- create a new conf in /etc/apache2/sites-available and enable it.
- Set the owner correctly with CHOWN -R www-data:www-data websiteusername/
Load database.
First we need to extract the database backup so that we have a .sql.
Then create the database and load the backup.
- mysql -u username -p
- enter pw.
- create database websiteusername;
- use websiteusername;
- create user ' websiteusername ' @' localhost' identified by ' password' ;
- grant all on *.* to 'websiteusername' @'localhost' with grant option ;
- Use websiteusername
- source websiteusername.sql;
- Show tables;
All tables are now loaded and the website can be started in the browser with localhost or from another computer in the local domain's IP address. For me this worked with all 4 websites at once.
The updates.
We assume that the website version > 9.5
First of all, the deprecated modules and themes must be removed. I use mayo as a theme that was already deprecated before d9, but still worked with adjustments, also in d9. For d10 I didn't want this anymore and started searching and came up with SOLO. However, this is only available for D10. I therefore chose to temporarily use Olivera for the upgrade and switch to Solo after the upgrade. I will make a separate blog about the conversion of this. I took a screenshot of the home screen, the block layout and the color settings of MAYO and then set Olivero as the default theme and disabled and deleted Mayo.
CKEditor4 not yet removed. First you need to activate CKEditor5 and replace CKEditor with CKEditor5 in 'settings-Text formats and editors'. The settings from 4 are taken over by 5. Once this has happened, CKEditor 4 can be disabled. This is described in detail on drupal.org.
For the updates I started with the installation of drush with composer require drush/drush.
composer update. This ensures, among other things, that symphony is updated.
I then updated all modules listed in REPORTS>AVAILABLE UPDATES with composer to the new versions. For me these were Captcha, ctools, libraries API, Scheduler, simple xml sitemap, views slideshow and webform.
This did not happen without a fight. This was caused, among other things, by composer putting the new versions in modules-contrib while the old versions remained in modules. For each module I ran ./vendor/bin/drush updatedb and ./vendor/bin/drush cr.
For libraries, the old folder in modules had to be deleted and the cache cleared. After the libraries API was updated an error message appeared because the new libraries could not find a folder namely libraries/jquery.hover-intent/. However, it does say jquery.hoverIntent/ in libraries. You need to rename this folder to libraries/jquery.hover-intent/.
All modules are now up to date.
The next step is to see if self-made modules are suitable for D10. You use the module upgrade status for this.
$ composer show drupal/core | grep versions
$ composer require --dev drupal/core-dev:[copy version above] --update-with-all-dependencies
$ composer require drupal/upgrade_status
This didn't work for me. The second line went wrong because symphony gave a conflict. The third line also presented a problem. I had to start this with -W, so composer require drupal/upgrade_status -W.
Then activate the module upgrade status. Under REPORT>Upgrade Status you can now see whether there are any problems.
Everything is 100%
Deactivate the module upgrade status again and then remove it with composer remove drupal/upgrade_status -W
Also removed drush with composer remove drush/drush
The upgrade.
First set the permissions correctly
- sudo chmod 777 sites/default
- Sudo chmod 666 sites/default/*settings.php
- Sudo chmod 666 sites/default/*services.yml
- composer require 'drupal/core-recommended:^10' 'drupal/core-composer-scaffold:^10' 'drupal/core-project-message:^10' --no-update
- Composer update —dry-run No error messages
- Composer update No error messages
- Composer require drush/drush
- ./vendor/bin/drush updatedb
- ./vendor/bin/drush cr
Now to the site and it is now running under D10.😊
The Status Report indicates that popper.js is missing from libraries. Posted this.
A photo slide (view slideshow) placed in sidebar.
At some point this will give this error
Warning: Undefined array key "url" in Drupal\Core\Asset\JsCollectionOptimizerLazy->optimizeGroup() (line 170 of core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php).
This is caused by the lack of a URL in it
Modules/views_slideshow/views_slideshow.libraries.yml.
The URL between lines 32 and 33 is missing.
URL: https://opensource.org/licenses/MIT
There is a patch for this, but you can of course also just enter it. Problem solved.
https://www.drupal.org/files/issues/2024-02-08/3387913-12-views_slideshow.patch
Because I cannot work with composer in the production environment and Softaculus does not offer the option to upgrade from d9 to d10 this time, I have to transfer the local version to the production environment.
First let's go solo with composer. composer require 'drupal/solo:^1.0'
Export database
mysqldump -u username -p websiteusername > websiteusername.sql
Enter password.
Just wrapping up the SQL. gzip -9 websiteusername.sql
Wrapping up website.
sudo tar -zcvf websiteusername.tar.gz /home/websiteusername/
Make another backup of the site and database at the production site. Remove the tables from the website and read the new sql.gz with phpmyadmin. In public_html place everything in a d9 folder, upload the tar.gz and unzip it. Adjust the permission of sites/default and remove the # for trusted hosts in settings.php. Restore permission. If necessary, adjust the .htaccess if https is controlled there.
Test the website. Everything was fine with me, so I converted 4 sites from d9 to d10.
Now setting up SOLO, but that will be in a next blog
I hope that you, as a reader of this article, will receive enough guidance to make the transition properly.