Export extends ImportExport

T3D file Export library (TYPO3 Record Document)

Internal

This class is not considered part of the public TYPO3 API.

Table of Contents

Constants

FILETYPE_T3D  = 't3d'
FILETYPE_T3DZ  = 't3d_compressed'
FILETYPE_XML  = 'xml'
LEVELS_EXPANDED_TREE  = -1
LEVELS_INFINITE  = 999
LEVELS_RECORDS_ON_THIS_PAGE  = -2

Properties

$cacheGetRecordPath  : array<string|int, mixed>
Cache for record paths
$compressionAvailable  : bool
$dat  : array<string|int, mixed>
Internal import/export memory
$defaultImportExportFolder  : Folder|null
$defaultRecordIncludeFields  : array<string|int, mixed>
Default array of fields to be included in the export
$defaultStorage  : ResourceStorage|null
Currently registered default storage object
$description  : string
$diffUtility  : DiffUtility
$doesImport  : bool
Set by importData() when an import is started.
$errorLog  : array<string|int, mixed>
Error log.
$excludeDisabledRecords  : bool
Flag to control whether all disabled records and their children are excluded (true) or included (false). Defaults to the old behaviour of including everything.
$excludeMap  : array<string|int, mixed>
Exclude map. Keys are table:uid pairs and if set, records are not added to the export.
$exportFileName  : string
$exportFileType  : string
$extensionDependencies  : array<string|int, mixed>
Listing extension dependencies.
$extFileResourceExtensions  : string
Files with external media (HTML/css style references inside)
$fileadminFolderName  : string
Name of the "fileadmin" folder where files for export/import should be located
$fileIdMap  : array<string|int, mixed>
Mapping between the fileID from import memory and the final filenames they are written to.
$fileProcObj  : ExtendedFileUtility
File processing object
$forceAllUids  : bool
If set, all UID values are forced! (update or import)
$globalIgnorePid  : bool
If set, PID correct is ignored globally
$iconFactory  : IconFactory
$importMapId  : array<string|int, mixed>
After records are written this array is filled with [table][original_uid] = [new_uid]
$importMode  : array<string|int, mixed>
Setting the import mode for specific import records.
$includeExtFileResources  : bool
If set, HTML file resources are included.
$lang  : LanguageService
$levels  : int
$list  : array<string|int, mixed>
$mode  : string
Whether "import" or "export" mode of object.
$notes  : string
$pageInWebMountCache  : array<string|int, mixed>
Cache for checks if page is in user web mounts.
$permsClause  : string
A WHERE clause for selection records from the pages table based on read-permissions of the current backend user.
$pid  : int
Root page of import or export page tree
$pidRecord  : array<string|int, mixed>|null
Root page record of import or of export page tree
$record  : array<string|int, mixed>
$recordTypesIncludeFields  : array<string|int, mixed>
The key is the record type (e.g. 'be_users'), the value is an array of fields to be included in the export.
$relOnlyTables  : array<string|int, mixed>
Add table names here which are THE ONLY ones which will be included into export if found as relations. '_ALL' will allow all tables.
$relStaticTables  : array<string|int, mixed>
Add tables names here which should not be exported with the file.
$remainHeader  : array<string|int, mixed>
$saveFilesOutsideExportFile  : bool
$showDiff  : bool
If set, a diff-view column is added to the preview.
$showStaticRelations  : bool
If set, static relations (not exported) will be shown in preview as well
$softrefCfg  : array<string|int, mixed>
Soft reference token ID modes.
$softrefInputValues  : array<string|int, mixed>
Array of values to substitute in editable soft references.
$storageRepository  : StorageRepository
$storages  : array<string|int, ResourceStorage>
Array of currently registered storage objects
$storagesAvailableForImport  : array<string|int, ResourceStorage>
Array of currently registered storage objects available for importing files to
$supportedFileTypes  : array<string|int, mixed>
$tables  : array<string|int, mixed>
$temporaryFolderName  : string|null
$title  : string
$treeHTML  : string
$update  : bool
Updates all records that has same UID instead of creating new!

Methods

