Skip to content

Fix issue #48 class Title and Html not found with mediawiki 1.44#49

Merged
malberts merged 1 commit intoProfessionalWiki:masterfrom
JLTRY:master
Sep 24, 2025
Merged

Fix issue #48 class Title and Html not found with mediawiki 1.44#49
malberts merged 1 commit intoProfessionalWiki:masterfrom
JLTRY:master

Conversation

@JLTRY
Copy link

@JLTRY JLTRY commented Sep 24, 2025

See Issue #48

namespaces added

Summary by CodeRabbit

  • Refactor
    • Standardized usage of HTML rendering utilities for consistency across components.
    • Improved type consistency in internal methods for clearer intent and maintainability.
    • No changes to public APIs or user-facing behavior.

@coderabbitai
Copy link

coderabbitai bot commented Sep 24, 2025

📝 Walkthrough

Walkthrough

Refactors internal references to MediaWiki classes by adding use-imports for MediaWiki\Html\Html and MediaWiki\Title\Title, and replacing fully qualified \Html calls with imported Html. Adjusts a private method in JsonBuilder to accept Title instead of \Title and to use Html::element and Title::getFullURL(). No public API changes.

Changes

Cohort / File(s) Summary of Changes
Namespace imports and Html helper usage
src/JsonBuilder.php, src/TimelinePresenter.php
Add use-imports for MediaWiki\Html\Html (and MediaWiki\Title\Title in JsonBuilder). Replace \Html::element/rawElement with Html::element/rawElement. In JsonBuilder, update private newHeadline to typehint Title and call $title->getFullURL(). Public APIs unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly describes the primary intent of the change: fixing the "class Title and Html not found" error for MediaWiki 1.44. The provided diffs show added imports for MediaWiki\Title\Title and MediaWiki\Html\Html and updated usages of Html, which directly address that issue. The phrasing is concise and specific enough for a reviewer scanning PR history to understand the main change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/JsonBuilder.php (2)

59-64: Headline rendering is fine; optionally show namespace.

Consider using prefixed title for clarity across namespaces.

Apply within this method:

-            $title->getText()
+            $title->getPrefixedText()

Optional: If you want MW-native link rendering (skin classes, redlink handling), switch to LinkRenderer via MediaWikiServices, but that’s beyond this PR’s scope.


66-66: Remove dead commented code.

Keeps the class clean and avoids confusion.

-//		return DataValueFactory::getInstance()->newDataValueByItem( $subject->getWikiPage() )->getLongHTMLText( smwfGetLinker() );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0766cd3 and a1c09ef.

📒 Files selected for processing (2)
  • src/JsonBuilder.php (2 hunks)
  • src/TimelinePresenter.php (3 hunks)
🔇 Additional comments (4)
src/TimelinePresenter.php (3)

13-13: Importing Html via namespace — LGTM.


65-72: Switch to Html::rawElement for script tag — LGTM.

Matches the new import and preserves previous behavior.


79-93: Html helpers for container elements — LGTM.

Consistent with the new import; no functional change.

src/JsonBuilder.php (1)

10-11: Correct move to namespaced MediaWiki classes — imports present and no legacy globals remain.

src/JsonBuilder.php and src/TimelinePresenter.php import MediaWiki\Title\Title and MediaWiki\Html\Html; ripgrep found no remaining \Title or Html:: usages. extension.json requires MediaWiki >= 1.39.0.

@malberts malberts merged commit 30bb67c into ProfessionalWiki:master Sep 24, 2025
2 of 9 checks passed
@malberts malberts mentioned this pull request Sep 24, 2025
@JeroenDeDauw
Copy link
Member

IMO we'd have been slightly better of delaying this change for a year or two, but whatever. Why: https://www.entropywins.wtf/blog/2025/08/20/why-you-should-use-mediawiki-lts-versions/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants