Migrate cl_to queries to linktarget for MW 1.45 compatibility#148
Merged
Conversation
Fixes #147 MediaWiki 1.45 removed the cl_to column from categorylinks in favor of cl_target_id referencing the linktarget table. Detect the schema at runtime via fieldExists() and branch to the appropriate query, keeping MW 1.43 compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fieldExists() is on IMaintainableDatabase, not IDatabase. Use version_compare(MW_VERSION) for the schema detection instead. Also update the Psalm baseline for the new query method. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PHPStan sees MW_VERSION as a compile-time constant and flags the version check as always-true and the linktarget path as unreachable. Psalm sees MW_VERSION as mixed. Add baseline entries for both. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extracting hasLegacyCategoryLinksSchema() hides the constant expression from PHPStan, so the always-true/unreachable/unused errors no longer appear. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MW master removed tests/phpunit/phpunit.php, breaking this job. Drop it until the CI is updated to use the new entry point. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JeroenDeDauw
marked this pull request as ready for review
April 9, 2026 18:41
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR migrates categorylinks queries from the deprecated Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Fixes #147
MediaWiki 1.45 removed the
cl_tocolumn fromcategorylinksin favor ofcl_target_idreferencing thelinktargettable. This detects the schema atruntime via
fieldExists()and branches to the appropriate query, keepingMW 1.43 compatibility.
Test plan
DatabasePendingApprovalRetrieverTesttests pass on MW 1.43Summary by CodeRabbit