__construct()  : mixed
The constructor
addFiles()  : void
Add file relations of a record to the preview.
exportAddRecord()  : void
Adds the record $row from $table.
fixFileIdInRelations()  : void
This changes the file reference ID from a hash based on the absolute file path (coming from ReferenceIndex) to a hash based on the relative file path.
getDat()  : array<string|int, mixed>
getDescription()  : string
getErrorLog()  : array<string|int, mixed>
getExcludeMap()  : array<string|int, mixed>
getExportFileName()  : string
getExportFileType()  : string
getExtensionDependencies()  : array<string|int, mixed>
getFileadminFolderName()  : string
getImportMapId()  : array<string|int, mixed>
getImportMode()  : array<string|int, mixed>
getLevels()  : int
getList()  : array<string|int, mixed>
getMode()  : string
getNotes()  : string
getOrCreateDefaultImportExportFolder()  : Folder|null
Returns a \TYPO3\CMS\Core\Resource\Folder object for saving export files to the server and is also used for uploading import files.
getOrCreateTemporaryFolderName()  : string
getOrGenerateExportFileNameWithFileExtension()  : string
getPid()  : int
getRecord()  : array<string|int, mixed>
getRelOnlyTables()  : array<string|int, mixed>
getRelStaticTables()  : array<string|int, mixed>
getSoftrefCfg()  : array<string|int, mixed>
getSoftrefInputValues()  : array<string|int, mixed>
getSupportedFileTypes()  : array<string|int, mixed>
getTables()  : array<string|int, mixed>
getTitle()  : string
getTreeHTML()  : string
hasErrors()  : bool
isExcludeDisabledRecords()  : bool
isForceAllUids()  : bool
isGlobalIgnorePid()  : bool
isIncludeExtFileResources()  : bool
isSaveFilesOutsideExportFile()  : bool
isShowDiff()  : bool
isShowStaticRelations()  : bool
isUpdate()  : bool
process()  : void
Process configuration
removeDefaultImportExportFolder()  : void
removeRedundantSoftRefsInRelations()  : void
Relations could contain db relations to sys_file records. Some configuration combinations of TCA and SoftReferenceIndex create also soft reference relation entries for the identical file. This results in double included files, one in array "files" and one in array "file_fal".
removeTemporaryFolderName()  : void
render()  : string
This compiles and returns the data content for an exported file - "xml" gives xml - "t3d" and "t3d_compressed" gives serialized array, possibly compressed
renderPreview()  : array<string|int, mixed>
Displays a preview of the import or export.
saveToFile()  : File
setDescription()  : void
setErrorLog()  : void
setExcludeDisabledRecords()  : void
Set flag to control whether disabled records and their children are excluded (true) or included (false). Defaults to the old behaviour of including everything.
setExcludeMap()  : void
setExportFileName()  : void
setExportFileType()  : void
setExtensionDependencies()  : void
setForceAllUids()  : void
setGlobalIgnorePid()  : void
setImportMapId()  : void
setImportMode()  : void
setIncludeExtFileResources()  : void
setLevels()  : void
setList()  : void
setMode()  : void
setNotes()  : void
setPageTree()  : void
Sets the page-tree array in the export header
setPid()  : void
setRecord()  : void
setRecordTypesIncludeFields()  : void
Sets the fields of record types to be included in the export.
setRelOnlyTables()  : void
setRelStaticTables()  : void
setSaveFilesOutsideExportFile()  : mixed
Option to enable having the files not included in the export file.
setShowDiff()  : void
setShowStaticRelations()  : void
setSoftrefCfg()  : void
setSoftrefInputValues()  : void
setTables()  : void
setTitle()  : void
setUpdate()  : void
addError()  : void
Sets error message in the internal error log
addFilePart()  : string
Returns a content part for a filename being build.
addGeneralErrorsByTable()  : void
Log general error message for a given table
addRecord()  : void
Add a record, its relations and soft references, to the preview
addRecordsForPid()  : void
Adds records to the export object for a specific page id.
addRelations()  : void
Add database relations of a record to the preview
addSoftRefs()  : void
Add soft references of a record to the preview
checkDokType()  : bool
Verifies that a table is allowed on a certain doktype of a page.
compareRecords()  : string
Compares two records, the current database record and the one from the import memory.
createDefaultImportExportFolder()  : void
Creates a \TYPO3\CMS\Core\Resource\Folder object for saving export files to the server and is also used for uploading import files.
createTemporaryFolderName()  : string
createXML()  : string
Creates XML string from input array
excludePageAndRecords()  : void
Exclude a page, its sub pages (recursively) and records placed in them from this import/export
execListQueryPid()  : Result
Selects records from table / pid
exportAddFile()  : void
This adds the file to the export - either as content or external file
exportAddFilesFromRelations()  : void
This adds all files in relations.
exportAddFilesFromSysFilesRecords()  : void
This adds all files from sys_file records
exportAddRecordsFromRelations()  : int
This analyzes the existing added records, finds all database relations to records and adds these records to the export file.
exportAddRecordsFromRelationsPushRelation()  : void
Helper function for exportAddRecordsFromRelations()
exportAddSysFile()  : void
This adds the file from a sys_file record to the export - either as content or external file
fetchStorages()  : void
Fetch all available file storages and index by storage UID
filterRecordFields()  : array<string|int, mixed>
If include fields for a specific record type are set, the data are filtered out with fields are not included in the fields.
flatDbRelations()  : array<string|int, mixed>
Database relations flattened to 1-dimensional array.
flatInversePageTree()  : void
Recursively flattening the $pageTree array to a one-dimensional array with uid-pid pairs.
flatSoftRefs()  : array<string|int, mixed>
Soft references flattened to 1-dimensional array.
generateExportFileName()  : string
getBackendUser()  : BackendUserAuthentication
getDiffUtility()  : DiffUtility
Returns string comparing object, initialized only once.
getExcludePagesClause()  : string
Filter page IDs by traversing the exclude map, finding all excluded pages (if any) and making an AND NOT IN statement for the select clause.
getFileExtensionByFileType()  : string
getFileProcObj()  : ExtendedFileUtility
Returns file processing object, initialized only once.
getLanguageService()  : LanguageService
getPidRecord()  : array<string|int, mixed>|null
Return record of root page of import or of export page tree - or null if access denied to that page.
getRecordFromDatabase()  : array<string|int, mixed>|null
Returns given fields of record if it exists.
getRecordPath()  : string
Returns the page title path of a PID value. Results are cached internally
getStorageRepository()  : StorageRepository
Returns storage repository object, initialized only once.
getTranslationForPage()  : array<string|int, mixed>
Add page translations to list of pages
inclRelation()  : bool
Returns TRUE if the input table name is to be included as relation
initializeExport()  : void
Initialize all settings for the export
isPageInWebMount()  : bool
Checking if a page is in the web mounts of the user
isRecordDisabled()  : bool
Test whether a record is disabled (e.g. hidden)
isRecordExcluded()  : bool
Returns TRUE if the element should be excluded from import and export.
isSoftRefIncluded()  : bool
Returns TRUE if the soft reference should be included in export.
isTableStatic()  : bool
Returns TRUE if the input table name is to be regarded as a static relation (that is, not exported etc).
removeExcludedPagesFromPageTree()  : void
Removes entries in the page tree which are found in ->excludeMap[]
renderControls()  : string
Render input controls for import or export
renderImportModeSelector()  : string
Render select box with import options for the record.
renderIndent()  : string
renderRecordExcludeCheckbox()  : string
Render check box for exclusion of a record from export.
renderSelectBox()  : string
Renders a select box from option values.
renderSoftRefExportSelector()  : string
Render select box with export options for soft references.
renderSoftRefImportTextField()  : string
Render text field when importing a soft reference.
resolveStoragePath()  : string
Checks if the input path relative to the public web path can be found in the file mounts of the backend user.
setHeaderBasics()  : void
Set header basics
setMetaData()  : void
Sets meta data
setRecordTypeIncludeFields()  : void
Sets the fields of a record type to be included in the export.
traverseAllRecords()  : void
Go through ALL records (if the pages are displayed first, those will not be among these!)
traversePageRecords()  : void
Go through remaining pages (not in tree)
traversePageTree()  : void
Go through page tree for display

