ironshark / typo3-data-importer
将 XLS 文件中的数据导入 Typo3 数据库
v0.0.1
2016-07-26 14:01 UTC
Requires
- php: ~5.5|~7.0
- box/spout: ^2.5
- doctrine/dbal: ^2.5
- nikic/php-parser: ^2.1
- symfony/console: ^3.1
This package is not auto-updated.
Last update: 2024-09-26 04:07:33 UTC
README
将 XLS 文件中的数据导入 Typo3 数据库。
功能
- 单个文件/目录导入
- 自定义列名映射
- 指定列的默认值
- 动态生成默认值,如日期/时间戳
- 自定义值转换
- 更新现有行
- 移动成功/失败文件
- 错误时事务回滚
安装
通过 Composer
$ composer require ironshark/typo3-data-importer
使用方法
php vendor/bin/typo3-data-importer import /path/to/file
可能选项
动态默认值
参数/快捷键/默认值
Usage: import [options] [--] <data-file> Arguments: data-file Path to data file, or directory with files to be imported. Options: -c, --config-file[=CONFIG-FILE] Path typo3 configuration file, db configs fill be loaded from this file. [default: false] --column[=COLUMN] Import file column, to db field mapping in following format db_field:ImportFileColumn (multiple values allowed) -t, --table[=TABLE] Database table name [default: "fe_users"] -m, --map[=MAP] Data mapping, transform imported values before inserting in database: "column:source_value:target_value" e.g "gender:Herr:1" (multiple values allowed) -u, --unique-field[=UNIQUE-FIELD] Unique field names, to find entities witch could be updated (multiple values allowed) -d, --default[=DEFAULT] Default values, to insert some values not listed in the import file. (multiple values allowed) --success-directory[=SUCCESS-DIRECTORY] Successful imported files will be moved to given directory if option is set. --error-directory[=ERROR-DIRECTORY] Unsuccessful imported files will be moved to given directory if option is set. --no-trim Disables trimming of field values. -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
示例
php vendor/bin/typo3-data-importer import --config-file="/var/www/src/typo3conf/localconf.php" --data-file="import" --column="last_name:Name" --column="first_name:Vorname" --column="gender:Anrede" --column="email:E-Mailadresse" --colu="language:Sprachcode" --column="username:E-Mailadresse" --map="gender:Herr:1" --unique-field="email" --default="pid:1709" --default="usergroup:4" --error-directory="error" --default="tstamp:{date:U}" --default="password:{date:U}"
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
贡献
请参阅 CONTRIBUTING 和 CONDUCT 了解详细信息。
安全
如果您发现任何安全相关的问题,请发送电子邮件至 pauli@ironshark.de 而不是使用问题跟踪器。
鸣谢
许可
MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。