ed-itsolutions/wup-client

WordPress 更新提供者客户端,用于插件/主题。

v0.1.3 2019-09-11 08:02 UTC

This package is auto-updated.

Last update: 2024-09-11 19:09:54 UTC


README

WP 更新提供者 的客户端代码。

安装

使用 Composer

composer require ed-itsolutions/wup-client

用法

正常要求 composer。

wup_client 添加到您的 functions.php 或插件类中。

// For a plugin
wup_client('plugin', 'plugin-slug', 'http://your.site.com/wup/plugin-slug');

// For a theme
wup_client('theme', 'theme-slug', 'http://your.site.com/wup/theme-slug');
//                                 ^^ URL of your WUP install.

就是这样!

wup-client 现在将与应用程序进行通信并在需要时提供更新。

CI

wup-client 还提供了 wup_build 函数,可以用于自动构建和发布您插件的新版本。

wup_build(
  'theme-slug', // The themes (or plugins) slug.
  '/some/path', // The root path of the theme/plugin. Use dirname(__FILE__) to make this generic.
  'deployKey', // The deploy key for the server. DON'T ACTUALLY PUT THIS IN VCS. ProTip. getenv('WUP_DEPLOY_KEY')
  'http://yoursite.com/wp-admin/admin-post.php' // The admin-post.php url for your site.
);

退出代码

  • 1 - 在域名部署时出错。
  • 2 - 没有设置部署密钥。

客户端冲突解决

WUP-Client 可能出现在同一网站上的多个插件中。可能是它被两个 wp-update-provider 服务器使用,并且您无法控制其他安装的更新。

为了防止插件A使用 wup-client 0.0.X 和插件B使用 0.1.X 导致插件B使用 0.0.X 的 WUPClient 类,已实施系统以确保所有插件和主题都使用最新的 WUPClient 版本。

如果引入破坏性变更,将制定系统以确保 WUPClient 在正确的次要版本中使用。