Constants

FILETYPE_T3D

public mixed FILETYPE_T3D = 't3d'

FILETYPE_T3DZ

public mixed FILETYPE_T3DZ = 't3d_compressed'

FILETYPE_XML

public mixed FILETYPE_XML = 'xml'

LEVELS_EXPANDED_TREE

public mixed LEVELS_EXPANDED_TREE = -1

LEVELS_INFINITE

public mixed LEVELS_INFINITE = 999

LEVELS_RECORDS_ON_THIS_PAGE

public mixed LEVELS_RECORDS_ON_THIS_PAGE = -2

Properties

$cacheGetRecordPath

Cache for record paths

protected array<string|int, mixed> $cacheGetRecordPath = []

$compressionAvailable

protected bool $compressionAvailable = false

$dat

Internal import/export memory

protected array<string|int, mixed> $dat = []

$defaultImportExportFolder

protected Folder|null $defaultImportExportFolder = null

$defaultRecordIncludeFields

Default array of fields to be included in the export

protected array<string|int, mixed> $defaultRecordIncludeFields = ['uid', 'pid']

$description

protected string $description = ''

$doesImport

Set by importData() when an import is started.

protected bool $doesImport = false

$errorLog

Error log.

protected array<string|int, mixed> $errorLog = []

$excludeDisabledRecords

Flag to control whether all disabled records and their children are excluded (true) or included (false). Defaults to the old behaviour of including everything.

protected bool $excludeDisabledRecords = false

$excludeMap

Exclude map. Keys are table:uid pairs and if set, records are not added to the export.

protected array<string|int, mixed> $excludeMap = []

$exportFileName

protected string $exportFileName = ''

$exportFileType

protected string $exportFileType = self::FILETYPE_XML

$extensionDependencies

Listing extension dependencies.

protected array<string|int, mixed> $extensionDependencies = []

$extFileResourceExtensions

Files with external media (HTML/css style references inside)

protected string $extFileResourceExtensions = 'html,htm,css'

$fileadminFolderName

Name of the "fileadmin" folder where files for export/import should be located

protected string $fileadminFolderName = ''

$fileIdMap

Mapping between the fileID from import memory and the final filenames they are written to.

protected array<string|int, mixed> $fileIdMap = []

$forceAllUids

If set, all UID values are forced! (update or import)

protected bool $forceAllUids = false

$globalIgnorePid

If set, PID correct is ignored globally

protected bool $globalIgnorePid = false

$importMapId

After records are written this array is filled with [table][original_uid] = [new_uid]

protected array<string|int, mixed> $importMapId = []

$importMode

Setting the import mode for specific import records.

protected array<string|int, mixed> $importMode = []

Available options are: force_uid, as_new, exclude, ignore_pid, respect_pid

$includeExtFileResources

If set, HTML file resources are included.

protected bool $includeExtFileResources = true

$list

protected array<string|int, mixed> $list = []

$mode

Whether "import" or "export" mode of object.

protected string $mode = 'export'

$pageInWebMountCache

Cache for checks if page is in user web mounts.

protected array<string|int, mixed> $pageInWebMountCache = []

$permsClause

A WHERE clause for selection records from the pages table based on read-permissions of the current backend user.

protected string $permsClause

$pid

Root page of import or export page tree

protected int $pid = -1

$pidRecord

Root page record of import or of export page tree

protected array<string|int, mixed>|null $pidRecord = null

$record

protected array<string|int, mixed> $record = []

$recordTypesIncludeFields

