Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Simple content migration via cron scheduler

This module extends the core migration system to migrate the content from external database as source into Drupal nodes as destination.

Features of the module:

  • Migrate the simple content from external database source into Drupal nodes.
  • Migration of the content will be performed using hook_cron().
  • It requires contrib modules migrate_plus (https://www.drupal.org/project/migrate_plus).

Installation Steps

1. Download the module (simple_content_migration_via_cron) and its dependencies module (migrate_plus).

2. Enable the modules - migrate_plus and simple_content_migration_via_cron.

3. Add the external database (to be migrated) config in the active settings.php file.

$databases['migrate']['default'] = array (
  'database' => 'source_db',
  'username' => 'root',
  'password' => '',
  'prefix' => '',
  'host' => '127.0.0.1',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

4. Add the config of migration scheduler in the active settings.php file.

$config['simple_content_migration_via_cron']['migrations'] = [
  'content_migration' => [
     'time' => 3600, # To be executed every hour.
     'update' => TRUE, # To be executed with the --update flag.
  ],
];

5. Choose the scheduler time (here time = 1 hour) as mentioned in step 4 from Cron dropdown field (admin/config/system/cron) and save. Cron API which is built into the Drupal core is used to schedule the migration.

6. Source database fields content to be migrated:

  • title (plain text)
  • sku (plain text - primary key)
  • price (plain text)
  • valid_date (datetime)

7. Destination database(e.g. Drupal) fields of the content type product:

  • title (plain text)
  • field_sku (plain text)
  • field_price (plain text)
  • field_valid_date (datetime)

Note: If you have different machine name of content type, make sure to change the default_bundle in the file `simple_content_migration_via_cron/config/install/migrate_plus.migration.content_migration.yml`

8. Change the source fields for a table in the source plugin - `Content.php`

9. Map the source fields with destination in the file migrate_plus.migration.content_migration.yml

10. All setup is done now and content will be migrated as per the cron scheduled.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jan 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
1.1.0 Stable Jan 18, 2023