REST API 端点:
- GET /wpbridge/v1/sources - 获取所有更新源
- GET /wpbridge/v1/sources/{id} - 获取单个更新源
- GET /wpbridge/v1/check/{source_id} - 检查更新源状态
- GET /wpbridge/v1/plugins/{slug}/info - 获取插件信息
- GET /wpbridge/v1/themes/{slug}/info - 获取主题信息
- GET /wpbridge/v1/wenpai-git/{repo}/releases - 菲码源库 Releases
- GET /wpbridge/v1/status - API 状态
API 认证:
- X-WPBridge-API-Key Header
- Authorization Bearer Token
- api_key 查询参数
API Key 管理:
- ApiKeyManager: Key 生成、验证、撤销
- 支持过期时间设置
- 使用统计记录
速率限制:
- 基于 IP 或 API Key 的限流
- 可配置每分钟请求数
- 429 响应包含 retry_after
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* WPBridge 卸载脚本
|
|
*
|
|
* 当用户从 WordPress 删除插件时执行
|
|
*
|
|
* @package WPBridge
|
|
*/
|
|
|
|
// 如果不是通过 WordPress 卸载,则退出
|
|
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
|
exit;
|
|
}
|
|
|
|
// 删除所有插件选项
|
|
delete_option( 'wpbridge_sources' );
|
|
delete_option( 'wpbridge_settings' );
|
|
delete_option( 'wpbridge_ai_settings' );
|
|
delete_option( 'wpbridge_logs' );
|
|
delete_option( 'wpbridge_activated' );
|
|
delete_option( 'wpbridge_admin_notices' );
|
|
delete_option( 'wpbridge_encryption_key' );
|
|
delete_option( 'wpbridge_source_groups' );
|
|
delete_option( 'wpbridge_version_locks' );
|
|
delete_option( 'wpbridge_notifications' );
|
|
delete_option( 'wpbridge_api' );
|
|
|
|
// 删除所有加密存储的数据
|
|
global $wpdb;
|
|
$wpdb->query(
|
|
$wpdb->prepare(
|
|
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
|
|
$wpdb->esc_like( 'wpbridge_secure_' ) . '%'
|
|
)
|
|
);
|
|
|
|
// 删除所有 transient 缓存
|
|
$wpdb->query(
|
|
$wpdb->prepare(
|
|
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
|
|
$wpdb->esc_like( '_transient_wpbridge_' ) . '%'
|
|
)
|
|
);
|
|
$wpdb->query(
|
|
$wpdb->prepare(
|
|
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
|
|
$wpdb->esc_like( '_transient_timeout_wpbridge_' ) . '%'
|
|
)
|
|
);
|
|
|
|
// 清除定时任务
|
|
wp_clear_scheduled_hook( 'wpbridge_update_sources' );
|
|
|
|
// 清除对象缓存
|
|
if ( wp_using_ext_object_cache() ) {
|
|
if ( function_exists( 'wp_cache_flush_group' ) ) {
|
|
wp_cache_flush_group( 'wpbridge' );
|
|
} else {
|
|
wp_cache_delete( 'wpbridge', 'wpbridge' );
|
|
}
|
|
}
|