The key is the record type (e.g. 'be_users'), the value is an array of fields to be included in the export.

protected array<string|int, mixed> $recordTypesIncludeFields = []

Used in tests only.

$relOnlyTables

Add table names here which are THE ONLY ones which will be included into export if found as relations. '_ALL' will allow all tables.

protected array<string|int, mixed> $relOnlyTables = []

$relStaticTables

Add tables names here which should not be exported with the file.

protected array<string|int, mixed> $relStaticTables = []

(Where relations should be mapped to same UIDs in target system).

$remainHeader

protected array<string|int, mixed> $remainHeader = []

$saveFilesOutsideExportFile

protected bool $saveFilesOutsideExportFile = false

$showDiff

If set, a diff-view column is added to the preview.

protected bool $showDiff = false

$showStaticRelations

If set, static relations (not exported) will be shown in preview as well

protected bool $showStaticRelations = false

$softrefCfg

Soft reference token ID modes.

protected array<string|int, mixed> $softrefCfg = []

$softrefInputValues

Array of values to substitute in editable soft references.

protected array<string|int, mixed> $softrefInputValues = []

$storagesAvailableForImport

Array of currently registered storage objects available for importing files to

protected array<string|int, ResourceStorage> $storagesAvailableForImport = []

$supportedFileTypes

protected array<string|int, mixed> $supportedFileTypes = []

$tables

protected array<string|int, mixed> $tables = []

$temporaryFolderName

protected string|null $temporaryFolderName = null

$update

Updates all records that has same UID instead of creating new!

protected bool $update = false

Methods

__construct()

The constructor

public __construct() : mixed

addFiles()

Add file relations of a record to the preview.

public addFiles(array<string|int, mixed> $relations, array<string|int, mixed> &$lines, int $indent[, string $tokenID = '' ]) : void

Public access for testing purpose only.

Parameters
$relations : array<string|int, mixed>

Array of file IDs

$lines : array<string|int, mixed>

Output lines array

$indent : int

Indentation level

$tokenID : string = ''

Token ID if this is a soft reference (in which case it only makes sense with a single element in the $relations array!)

Tags
see
addRecord()

exportAddRecord()

Adds the record $row from $table.

public exportAddRecord(string $table, array<string|int, mixed> $row[, int $relationLevel = 0 ]) : void

No checking for relations done here. Pure data.

Parameters
$table : string

Table name

$row : array<string|int, mixed>

Record row.

$relationLevel : int = 0

(Internal) if the record is added as a relation, this is set to the "level" it was on.

fixFileIdInRelations()

This changes the file reference ID from a hash based on the absolute file path (coming from ReferenceIndex) to a hash based on the relative file path.

public fixFileIdInRelations(array<string|int, mixed> &$relations) : void

Public access for testing purpose only.

Parameters
$relations : array<string|int, mixed>

getDat()

public getDat() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDescription()

public getDescription() : string
Return values
string

getErrorLog()

public getErrorLog() : array<string|int, mixed>
Return values
array<string|int, mixed>

getExcludeMap()

public getExcludeMap() : array<string|int, mixed>
Return values
array<string|int, mixed>

getExportFileName()

public getExportFileName() : string
Return values
string

getExportFileType()

public getExportFileType() : string
Return values
string

getExtensionDependencies()

public getExtensionDependencies() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFileadminFolderName()

public getFileadminFolderName() : string
Return values
string

getImportMapId()

public getImportMapId() : array<string|int, mixed>
Return values
array<string|int, mixed>

getImportMode()

public getImportMode() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLevels()

public getLevels() : int
Return values
int

getList()

public getList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMode()

public getMode() : string
Return values
string

getNotes()

public getNotes() : string
Return values
string

getOrCreateDefaultImportExportFolder()

Returns a \TYPO3\CMS\Core\Resource\Folder object for saving export files to the server and is also used for uploading import files.

public getOrCreateDefaultImportExportFolder() : Folder|null
Return values
Folder|null

getOrCreateTemporaryFolderName()

public getOrCreateTemporaryFolderName() : string
Return values
string

getOrGenerateExportFileNameWithFileExtension()

public getOrGenerateExportFileNameWithFileExtension() : string
Return values
string

getPid()

public getPid() : int
Return values
int

getRecord()

public getRecord() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRelOnlyTables()

public getRelOnlyTables() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRelStaticTables()

public getRelStaticTables() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSoftrefCfg()

public getSoftrefCfg() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSoftrefInputValues()

public getSoftrefInputValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSupportedFileTypes()

public getSupportedFileTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTables()

public getTables() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTitle()

public getTitle() : string
Return values
string

getTreeHTML()

public getTreeHTML() : string
Return values
string

hasErrors()

public hasErrors() : bool
Return values
bool

isExcludeDisabledRecords()

public isExcludeDisabledRecords() : bool
Return values
bool

isForceAllUids()

public isForceAllUids() : bool
Return values
bool

isGlobalIgnorePid()

public isGlobalIgnorePid() : bool
Return values
bool

isIncludeExtFileResources()

public isIncludeExtFileResources() : bool
Return values
bool

isSaveFilesOutsideExportFile()

public isSaveFilesOutsideExportFile() : bool
Return values
bool

isShowDiff()

public isShowDiff() : bool
Return values
bool

isShowStaticRelations()

public isShowStaticRelations() : bool
Return values
bool

