Skip to content

SLOP-381: port WatchedItem::fromUserTitle to WatchedItemStore; fix ->current property bug - #13

Open
tosfos wants to merge 1 commit into
masterfrom
SLOP-381-port-watcheditem
Open

SLOP-381: port WatchedItem::fromUserTitle to WatchedItemStore; fix ->current property bug#13
tosfos wants to merge 1 commit into
masterfrom
SLOP-381-port-watcheditem

Conversation

@tosfos

@tosfos tosfos commented Aug 23, 2026

Copy link
Copy Markdown

Summary

WatchedItem::fromUserTitle(), WatchedItem::isWatched() and WatchedItem::addWatch() were removed in MediaWiki 1.31 (deprecated 1.27). Two live call paths fatal on any modern MW:

  • includes/PendingReview.php::clearByUserAndTitle() — the clear-notification path of Special:PendingReviews fatals with Class 'WatchedItem' not found.
  • maintenance/addCategoryToWatchlist.php — the script cannot run at all.

Ports:

  • clearByUserAndTitle()MediaWikiServices::getInstance()->getWatchedItemStore()->resetNotificationTimestamp( $user, $title ) (same effect: nulls the notification timestamp).
  • Maintenance script → WatchedItemStore::isWatched( $user, $title ) / addWatch( $user, $title ).

Also fixes a second bug in the maintenance script: $titleArray->current is a property access on a TitleArray (an ArrayIterator subclass) — always null with a warning, producing empty page names and broken watch targets. Changed to the method call $titleArray->current().

Verification

  • php -l clean on php:7.4-cli and php:8.2-cli for both files.
  • Harness (8.2): property access confirmed NULL vs method returning the Title; stubbed store shows correct already-watching/add/reset flows for both ported paths.
  • Repo-wide grep: zero remaining fromUserTitle references; no remaining ->current property accesses without call parens in maintenance code.

Closes SLOP-381.

…current

WatchedItem::fromUserTitle()/isWatched()/addWatch() were removed in
MW 1.31. Port clearByUserAndTitle() to WatchedItemStore::
resetNotificationTimestamp() and addCategoryToWatchlist.php to
WatchedItemStore::isWatched()/addWatch().

Also fix $titleArray->current (undefined property, always null ->
empty page names and broken addWatch targets) to $titleArray->current().
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df2b6a1b-81e7-452d-9690-39fcd5989673


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.

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.

1 participant