Detect IndieAuth via the INDIEAUTH_PLUGIN_VERSION constant - #327
Merged
Conversation
A constant check does not depend on IndieAuth's internal class names, which broke once before when IndieAuth 4.7.0 namespaced its classes (indieweb/wordpress-indieauth#319), and avoids triggering an autoload. The constant exists since IndieAuth 4.7.0, matching the namespaced class check on trunk that already required 4.7.0. The test bootstrap now defines the constant instead of mocking an IndieAuth class. Claude-Session: https://claude.ai/code/session_0126gxnmr2SMc4X4J1Y6yf71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Micropub gates its whole initialization on an IndieAuth class check. That coupling to IndieAuth's internal class names broke once already, when IndieAuth 4.7.0 namespaced its classes and the
class_exists( 'IndieAuth_Plugin' )check silently disabled Micropub (indieweb/wordpress-indieauth#319). Trunk currently checks\IndieAuth\IndieAuth::class, which would break again on any future rename and triggers an autoload just for feature detection.Solution
Check
\defined( 'INDIEAUTH_PLUGIN_VERSION' )instead. The constant exists since IndieAuth 4.7.0 — the same effective requirement as trunk's namespaced class check — is part of IndieAuth's stable public surface, and is cheaper than a class check (no autoloader involvement). It also enables version comparisons later if ever needed.The test bootstrap now defines the constant instead of shipping a mock IndieAuth class.
Verification
404 vs 403symptom from Errors return HTTP 201 status #319), then the gate change brought the suite back to baseline.https://claude.ai/code/session_0126gxnmr2SMc4X4J1Y6yf71