isUpdate()

public isUpdate() : bool
Return values
bool

process()

Process configuration

public process() : void

removeDefaultImportExportFolder()

public removeDefaultImportExportFolder() : void

removeRedundantSoftRefsInRelations()

Relations could contain db relations to sys_file records. Some configuration combinations of TCA and SoftReferenceIndex create also soft reference relation entries for the identical file. This results in double included files, one in array "files" and one in array "file_fal".

public removeRedundantSoftRefsInRelations(array<string|int, mixed> &$relations) : void

This function checks the relations for this double inclusions and removes the redundant soft reference relation.

Public access for testing purpose only.

Parameters
$relations : array<string|int, mixed>

removeTemporaryFolderName()

public removeTemporaryFolderName() : void

render()

This compiles and returns the data content for an exported file - "xml" gives xml - "t3d" and "t3d_compressed" gives serialized array, possibly compressed

public render() : string
Return values
string

The output file stream

renderPreview()

Displays a preview of the import or export.

public renderPreview() : array<string|int, mixed>
Return values
array<string|int, mixed>

The preview data

setDescription()

public setDescription(string $description) : void
Parameters
$description : string

setErrorLog()

public setErrorLog(array<string|int, mixed> $errorLog) : void
Parameters
$errorLog : array<string|int, mixed>

setExcludeDisabledRecords()

Set flag to control whether disabled records and their children are excluded (true) or included (false). Defaults to the old behaviour of including everything.

public setExcludeDisabledRecords(bool $excludeDisabledRecords) : void
Parameters
$excludeDisabledRecords : bool

Set to true if if all disabled records should be excluded, false otherwise

setExcludeMap()

public setExcludeMap(array<string|int, mixed> $excludeMap) : void
Parameters
$excludeMap : array<string|int, mixed>

setExportFileName()

public setExportFileName(string $exportFileName) : void
Parameters
$exportFileName : string

setExportFileType()

public setExportFileType(string $exportFileType) : void
Parameters
$exportFileType : string

setExtensionDependencies()

public setExtensionDependencies(array<string|int, mixed> $extensionDependencies) : void
Parameters
$extensionDependencies : array<string|int, mixed>

setForceAllUids()

public setForceAllUids(bool $forceAllUids) : void
Parameters
$forceAllUids : bool

setGlobalIgnorePid()

public setGlobalIgnorePid(bool $globalIgnorePid) : void
Parameters
$globalIgnorePid : bool

setImportMapId()

public setImportMapId(array<string|int, mixed> $importMapId) : void
Parameters
$importMapId : array<string|int, mixed>

setImportMode()

public setImportMode(array<string|int, mixed> $importMode) : void
Parameters
$importMode : array<string|int, mixed>

setIncludeExtFileResources()

public setIncludeExtFileResources(bool $includeExtFileResources) : void
Parameters
$includeExtFileResources : bool

setLevels()

public setLevels(int $levels) : void
Parameters
$levels : int

setList()

public setList(array<string|int, mixed> $list) : void
Parameters
$list : array<string|int, mixed>

setMode()

public setMode(string $mode) : void
Parameters
$mode : string

setNotes()

public setNotes(string $notes) : void
Parameters
$notes : string

setPageTree()

Sets the page-tree array in the export header

public setPageTree(array<string|int, mixed> $pageTree) : void
Parameters
$pageTree : array<string|int, mixed>

Hierarchy of ids, the page tree: array([uid] => array("uid" => [uid], "subrow" => array(.....)), [uid] => ....)

setPid()

public setPid(int $pid) : void
Parameters
$pid : int

setRecord()

public setRecord(array<string|int, mixed> $record) : void
Parameters
$record : array<string|int, mixed>

setRecordTypesIncludeFields()

Sets the fields of record types to be included in the export.

public setRecordTypesIncludeFields(array<string|int, mixed> $recordTypesIncludeFields) : void

Used in tests only.

Parameters
$recordTypesIncludeFields : array<string|int, mixed>

The key is the record type, the value is an array of fields to be included in the export.

Tags
throws
Exception

if an array value is not type of array

setRelOnlyTables()

public setRelOnlyTables(array<string|int, mixed> $relOnlyTables) : void
Parameters
$relOnlyTables : array<string|int, mixed>

setRelStaticTables()

public setRelStaticTables(array<string|int, mixed> $relStaticTables) : void
Parameters
$relStaticTables : array<string|int, mixed>

setSaveFilesOutsideExportFile()

Option to enable having the files not included in the export file.

public setSaveFilesOutsideExportFile(bool $saveFilesOutsideExportFile) : mixed

The files are saved to a temporary folder instead.

Parameters
$saveFilesOutsideExportFile : bool
Tags
see
ImportExport::getOrCreateTemporaryFolderName()

setShowDiff()

public setShowDiff(bool $showDiff) : void
Parameters
$showDiff : bool

setShowStaticRelations()

public setShowStaticRelations(bool $showStaticRelations) : void
Parameters
$showStaticRelations : bool

setSoftrefCfg()

public setSoftrefCfg(array<string|int, mixed> $softrefCfg) : void
Parameters
$softrefCfg : array<string|int, mixed>

setSoftrefInputValues()

public setSoftrefInputValues(array<string|int, mixed> $softrefInputValues) : void
Parameters
$softrefInputValues : array<string|int, mixed>

