我想使用外部php Script在Typo3系统中导入一些文件。如何为 sys_file 表创建类似identifier_hash
folder_hash
sha1
的哈希字段值?
如果我将这些字段留空,则会出现错误:
Attempt to modify record '3094' (sys_file_reference:3094) without permission. Or non-existing page.
答案 0 :(得分:1)
执行此操作的最佳方法可能是调用TYPO3 API, 因此你必须放在fileadmin /中的某个地方,然后调用
TYPO3\CMS\Core\Resource\getFileObjectByStorageAndIdentifier($storageUid,
$fileIdentifier);
TYPO3源中的hashIdentifier函数使用标准的php-sha1函数,以防万一你不想使用TYPO3-API。
答案 1 :(得分:1)
$file = array(
'folder' => 'images',
'identifier' => 'images/foobar.jpg'
);
$identifierHash = sha1($file['identifier']);
$folderHash = sha1($file['folder']);
$sha1 = sha1_file($file['identifier']);