vanilla / knowledge-porter
A command line porter for Vanilla Knowledge
Requires
- php: ^8.1
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-mbstring: *
- ext-simplexml: *
- psr/log: ^3.0
- psr/simple-cache: *
- symfony/cache: ^6.2
- vanilla/garden-cli: ^4.0
- vanilla/garden-container: ^4.0
- vanilla/garden-http: ^2.0|^3.0
- vanilla/garden-schema: ^1.0|^3.0
Requires (Dev)
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^3.5
- vanilla/standards: ^1.3
- vimeo/psalm: ^4.9
- dev-master
- v2.2
- v2.1
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
- dev-fix/garden-http-version
- dev-fix/vnla-5468.2
- dev-fix/vnla-5468
- dev-fix-vanilla-mock-destination
- dev-VNLA-3506_optimize-kb-porter-for-queue
- dev-upgrade-garden-container
- dev-remove-garden-cli-lock
- dev-set-psr-simple-cache-to-wildcard
- dev-set-psr-log-to-wildcard
- dev-fix/on-date-update-not-working
- dev-fix/throttling
- dev-revert-69-add-throttle-to-vanilla
- dev-add-throttle-to-vanilla
- dev-fix/add-base-rate-limiting
- dev-fix/debug-import-20220701
- dev-fix/locale-not-available
- dev-feature/oracle-kb
- dev-feature/destination-locale
- dev-fix/zendesk-private-file-download
- dev-feature/load-attachments-files
- dev-add/source-phpdoc
- dev-fix/import-bugs
- dev-feature/fetch-all
- dev-fix/php-notice
- dev-feature/hostedQueueAdaptation
- dev-feature/import-recommended-articles
- dev-feature/32-authors-disable
- dev-fix/articles-onDate-patch
- dev-feature/1675-helpful-votes
- dev-feature/1683-kb-demo-feedback
- dev-feature/1671-allow-api-insert-update-dates
- dev-feature/zendesk-sync-mode
- dev-fix/rerun-failed-categories
- dev-fix/skip-articles
- dev-fix/add-article-importlimit
- dev-fix/update-fields-date-updated
- dev-feature/validtion-error-strings
- dev-fix/remove-html-tags
- dev-feature/rate-limit
- dev-feature/config-schema-validation
- dev-fix/map-zendesk-locales
- dev-feature/work-in-progress
This package is auto-updated.
Last update: 2024-11-27 14:21:00 UTC
README
A command line porter for Vanilla Knowledge.
Example:
./bin/knowledge-porter import --config="./customer1.zendesk.json"
Where ./customer1.zendesk.json
is relative path to your configuration file.
Configuration file contains set of feature flags for porter to configure source and destination (data & api). Example:
{
"source": {
"type": "zendesk",
"protocol": "http", // For local setup only
"prefix": "{PREFIX}", // prefix to set foreign id on destination records
"domain": "{ZENDESK_API_DOMAIN}", // eg: help.gink.com
"token": "{EMAIL_TOKEN}", // eg: dev@mail.com/token:xxQWERTYptodnoL
"targetDomain": "{NEW_DOMAIN_PATH}", // eg: dev.vanilla.localhost
"perPage": 2,
"pageFrom": 1,
"pageTo": 100,
"sourceLocale": {Zendesk locale} // eg: "en-us"
"destinationLocale": {locale} // eg: "en-us"
"import": {
"categories": true,
"retrySections": true,
"sections": true,
"authors": true,
"articles": true,
"translations": true,
"attachments": true,
"helpful": true,
"fetchPrivateArticles": false,
"fetchDraft": false
},
"api": {
"cache": true,
"log": true
}
},
"destination": {
"type": "vanilla",
"domain": "{VANILLA_API_DESTINATION_DOMAIN}", // ex: dev.vanilla.localhost
"token": "va.{VANILLA_API_TOKEN}",
"update": "onChange",
"api": {
"cache": false,
"log": true,
"verbose": false // Display more informations for each request
}
// by default we don't want KB to be patched after 1st sync
// that will allow to avoid kb-url-slug update if edited on vanilla side
"patchKnowledgeBase": false,
"syncUserByEmailOnly": false
}
}
Alternatively, you can set the porter configuration into an environmental variable and tell the porter to use the variable instead of the configuration file.
Example, assuming your configuration is set on the variable CONFIG:
./bin/knowledge-porter import --config="ENV:CONFIG"
Note: The environmental variable must contain a valid JSON configuration in the same way that a file configuration should be.
Rate Limit Bypass for Vanilla's Infrastructure
If the destination is type vanilla
, you might want to use the rate_limit_bypass_token
(optional) configuration parameter to set your rate limit bypass token.
Users and Authors
When porter import articles it is searching for existing user by email
and uses it if found.
If user is not found by email porter checks configuration feature flag syncUserByEmailOnly
and if that flag is false (dafault) search user by name
.
If user still can not be found porter will create new user.
Import from multiple domains
In case we need to import data from different domains and they all could be reached using same api credentials/token
there is another tool mulit-import.sh
.
This script get one argument which is folder name with special configuration file.
For example gink
.
That folder should have 2 files inside: template.json
and domains
.
template.json
is regular config json file for this porter. but with 2 special values prefix
and source-domain
:
{
"source": {
"type": "zendesk",
"foreignIDPrefix": "{prefix}",
"domain": "{source-domain}",
...
},
"destination": {
"type": "vanilla",
...
}
}
and domains
file has very flat structure domain.com=prefix
like:
diamond.gink.com=diamond
digger.gink.com=digger
betty.gink.com=betty
This bash script will:
- read
domains
and loop trough - get each domain and prefix value
- copy
template.json
to/conf
subfolder with new name. Eg:diamond.gink.com.json
- substitute
prefix
andsource-domain
in that new configuration file - run
knowledge-porter
command in background with this per domain prepared config
Example:
./bin/multi-import.sh gink
This multi-import
script starts many php processes in background (one process per domain).
We can check progress using various log files created by this tool in targeted {folder}/log
.
There is one special log file {folder}/log/import.log
.
It has PIDs of running php processes in case developer need to stop them or investigate any incident.