setTables()

public setTables(array<string|int, mixed> $tables) : void
Parameters
$tables : array<string|int, mixed>

setTitle()

public setTitle(string $title) : void
Parameters
$title : string

setUpdate()

public setUpdate(bool $update) : void
Parameters
$update : bool

addError()

Sets error message in the internal error log

protected addError(string $message) : void
Parameters
$message : string

Error message

addFilePart()

Returns a content part for a filename being build.

protected addFilePart(string $data) : string
Parameters
$data : string

Data to store in part

Return values
string

Content stream.

addGeneralErrorsByTable()

Log general error message for a given table

protected addGeneralErrorsByTable(string $table) : void
Parameters
$table : string

database table name

addRecord()

Add a record, its relations and soft references, to the preview

protected addRecord(string $table, int $uid, array<string|int, mixed> &$lines, int $indent[, bool $checkImportInPidRecord = false ]) : void
Parameters
$table : string

Table name

$uid : int

Record uid

$lines : array<string|int, mixed>

Output lines array

$indent : int

Indentation level

$checkImportInPidRecord : bool = false

If you want import validation, you can set this so it checks if the import can take place on the specified page.

addRecordsForPid()

Adds records to the export object for a specific page id.

protected addRecordsForPid(int $pid, array<string|int, mixed> $tables[, array<string|int, mixed> $restrictToLanguageIds = [] ]) : void
Parameters
$pid : int

Page id for which to select records to add

$tables : array<string|int, mixed>

Array of table names to select from

$restrictToLanguageIds : array<string|int, mixed> = []

Array of sys_language_uid IDs to allow records for.

addRelations()

Add database relations of a record to the preview

protected addRelations(array<string|int, mixed> $relations, array<string|int, mixed> &$lines, int $indent[, array<string|int, mixed> $recursionCheck = [] ]) : void
Parameters
$relations : array<string|int, mixed>

Array of relations

$lines : array<string|int, mixed>

Output lines array

$indent : int

Indentation level

$recursionCheck : array<string|int, mixed> = []

Recursion check stack

Tags
see
addRecord()

addSoftRefs()

Add soft references of a record to the preview

protected addSoftRefs(array<string|int, mixed> $softrefs, array<string|int, mixed> &$lines, int $indent) : void
Parameters
$softrefs : array<string|int, mixed>

Soft references

$lines : array<string|int, mixed>

Output lines array

$indent : int

Indentation level

Tags
see
addRecord()

checkDokType()

Verifies that a table is allowed on a certain doktype of a page.

protected checkDokType(string $table, int $dokType) : bool
Parameters
$table : string

Table name to check

$dokType : int

Page doktype

Return values
bool

TRUE if OK

compareRecords()

Compares two records, the current database record and the one from the import memory.

protected compareRecords(array<string|int, mixed> $databaseRecord, array<string|int, mixed> $importRecord, string $table[, bool $inverse = false ]) : string

Will return HTML code to show any differences between them!

Parameters
$databaseRecord : array<string|int, mixed>

Database record, all fields (old values)

$importRecord : array<string|int, mixed>

Import memory record for the same table/uid, all fields (new values)

$table : string

The table name of the record

$inverse : bool = false

Inverse the diff view (switch red/green, needed for pre-update difference view)

Return values
string

HTML

createDefaultImportExportFolder()

Creates a \TYPO3\CMS\Core\Resource\Folder object for saving export files to the server and is also used for uploading import files.

protected createDefaultImportExportFolder() : void

createTemporaryFolderName()

protected createTemporaryFolderName() : string
Return values
string

createXML()

Creates XML string from input array

protected createXML() : string
Return values
string

XML content

excludePageAndRecords()

Exclude a page, its sub pages (recursively) and records placed in them from this import/export

protected excludePageAndRecords(int $pageUid, array<string|int, mixed> $page) : void
Parameters
$pageUid : int

Uid of the page to exclude

$page : array<string|int, mixed>

Page array with uid/subrow (from ->dat[header][pagetree])

execListQueryPid()

Selects records from table / pid

protected execListQueryPid(int $pid, string $table) : Result
Parameters
$pid : int

Page ID to select from

$table : string

Table to select from

Return values
Result

Query statement

exportAddFile()

This adds the file to the export - either as content or external file

protected exportAddFile(array<string|int, mixed> $fileData[, string $recordRef = '' ][, string $field = '' ]) : void
Parameters
$fileData : array<string|int, mixed>

File information with three keys: "filename" = filename without path, "ID_absFile" = absolute filepath to the file (including the filename), "ID" = md5 hash of "ID_absFile". "relFileName" is optional for files attached to records, but mandatory for soft referenced files (since the relFileName determines where such a file should be stored!)

$recordRef : string = ''

If the file is related to a record, this is the id of the form [table]:[id]. Information purposes only.

$field : string = ''

If the file is related to a record, this is the field name it was related to. Information purposes only.

exportAddFilesFromRelations()

This adds all files in relations.

protected exportAddFilesFromRelations() : void

Call this method AFTER adding all records including relations.

Tags
see
exportAddRecordsFromRelations()

exportAddFilesFromSysFilesRecords()

This adds all files from sys_file records

protected exportAddFilesFromSysFilesRecords() : void

