定制 renzojohnson/wc-hpos-helper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

renzojohnson/wc-hpos-helper

最新稳定版本:v0.26.02.24

Composer 安装命令:

composer require renzojohnson/wc-hpos-helper

包简介

WooCommerce HPOS data integrity toolkit. Audit orders, subscriptions, and customer data after High-Performance Order Storage migration. Detect orphaned records, zero-value fields, and sync mismatches. Zero dependencies.

README 文档

README

Latest Version PHP Version License

WooCommerce HPOS data integrity toolkit. Audit orders, subscriptions, and customer data after High-Performance Order Storage migration. Detect orphaned records, zero-value fields, and sync mismatches.

Author: Renzo Johnson

Requirements

  • PHP 8.4+
  • PDO MySQL extension
  • JSON extension

Installation

composer require renzojohnson/wc-hpos-helper

Usage

use RenzoJohnson\WcHposHelper\HposHelper;

$helper = new HposHelper(
    dsn: 'mysql:host=localhost;dbname=wordpress',
    user: 'root',
    pass: 'secret',
);

// Full audit
$report = $helper->audit();
echo $report->toJson();

// Individual audits
$orderResult = $helper->auditOrders();
$subResult = $helper->auditSubscriptions();
$customerResult = $helper->auditCustomers();
$metaResult = $helper->auditMeta();

// Check HPOS status
$helper->isHposEnabled();  // bool
$helper->isSyncEnabled();  // bool

Custom Table Prefix

// Standard WordPress
$helper = new HposHelper($dsn, $user, $pass, prefix: 'wp_');

// Multisite (site 2)
$helper = new HposHelper($dsn, $user, $pass, prefix: 'wp_2_');

// Custom prefix
$helper = new HposHelper($dsn, $user, $pass, prefix: 'mysite_');

Sample Limit

$helper = new HposHelper($dsn, $user, $pass);
$helper->setSampleLimit(100); // Default is 50

Audits

Order Audit

Compares wp_wc_orders against wp_posts for mismatches in parent ID, customer ID, status, and totals. Only checks shop_order type. Status is normalized (lowercase, wc- prefix stripped). Totals use decimal-safe comparison.

Subscription Audit

Checks subscriptions for customer_id = 0 on active subscriptions (error) and parent_order_id = 0 on cancelled subscriptions (warning). Detects orphaned renewal orders pointing to non-existent subscriptions.

Customer Audit

Verifies wp_wc_customer_lookup matches order billing data. Checks email consistency and flags guest lookup rows and missing emails as warnings.

Meta Sync Audit

Compares 12 canonical meta keys between HPOS and legacy tables. HPOS is treated as authoritative. Reports value mismatches and missing keys in the posts table.

Report Format

{
    "generated_at": "2026-02-24T15:00:00+00:00",
    "prefix": "wp_",
    "hpos_enabled": true,
    "sync_enabled": true,
    "summary": {
        "total_checked": 350,
        "total_mismatches": 5,
        "total_warnings": 3,
        "audits_passed": 2,
        "audits_failed": 1,
        "audits_skipped": 1,
        "overall_passed": false
    },
    "results": [...]
}

Links

License

MIT License. Copyright (c) 2026 Renzo Johnson.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固