Commit graph

19 commits

Author SHA1 Message Date
Ebrahim Byagowi
65dca958f1 Add namespace and deprecation alias to MachineReadableRCFeedFormatter
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to MachineReadableRCFeedFormatter and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I51110d3b05ae6d2927c49dea5c3fd05f418f595b
2024-05-19 17:00:02 +03:30
Ebrahim Byagowi
d8ea17470c Add namespace and deprecation alias to RCFeedFormatter
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to RCFeedFormatter and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ief351b40fb117e57a868ef7618df2109b550ff58
2024-05-16 23:11:17 +03:30
Timo Tijhof
34dc4e6d26 rcfeed: Add 'notify_url' and 'title_url' to MachineReadableRCFeedFormatter
* Move the current URL logic from IRCColourfulRCFeedFormatter
  to a new method RecentChange::getNotifyUrl (covered by tests now).

* Re-use this method in MachineReadableRCFeedFormatter so that
  the diff/patrol/rcid etc URL is also available in the modern
  JSON-based EventStreams service. And in particular to allow
  porting of the legacy irc.wikimedia.org backend to a much simpler
  one that is based on this.

* Also expose a title_url field which was previously missing,
  and made consumption of the data needlessly difficult.

Bug: T234234
Depends-On: Id740134ef30b2276688d7b7caedb6bb652158761
Change-Id: Ic3e0aebdb61b5c0e5fbed08656db4a1e90b67518
2023-05-19 15:48:40 +03:00
Amir Sarabadani
4bb2886562 Reorg: Migrate WikiMap to WikiMap/ out of includes
And WikiReference

Bug: T321882
Change-Id: I60cf4b9ef02b9d58118caa39172677ddfe03d787
2023-02-27 05:19:46 +01:00
Aryeh Gregor
7b791474a5 Use MainConfigNames instead of string literals, #4
Now largely automated:

VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
  tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
  $(grep -ERIl "'($VARS)'" includes/)

Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:

vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
  $(git diff --cached --name-only --diff-filter=M HEAD^))

I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.

Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
2022-04-26 19:03:37 +03:00
TChin
47adb6d65a Refactor global variables to use MediaWikiServices instead
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.

Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228

* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.

A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki

Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
2022-01-10 13:55:53 -05:00
Timo Tijhof
95ec909e52 WikiMap: Add WikiMap::getCurrentWikiId() to make common use case easier
Change-Id: Ie225ebfc37c824e3167742137bbbc9f64aca5f5e
2020-03-03 16:04:21 +00:00
Aaron Schulz
5196ac32c6 Rename WikiMap DB domain ID methods to reduce confusion with web domains
Those added in this same release do not need alias methods.

Change-Id: I05feeb9b0b13afe43aea1f95551965489cdbe094
2019-02-06 12:28:45 -08:00
Aaron Schulz
dbccb3a361 Use WikiMap methods for wiki ID logic in more places
Change-Id: I25b53576a8fecb7cfb0e4d684f064bebf6c968fc
2018-10-29 22:02:00 +00:00
Umherirrender
f739a8f368 Improve some parameter docs
Add missing @return and @param to function docs and fixed some @param

Change-Id: I810727961057cfdcc274428b239af5975c57468d
2017-09-10 20:32:31 +02:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Stephane Bisson
62961558a5 Encapsulate rc_params handling in RecentChange::parseParams
* Make MachineReadableRCFeedFormatter use it

* Some unit tests

* Also fixed some line-too-long warnings in RecentChange.php

Change-Id: I443d14f5d4cdac0945cb9c03608d55745bbb865b
2015-06-10 15:11:37 -04:00
Bryan Davis
78695ada64 Use safe attribute accessor for RecentChange
The RecentChange does not guarantee that all attributes are populated.
Handily it provides a safe getter function in
RecentChange::getAttribute() that will return null with out triggering
an undefined index warning for missing attributes. Protects against log
spam like "Notice: Undefined index: rc_id".

Change-Id: Idee844f0d40a2a084e17f201b5e1501d59a0464d
2014-09-13 05:02:33 +00:00
Kunal Mehta
e8ab2deb0f RCFeed: Add log_id property (exposes rc_logid attribute)
Bug: 20394
Change-Id: I005be8e41a5cbea934d4dac27184f03e9af7c648
2014-06-11 22:27:13 +00:00
Timo Tijhof
c0b0a12eab RCFeed: Use named types instead of exposing internal MW constant
Like we do in ApiQueryRecentChanges as well, expose the named
rc.type property, not the internal integer constants.

Change-Id: I89a948eee999032bb2e42cc23345affa879afb42
2014-06-04 04:55:02 +00:00
Ori Livneh
5c74ac9feb Expose server name in rc feed
Reviewers of Id819246a9 (Tim, Timo, Chad) have commented that it
would be preferable to identify wikis by their canonical hostname
rather than the value of $wgDBname. Exposing it here so that
the rcstream server can filter subscriptions by it.

Change-Id: I503a0134a8613daddaae9d8df29a1e27fbfd93bc
2014-05-09 09:55:00 +00:00
Ori Livneh
1f3f032f2a JSON RC format: cast 'patrolled' and 'minor' to boolean
This makes them consistent with 'bot'.

Change-Id: Id4342eedee8176b0b76458bdaf8ca69c89857d47
2014-05-03 11:30:05 -07:00
Kunal Mehta
f1d28a569d rcfeed: Use wfWikiID() instead of $wgDBname
Change-Id: Id1f408a4c498f23f656298e3453d2a9264e3ac7c
2014-01-10 17:52:25 -08:00
Kunal Mehta
c1bc3607f8 Add XMLRCFeedFormatter
Endpoints like XMPP natively support sending XML,
which can be advantageous in some cases.

Since most of the logic is the same as the existing
JSONRCFeedFormatter, it was moved into an abstract
MachineReadableRCFeedFormatter class, which simply
creates the array and lets the implementations format
it.

Change-Id: I44f22777cb55fc1ca6527b79ef40b340e2afbd58
2014-01-10 17:50:41 -08:00