X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fmigrate_plus%2Fmigrate_example_advanced%2Fmigrate_example_advanced.install;h=2023bdee16be8ba07e0d9e21610eff8261773dea;hb=refs%2Fheads%2Fd864;hp=b2506e4a9a9aa879516c013c2ab4da296ddddbbf;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/modules/contrib/migrate_plus/migrate_example_advanced/migrate_example_advanced.install b/web/modules/contrib/migrate_plus/migrate_example_advanced/migrate_example_advanced.install index b2506e4a9..2023bdee1 100644 --- a/web/modules/contrib/migrate_plus/migrate_example_advanced/migrate_example_advanced.install +++ b/web/modules/contrib/migrate_plus/migrate_example_advanced/migrate_example_advanced.install @@ -2,26 +2,30 @@ /** * @file - * Install, update and uninstall functions for the migrate_example_advanced module. + * Install, update and uninstall functions for migrate_example_advanced module. */ use Drupal\migrate_plus\Entity\Migration; /** * Implements hook_install(). + * + * We need the urls to be absolute for the XML source plugin to read them, but + * the static configuration files on disk can't know the server and port to + * use. So, in the .yml files we provide the REST resources relative to the + * site root and here rewrite them to fully-qualified paths. */ function migrate_example_advanced_install() { - // We need the urls to be absolute for the XML source plugin to read them, but - // the static configuration files on disk can't know the server and port to - // use. So, in the .yml files we provide the REST resources relative to the - // site root and here rewrite them to fully-qualified paths. - /** @var \Drupal\migrate_plus\Entity\MigrationInterface $wine_role_xml_migration */ $wine_role_xml_migration = Migration::load('wine_role_xml'); if ($wine_role_xml_migration) { $source = $wine_role_xml_migration->get('source'); $request = \Drupal::request(); - $source['urls'] = 'http://' . $request->getHttpHost() . $source['urls']; + $urls = []; + foreach ($source['urls'] as $url) { + $urls[] = 'http://' . $request->getHttpHost() . $url; + } + $source['urls'] = $urls; $wine_role_xml_migration->set('source', $source); $wine_role_xml_migration->save(); } @@ -30,7 +34,11 @@ function migrate_example_advanced_install() { if ($wine_role_json_migration) { $source = $wine_role_json_migration->get('source'); $request = \Drupal::request(); - $source['urls'] = 'http://' . $request->getHttpHost() . $source['urls']; + $urls = []; + foreach ($source['urls'] as $url) { + $urls[] = 'http://' . $request->getHttpHost() . $url; + } + $source['urls'] = $urls; $wine_role_json_migration->set('source', $source); $wine_role_json_migration->save(); }