Issue Bug Needs Feedback Quiet

#101920Export and import with impexp CLI - page structure ok, missing content / files / TS template (ddev / docker)

Stephan Kleiber 09/14/23, 12:32 updated 10/24/26, 07:18

Description

Export with backend / GUI:
- .t3d contains everything i want
- file-DIR with files is created
- import works, all Elements and relations ok(pages, tt_content, templates, files)

Export with CLI (same settings as with GUI):
- export shows no errors
- .t3d file is created (but missing: tt_content, TS templates …)
- file-DIR is created, but empty
- import (with backend/GUI): seems ok, pages / page-structure is ok, but no CEs / files (as they are already missing in .t3d)

I think i followed the instructions (https://docs.typo3.org/c/typo3/cms-impexp/main/en-us/Usage/CommandLine.html) and compared them with the GUI settings which actually work when all is done in the backend.

#!/bin/bash

/var/www/html/vendor/bin/typo3 impexp:export \
--type="t3d" \
--pid="5" \
--levels="999" \
--table="sys_category,sys_file,sys_file_collection,sys_file_metadata,sys_file_reference,sys_template,tt_content,tx_news_domain_model_link,tx_news_domain_model_news,tx_news_domain_model_tag" \
--include-related="backend_layout,pages,sys_category,sys_file,sys_file_collection,sys_file_metadata,sys_file_reference,sys_template,tt_content,tx_news_domain_model_link,tx_news_domain_model_news,tx_news_domain_model_tag" \
--include-static="backend_layout,sys_file_storage" \
--exclude-html-css \
--title="export-ddev-id-5" \
--save-files-outside-export-file \
filename-export-ddev-id-5-v5

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Export and import with impexp CLI - page structure ok, missing content / files / TS template (ddev / docker) Resolves: #101920 Releases: main

History 6

  1. Stephan Kleiber changed subject Export and import with impexp CLI - page structure ok, missing content / files / TS template Export and import with impexp CLI - page structure ok, missing content / files / TS template (ddev / docker) <span data-processor="relativetime" data-value="2023-09-14T12:34:38+00:00" > 09/14/23, 12:34 </span>

  2. Stephan Kleiber commented <span data-processor="relativetime" data-value="2023-09-14T12:41:24+00:00" > 09/14/23, 12:41 </span>

    If i change the type to xml i get this error on import
    Error: No records defined in internal data array.

  3. Kay Strobach commented <span data-processor="relativetime" data-value="2024-08-14T09:33:13+00:00" > 08/14/24, 09:33 </span>

    Possible Patch:

    vendor/typo3/cms-impexp/Classes/Export.php

        protected function exportAddFilesFromSysFilesRecords(): void
        {
            if (!isset($this->dat['header']['records']['sys_file']) || !is_array($this->dat['header']['records']['sys_file'] ?? null)) {
                return;
            }
            foreach ($this->dat['header']['records']['sys_file'] as $sysFileUid => $_) {
                try {
                    $fileData = $this->dat['records']['sys_file:' . $sysFileUid]['data'];
                    $this->exportAddSysFile($fileData);
                } catch (InsufficientFileAccessPermissionsException $e) {
                    $this->addError('InsufficientFileAccessPermissionsException ' . $fileData['title'] . ': ' . $e->getMessage());
                } catch (InvalidHashException $e) {
                    $this->addError('InvalidHashException ' . $fileData['title'] . ': ' . $e->getMessage());
                } catch (\Exception $e) {
                    $this->addError('File not found ' . $fileData['title'] . ': ' . $e->getMessage());
                }
            }
        }
  4. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2026-04-14T19:40:51+00:00" > 04/14/26, 19:40 </span>

    In TYPO3 v13 and v14 a few changes have been made (mostly v14). Could you verify this works in v14 for you?

  5. Benni Mack commented <span data-processor="relativetime" data-value="2026-10-24T07:18:18+00:00" > 10/24/26, 07:18 </span>

    Hi Stephan,

    thanks for the detailed report. I think the problem is in how the command line is written, not in impexp itself.

    The options --table, --include-related, --include-static, --record, --list and --exclude are array options. To pass several values you repeat the option; a comma-separated list is not split. With --table="sys_category,sys_file,...,tt_content" the export receives one table name, the literal string sys_category,sys_file,...,tt_content. No table has that name, so no records are added. The page tree is built separately from --pid/@—levels@, which is why the pages are there and everything else is missing. With no sys_file records exported, the files folder stays empty too. The “No records defined” error with XML has the same cause.

    Please try it like this:

    vendor/bin/typo3 impexp:export \
      --type=t3d \
      --pid=5 \
      --levels=999 \
      --table=tt_content \
      --table=sys_template \
      --table=sys_file_reference \
      --table=tx_news_domain_model_news \
      --include-related=sys_file \
      --include-related=sys_file_reference \
      --include-related=sys_category \
      --include-static=sys_file_storage \
      --include-static=backend_layout \
      --save-files-outside-export-file \
      --title="export-ddev-id-5" \
      filename-export-ddev-id-5-v5

    or, simpler, --table=_ALL --include-related=_ALL.

    Note for TYPO3 v14: --exclude-html-css has been removed, so drop it from the command there.

    Could you let us know if this works for you? If it does, we can close this issue. The documentation should get an example showing the repeated options; it only says “(multiple values allowed)” at the moment.

    The file-exception handling Kay suggested in Export::exportAddFilesFromSysFilesRecords() is a separate topic and doesn’t explain the missing records here. If it’s still relevant, please open a new issue for it.