Publisher.php
Source file: wordpress/hslg-docs-publisher/src/Publisher.php
Module: wordpress-hslg-docs-publisher
Size: 180 lines
SHA-256: 4298dbec6afd34378b4bd6b548cbd408dd411b04ad22195504c76cb3889c7b3c
Responsibility
Imports versioned documentation automatically when activated or upgraded; keeps stable WordPress page IDs, ownership metadata, unlimited post revisions and collision protection.
Declared entry points
HSLG_Docs_Publisher— source line 8.OWNER— source line 9.META_KEY— source line 10.META_OWNER— source line 11.META_BODY— source line 12.META_RELEASE— source line 13.load_bundle— source line 16.owned— source line 56.find_page— source line 62.plan— source line 86.publish— source line 137.publish_automated— source line 145.
Imports and dependencies
No direct import declarations detected in this file.
Behaviour and audit locations
- Line 139:
return new WP_Error('not_authorised', 'WordPress administrator permission required');
Ownership, revisions and collision checks
The publisher verifies document keys, parent paths, bodies and SHA-256 hashes before writing. It locates owned pages by stable metadata and refuses to take over unowned pages at a matching slug. New documents use wp_insert_post(); changed documents call wp_update_post() on the existing ID. It requires unlimited WordPress revisions and avoids edits where an existing page diverged from the last published body. A missing document in a newer source bundle is not permission to delete a WordPress page.
Relationship to the system
This page is the file-level source reference, not the architecture rationale. Read the module explanation, the corresponding architecture decision and user guide before changing behaviour. Names and line locations above are extracted from this exact source version; they are reference points, not proof that an external service or a phone feature works.
Change verification
Review the entry points and errors in this file, then run the module’s associated tests, source dependency gate, history gate and documentation coverage check. If the file changes an API response, user interaction, data model, deployment or third-party dependency, revise those human explanations and disaster recovery/licensing when relevant. Do not infer actual native or external API operation from source presence.