feat(schema): v0.6.0 — PSA backfill migration + Yoast-integrated Drug/MedicalWebPage/FAQ schema
Piece 1 — Backfill migration 0004: copies PSA psa_molecular_formula/weight/aliases
into PR Core _pr_* meta. Idempotent + re-runnable. PubChem REST fallback for 4
posts missing PSA data (MAX_RETRIES=3, exp backoff). All PSA values UNTRUSTED.
PR_CORE_TARGET_SCHEMA_VERSION bumped 3 -> 4.
Piece 2 — Drug node enrichment + stable @id = {permalink}#drug (ratified contract).
Reads _pr_* schema-input meta. molecularWeight in g/mol. Empty-prop guard throughout.
Piece 3 — Yoast-integrated emission via wpseo_schema_graph_pieces (priority 11),
wpseo_schema_webpage_type (MedicalWebPage retype), wpseo_schema_graph (enrichment).
Standalone @graph fallback retained. No duplicate WebPage/BreadcrumbList.
FAQPage emitted only when _pr_faq_items populated.
Supporting: PR_Core_Schema_Sanitizers, PR_Core_Pubchem_Client, CONTEXT.md,
ARCHITECTURE.md, CONVENTIONS.md, CHANGELOG.md, uninstall.php purge.
Tests: test-migration-0004.php (20 assertions), test-jsonld.php (29 assertions).
Agent-Session: peptide-schema-backfill v0.6.0
This commit is contained in:
@@ -76,6 +76,31 @@ $wpdb->query(
|
||||
"DELETE FROM {$wpdb->options} WHERE option_name LIKE 'pr\_core\_%'"
|
||||
);
|
||||
|
||||
/* ── 4b. Delete v0.6.0 schema-input meta keys from all peptide posts ──── */
|
||||
|
||||
/*
|
||||
* Migration 0004 writes _pr_molecular_formula, _pr_molecular_weight, _pr_aliases,
|
||||
* and _pr_faq_items to the shared peptide posts. These are PR Core-authored values
|
||||
* (derived from PubChem / PSA) and are safe to remove on uninstall.
|
||||
*
|
||||
* @see ARCHITECTURE.md — §2.9 Uninstall specification.
|
||||
*/
|
||||
$schema_meta_keys = [
|
||||
'_pr_molecular_formula',
|
||||
'_pr_molecular_weight',
|
||||
'_pr_aliases',
|
||||
'_pr_faq_items',
|
||||
];
|
||||
|
||||
foreach ( $schema_meta_keys as $meta_key ) {
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$wpdb->delete(
|
||||
$wpdb->postmeta,
|
||||
[ 'meta_key' => $meta_key ],
|
||||
[ '%s' ]
|
||||
);
|
||||
}
|
||||
|
||||
/* ── 5. Remove manage_peptide_content capability from all roles ───────── */
|
||||
|
||||
$editable_roles = wp_roles()->roles;
|
||||
|
||||
Reference in New Issue
Block a user