inspiredminds/contao-wordpressimport 问题修复 & 功能扩展

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

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

inspiredminds/contao-wordpressimport

Composer 安装命令:

composer require inspiredminds/contao-wordpressimport

包简介

Contao 4 bundle that allows you to import news articles from WordPress posts via the WordPress JSON API.

README 文档

README

Contao WordPress Import

Contao 4 extension that allows you to import news articles from WordPress posts via the WordPress JSON API.

Installation

Require the bundle via composer:

composer require inspiredminds/contao-wordpressimport

If you use the Contao Standard Edition, you will have to add

new WordPressImportBundle\WordPressImportBundle()

to your AppKernel.php.

Then execute the Contao Install Tool to update the database.

Usage

Once installed, you will have new options within a news archive:

Contao news archive settings

  • WordPress URL: This is the URL to your remote WordPress installation, from which you want to import news. This WordPress installation must have the WP REST API available. It's included and active by default in WordPress 4.7 and higher.
  • Import periodically: Instead of importing the WordPress posts via console command (see below), you can activate a periodic import here, which will be done via Contao's cronjob.
  • Default author: Every imported news item will have this author assigned, if no other author is available (see next option).
  • Import authors: This will generate new backend users for each new found author. Existing authors are identified by their name, so if your Contao installation already has a backend user with the same name as an author from a WordPress post, that backend user will be used as the author. Note: the automatically generated authors are just bare entries. They will only have their name set. They will not have a username or password and they will be disabled by default.
  • Import comments: This will import the comments of each WordPress post, if the Contao Comments Bundle is present. Note: the email field of each commenter will not be filled, since that is obviously not available via the public WP REST API.
  • Import folder: When a WordPress posts gets imported, its teaser image and all images from its detailed content are saved to this folder.
  • Category: This is an optional root category, under which every imported category of the WordPress posts will reside. If you do not specify a root category, the imported categories will be imported to the root. Note: this option will only be available, if you have the news_categories extension installed.

Console Command

To import the WordPress posts into your Contao installation, you can use the following console command:

vendor/bin/contao-console wordpressimport

Optionally you can define the limit of how many WordPress posts are imported in one go:

vendor/bin/contao-console wordpressimport 10

This will only import 10 WordPress posts at a time.

Use bin/console in the Contao Standard Edition.

Periodic import

If you activated the periodic import, the WordPress posts will be imported hourly by Contao's cronjob.

Note: by default only 10 items will be imported with each cronjob execution. The import can take a long time (depending on the number of WordPress posts and the number of images to be downloaded). This limit is there so that a cronjob execution does not block a user's request for a long time (or at least until the max_execution_time limit is hit) in case you are relying on the web cron. You can change this limit in the System Settings.

Events

Version 2.1.0 introduced an WordPressImportBundle\Event\ImportWordPressPostEvent which is fired for each imported WordPress post after it has been fully processed by the extension. It holds references to the used HTTP client instance, the WordPress post object and the Contao\NewsModel instance. This allows you to modify the imported news article.

Since version 2.2.0 there is also an WordPressImportBundle\Event\ApiResponseBodyEvent which is fired for each response of WordPress' REST API. This will let you fix invalid JSON output for example, before processing the response further (see here).

inspiredminds/contao-wordpressimport 适用场景与选型建议

inspiredminds/contao-wordpressimport 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.88k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「import」 「wordpress」 「news」 「contao」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 inspiredminds/contao-wordpressimport 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2017-10-28