lucamauri/page-to-github 问题修复 & 功能扩展

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

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

lucamauri/page-to-github

Composer 安装命令:

composer require lucamauri/page-to-github

包简介

Allow the transport of page content to GitHub on page save

README 文档

README

StyleCI Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock Average time to resolve an issue Percentage of issues still open

Badges

GPL-2.0-or-later License Built with Visual Studio Code Discuss on StackOverflow

PageToGitHub

PageToGitHub (P2G) is a MediaWiki extension that automatically uploads page content to a GitHub repository on every page save. It listens for the PageSaveComplete hook and can be scoped to a specific namespace and an optional keyword that must be present in the page body.

It was originally conceived and written by Luca Mauri for use in WikiTrek and is released as open source in case it is useful to others.

Features

  • Automatically uploads wikitext content to a GitHub repository on page save
  • Configurable namespace filter: only pages in the specified namespace are synced
  • Optional keyword filter: only pages containing a specific string are synced
  • Optional filename prefix: the keyword can be prepended to the uploaded filename
  • Minor edits can be excluded from syncing
  • Upload and commit messages use the wiki's i18n system
  • Special page (Special:PageToGitHub) shows the current configuration

Requirements

  • PHP 8.1 or later
  • MediaWiki 1.42 or later
  • A GitHub personal access token with repository write permissions
  • Composer for dependency management

Install

The easiest way to install the extension is using Composer: it will automatically resolve and install all dependencies.

Add the following to composer.local.json at the root of your MediaWiki installation (create the file if it does not exist):

{
    "require": {
        "lucamauri/page-to-github": "~2.1"
    },
    "extra": {
        "merge-plugin": {
            "include": []
        }
    },
    "config": {}
}

Then run Composer from the root of your MediaWiki installation:

composer install --no-dev

Add the following line near the rest of the extension loading calls in LocalSettings.php:

wfLoadExtension( 'PageToGitHub' );

Then add the configuration parameters described in the Configuration section below.

Configuration

Add the following to LocalSettings.php:

$wgP2GAuthToken    = 'your-github-personal-access-token';
$wgP2GIgnoreMinor  = true;
$wgP2GNameSpace    = 'Module';
$wgP2GOwner        = 'github-username-or-organisation';
$wgP2GRepo         = 'repository-name';
$wgP2GKeyword      = '';      // optional
$wgP2GAddKeyword   = false;   // optional

$wgP2GAuthToken

The GitHub personal access token used to authenticate API calls. Generate one in your GitHub account under Settings > Developer settings > Personal access tokens. The token must have repository write permissions.

$wgP2GIgnoreMinor

When set to true (the default), page saves flagged as minor edits are not synced to GitHub.

$wgP2GNameSpace

Only pages belonging to this namespace are synced. Set to the namespace label as a string, e.g. 'Module'.

$wgP2GOwner

The GitHub username or organisation that owns the target repository.

$wgP2GRepo

The name of the GitHub repository where files are uploaded.

$wgP2GKeyword

An optional keyword string. When set, only pages whose content contains this string are synced. Leave empty (the default) to sync all pages in the configured namespace.

$wgP2GAddKeyword

When set to true and $wgP2GKeyword is non-empty, the keyword is prepended to the uploaded filename, e.g. a page named Foo with keyword bar is uploaded as bar-Foo.lua. Defaults to false.

Troubleshooting

To read detailed log messages, intercept the log group named PageToGitHub by adding the following to LocalSettings.php:

$wgShowExceptionDetails = true;
$wgDebugLogGroups['PageToGitHub'] = "/var/log/mediawiki/PageToGitHub-{$wgDBname}.log";

Changelog

See the GitHub releases page for the full changelog.

License

This extension is released under the GNU General Public License 2.0 or later.

Maintainers

Luca Mauri

Contributors

Luca Mauri

lucamauri/page-to-github 适用场景与选型建议

lucamauri/page-to-github 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 02 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 lucamauri/page-to-github 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2020-02-08