exportAddRecordsFromRelations()

This analyzes the existing added records, finds all database relations to records and adds these records to the export file.

protected exportAddRecordsFromRelations([int $relationLevel = 0 ]) : int

This function can be called repeatedly until it returns zero added records. In principle it should not allow to infinite recursion, but you better set a limit... Call this BEFORE the exportAddFilesFromRelations (so files from added relations are also included of course)

Parameters
$relationLevel : int = 0

Recursion level

Tags
see
exportAddFilesFromRelations()
Return values
int

number of records from relations found and added

exportAddRecordsFromRelationsPushRelation()

Helper function for exportAddRecordsFromRelations()

protected exportAddRecordsFromRelationsPushRelation(array<string|int, mixed> $recordData, array<string|int, mixed> &$addRecords[, string $tokenID = '' ]) : void
Parameters
$recordData : array<string|int, mixed>

Record of relation with table/id key to add to $addRecords

$addRecords : array<string|int, mixed>

Records of relations which are already marked as to be added to the export

$tokenID : string = ''

Soft reference token ID, if applicable.

Tags
see
exportAddRecordsFromRelations()

exportAddSysFile()

This adds the file from a sys_file record to the export - either as content or external file

protected exportAddSysFile(array<string|int, mixed> $fileData) : void
Parameters
$fileData : array<string|int, mixed>
Tags
throws
InvalidHashException

fetchStorages()

Fetch all available file storages and index by storage UID

protected fetchStorages() : void

Note: It also creates a default storage record if the database table sys_file_storage is empty, e.g. during tests.

filterRecordFields()

If include fields for a specific record type are set, the data are filtered out with fields are not included in the fields.

protected filterRecordFields(string $table, array<string|int, mixed> $row) : array<string|int, mixed>

Used in tests only.

Parameters
$table : string

The record type to be filtered

$row : array<string|int, mixed>

The data to be filtered

Return values
array<string|int, mixed>

The filtered record row

flatDbRelations()

Database relations flattened to 1-dimensional array.

protected flatDbRelations(array<string|int, mixed> $relations) : array<string|int, mixed>

The list will be unique, no table/uid combination will appear twice.

Parameters
$relations : array<string|int, mixed>

2-dimensional array of database relations organized by table key

Return values
array<string|int, mixed>

1-dimensional array where entries are table:uid and keys are array with table/id

flatInversePageTree()

Recursively flattening the $pageTree array to a one-dimensional array with uid-pid pairs.

protected flatInversePageTree(array<string|int, mixed> $pageTree, array<string|int, mixed> &$list[, int $pid = -1 ]) : void
Parameters
$pageTree : array<string|int, mixed>

Page tree array

$list : array<string|int, mixed>

List with uid-pid pairs

$pid : int = -1

