vanilla/knowledge-porter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vanilla/knowledge-porter

Composer 安装命令:

composer create-project vanilla/knowledge-porter

包简介

A command line porter for Vanilla Knowledge

README 文档

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. Screen Shot 2020-03-25 at 5 22 12 PM

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 and source-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.

vanilla/knowledge-porter 适用场景与选型建议

vanilla/knowledge-porter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.24k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 vanilla/knowledge-porter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vanilla/knowledge-porter 我们能提供哪些服务?
定制开发 / 二次开发

基于 vanilla/knowledge-porter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 24.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-02-10