Skip to content

Instantly share code, notes, and snippets.

@plepe

plepe/report.md

Created Oct 12, 2018
Embed
What would you like to do?
How I migrated Drupal 6 (with Biblio module) to Drupal 8 (with Bibcite module)

How I migrated Drupal 6 (with Biblio module) to Drupal 8 (with Bibcite module)

I got the task of upgrading an old Drupal 6 webpage to a newer version. We decided to skip Drupal 7 and go directly for Drupal 8 with the new bibcite module (although it is still at 1.0-alpha7 at the time of this writing).

Upgrading most of the content of Drupal 6 to Drupal 8 worked rather fine, with the exception of the Views which have to be migrated separately. Migrating the content of the biblio to bibcite was quite a task though. In this text, I will report how I did the transition.

One of the biggest hurdles was, that the migration would split the publications into two separate entitys. In Drupal 6, there was a "Biblio" content type, which had a "biblio" field with all the bibliographic sub-fields. And there were a fewer custom fields (via CCK), e.g. a teaser image and some node references to projects (which were a separate content type).

After the migration, the publications are a separate entity type (Content -> Bibliographic data) (I couldn't figure that out myself, I had to create an issue with the bibcite module), which contain all the fields from the biblio module. The custom fields were still connected to the old content type. I solved this by create custom fields on the bibliographic entity type and writing a script which copies the data from node to the bibliographic entity type.

Install drupal 8

First install a naked Drupal 8. I created a mysqldump of the old drupal 6 database and imported this on the new server.

I enabled a few modules via drush:

composer require drush/drush
vendor/bin/drush en migrate migrate_drupal migrate_drupal_ui bibcite bibcite_migrate bibcite_bibtex statistics aggregator locale field_tools

Bibcite Migration

For bibcite_migrate, I used a custom version as the original version (1.0-alpha2) had a few issues:

  • Order of contributors lost (bugfix)
  • Publications where an contributors had an auth_type=0 was set would not be imported (I forced them to be 'authors')
  • Publications with an unknown type would not be imported (need to define this type in migrations/bibcite_migrate_bibliography.yml)
rm -r modules/bibcite_migrate
git clone https://github.com/plepe/bibcite_migrate.git modules/bibcite_migrate

Running migration

Before running the migration, I also had to require additional libraries for the bibcite module.

composer require academicpuma/citeproc-php:~1.0 adci/full-name-parser:^0.2 technosophos/LibRIS:~2.0 audiolabs/bibtexparser:dev-master caseyamcl/php-marc21:~1.0

Visit the /upgrade page, run the migration.

Bibcite, additional fields

Then, I had to create the custom fields on all publication types. First, I re-created all fields on one publication type and then copy these to all other publication types by using the Field Tools module (thanks antong for pointing this out).

At this point, my Drupal 8 installation would start to lose fields, either on the normal node content types or on the bibcite reference. It seemed not to be connected to Field Tools, as I experienced the same problem without this module.

Finally (after a day of re-trying) I noticed, that this is just a caching problem. If I would clear all caches (via Administration -> Configuration -> Performance) everything would be okay again.

Finally I wrote a custom script which would load all content of type 'biblio' and copy the data to the bibliographic references.

Further problems

Bibcite is still alpha, so there are still some problems:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.