d7_import
# D7 Content Import
A Drupal 10/11 module for importing content exported from Drupal 7 sites.
## Overview
This module provides a way to migrate content from Drupal 7 to Drupal 10/11 without going through the standard D7 → D8 → D9 → D10 → D11 migration path. It works by:
1. Exporting content from D7 as XML files (using the included export script)
2. Importing the XML files into D10/11 (using this module)
## Features
- Preserves node IDs (NIDs), term IDs (TIDs), and file IDs (FIDs)
- Auto-creates vocabularies and content types from the import data
- Auto-creates fields based on D7 field types
- Imports taxonomy terms with hierarchy
- Imports files and file references
- Imports URL aliases
## Installation
1. Copy the `d7_import` folder to your D10/11 site's `modules/custom` directory
2. Enable the module: `drush en d7_import`
3. Access the import form at `/admin/content/d7-import`
## D7 Export
Before importing, you need to export your D7 content:
1. Copy `d7_export_script/export_content.php` to your D7 site root
2. Run with Drush (for multisite, specify the site):
```bash
drush -l yoursite.com php-script export_content.php
```
3. Find the exported XML files in `sites/default/files/export/[site_name]/`
## Import Process
The import should be done in order:
1. **Vocabularies** - Creates empty vocabulary entities
2. **Terms** - Populates terms with preserved TIDs
3. **Content Types/Fields** - Creates node types and field configurations
4. **Files** - Creates file entities with preserved FIDs
5. **Nodes** - Creates nodes with preserved NIDs
6. **Aliases** - Creates URL path aliases
## Field Type Mapping
| D7 Field Type | D11 Field Type |
|---------------|----------------|
| text | string |
| text_long | text_long |
| text_with_summary | text_with_summary |
| image | image |
| file | file |
| taxonomy_term_reference | entity_reference |
| entityreference | entity_reference |
| link_field | link |
| date/datetime/datestamp | datetime |
| list_text | list_string |
| list_integer | list_integer |
| list_boolean | boolean |
| number_integer | integer |
| number_decimal | decimal |
| number_float | float |
## Source Files Path
If you want to copy the actual files (images, documents, etc.) during import, provide the path to your D7 files directory in the import form. For example:
```
/var/www/d7site/sites/default/files
```
Leave empty to only create file entities without copying files.
## Limitations
- Users are not imported (nodes are assigned to UID 1 if original user doesn't exist)
- Revisions are not imported
- Some complex field types may need manual handling
- Text format names must match between D7 and D11 (or will default to `basic_html`)
## Troubleshooting
### Entity ID conflicts
If you get errors about duplicate IDs, the import will skip those items. Run the import again to retry failed items.
### Field type not supported
Check the logs for "unknown type" messages. You may need to extend `FieldTypeMapper.php` for custom field types.
### Memory issues with large imports
For sites with thousands of nodes, consider importing in batches or increasing PHP memory limit.
## Contributing
This module is intended to be contributed to Drupal.org. Feedback and patches welcome!
## License
GPL-2.0-or-later