PID value (internal, don't set from outside)

flatSoftRefs()

Soft references flattened to 1-dimensional array.

protected flatSoftRefs(array<string|int, mixed> $relations) : array<string|int, mixed>
Parameters
$relations : array<string|int, mixed>

2-dimensional array of database relations organized by table key

Return values
array<string|int, mixed>

1-dimensional array where entries are arrays with properties of the soft link found and keys are a unique combination of field, spKey, structure path if applicable and token ID

generateExportFileName()

protected generateExportFileName() : string
Return values
string

getDiffUtility()

Returns string comparing object, initialized only once.

protected getDiffUtility() : DiffUtility
Return values
DiffUtility

String comparing object

getExcludePagesClause()

Filter page IDs by traversing the exclude map, finding all excluded pages (if any) and making an AND NOT IN statement for the select clause.

protected getExcludePagesClause() : string
Return values
string

AND where clause part to filter out page uids.

getFileExtensionByFileType()

protected getFileExtensionByFileType() : string
Return values
string

getPidRecord()

Return record of root page of import or of export page tree - or null if access denied to that page.

protected getPidRecord() : array<string|int, mixed>|null

If the page is the root of the page tree, add some basic but missing information.

Return values
array<string|int, mixed>|null

getRecordFromDatabase()

Returns given fields of record if it exists.

protected getRecordFromDatabase(string $table, int $uid[, string $fields = 'uid,pid' ]) : array<string|int, mixed>|null
Parameters
$table : string

Table name

$uid : int

UID of record

$fields : string = 'uid,pid'

Field list to select. Default is "uid,pid"

Return values
array<string|int, mixed>|null

Result of \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord() which means the record if found, otherwise NULL

getRecordPath()

Returns the page title path of a PID value. Results are cached internally

protected getRecordPath(int $pid) : string
Parameters
$pid : int

Record PID to check

Return values
string

The path for the input PID

getTranslationForPage()

Add page translations to list of pages

protected getTranslationForPage(int $defaultLanguagePageUid, bool $considerHiddenPages[, array<string|int, mixed> $limitToLanguageIds = [] ]) : array<string|int, mixed>
Parameters
$defaultLanguagePageUid : int
$considerHiddenPages : bool
$limitToLanguageIds : array<string|int, mixed> = []
Return values
array<string|int, mixed>

inclRelation()

Returns TRUE if the input table name is to be included as relation

protected inclRelation(string $table) : bool
Parameters
$table : string

Table name

Return values
bool

TRUE, if table is marked static

initializeExport()

Initialize all settings for the export

protected initializeExport() : void

isPageInWebMount()

Checking if a page is in the web mounts of the user

protected isPageInWebMount(int $pid) : bool
Parameters
$pid : int

Page ID to check

Return values
bool

TRUE if OK

isRecordDisabled()

Test whether a record is disabled (e.g. hidden)

protected isRecordDisabled(string $table, int $uid) : bool
Parameters
$table : string

Name of the records' database table

$uid : int

Database uid of the record

Return values
bool

true if the record is disabled, false otherwise

isRecordExcluded()

Returns TRUE if the element should be excluded from import and export.

protected isRecordExcluded(string $table, int $uid) : bool
Parameters
$table : string

Table name

$uid : int

Record UID

Return values
bool

TRUE, if the record should be excluded

isSoftRefIncluded()

Returns TRUE if the soft reference should be included in export.

protected isSoftRefIncluded(string $tokenID) : bool
Parameters
$tokenID : string

Token ID for soft reference

Return values
bool

TRUE, if soft reference should be included

isTableStatic()

Returns TRUE if the input table name is to be regarded as a static relation (that is, not exported etc).

protected isTableStatic(string $table) : bool
Parameters
$table : string

Table name

Return values
bool

TRUE, if table is marked static

removeExcludedPagesFromPageTree()

Removes entries in the page tree which are found in ->excludeMap[]

protected removeExcludedPagesFromPageTree(array<string|int, mixed> &$pageTree) : void
Parameters
$pageTree : array<string|int, mixed>

Hierarchy of ids, the page tree

renderControls()

Render input controls for import or export

protected renderControls(array<string|int, mixed> $line) : string
Parameters
$line : array<string|int, mixed>

Output line array

Return values
string

HTML

renderImportModeSelector()

Render select box with import options for the record.

protected renderImportModeSelector(string $table, int $uid, bool $doesRecordExist) : string
Parameters
$table : string

Table name

$uid : int

Record UID

$doesRecordExist : bool

Is there already a record with this UID in the database?

Return values
string

HTML

renderIndent()

protected renderIndent(int $indent) : string
Parameters
$indent : int
Return values
string

renderRecordExcludeCheckbox()

Render check box for exclusion of a record from export.

protected renderRecordExcludeCheckbox(string $recordRef) : string
Parameters
$recordRef : string

The record ID of the form [table]:[id].

Return values
string

HTML

renderSelectBox()

Renders a select box from option values.

protected renderSelectBox(string $name, string $value, array<string|int, mixed> $options) : string
Parameters
$name : string

Form element name

$value : string

Current value

$options : array<string|int, mixed>

Options to display (key/value pairs)

Return values
string

HTML

renderSoftRefExportSelector()

Render select box with export options for soft references.

protected renderSoftRefExportSelector(array<string|int, mixed> $softref) : string

An export box is shown only if a substitution scheme is found for the soft reference.

Parameters
$softref : array<string|int, mixed>

Soft reference

Return values
string

HTML

renderSoftRefImportTextField()

Render text field when importing a soft reference.

protected renderSoftRefImportTextField(array<string|int, mixed> $softref) : string
Parameters
$softref : array<string|int, mixed>

Soft reference

Return values
string

HTML

resolveStoragePath()

Checks if the input path relative to the public web path can be found in the file mounts of the backend user.

protected resolveStoragePath(string $dirPrefix[, bool $checkAlternatives = true ]) : string

If not, it checks all file mounts of the user for the relative path and returns it if found.

Parameters
$dirPrefix : string

Path relative to public web path.

$checkAlternatives : bool = true

If set to false, do not look for an alternative path.

Tags
throws
Exception
Return values
string

If a path is available, it will be returned, otherwise NULL.

setHeaderBasics()

Set header basics

protected setHeaderBasics() : void

setMetaData()

Sets meta data

protected setMetaData() : void

setRecordTypeIncludeFields()

Sets the fields of a record type to be included in the export.

protected setRecordTypeIncludeFields(string $table, array<string|int, mixed> $fields) : void

Used in tests only.

Parameters
$table : string

The record type

$fields : array<string|int, mixed>

The fields to be included

traverseAllRecords()

Go through ALL records (if the pages are displayed first, those will not be among these!)

protected traverseAllRecords(array<string|int, mixed> $pageTree, array<string|int, mixed> &$lines) : void
Parameters
$pageTree : array<string|int, mixed>

Page tree array with uid/subrow (from ->dat[header][pagetree])

$lines : array<string|int, mixed>

Output lines array

traversePageRecords()

Go through remaining pages (not in tree)

protected traversePageRecords(array<int, array<string|int, mixed>> $pageTree, array<string|int, mixed> &$lines) : void
Parameters
$pageTree : array<int, array<string|int, mixed>>

Page tree array with uid/subrow (from ->dat[header][pagetree])

$lines : array<string|int, mixed>

Output lines array

traversePageTree()

Go through page tree for display

protected traversePageTree(array<int, array<string|int, mixed>> $pageTree, array<string|int, mixed> &$lines[, int $indent = 0 ]) : void
Parameters
$pageTree : array<int, array<string|int, mixed>>

Page tree array with uid/subrow (from ->dat[header][pagetree])

$lines : array<string|int, mixed>

Output lines array

$indent : int = 0

Indentation level


        
On this page

Search results