14use Wikimedia\Timestamp\TimestampFormat as TS;
46 $recentChangeRCFeedNotifier = $services->getRecentChangeRCFeedNotifier();
47 $recentChangeLookup = $services->getRecentChangeLookup();
48 $mainConfig = $services->getMainConfig();
57 'type' => $recentChangeLookup->convertSourceToType( $rc->
getAttribute(
'rc_source' ) ),
58 'namespace' => $rc->
getTitle()->getNamespace(),
59 'title' => $rc->
getTitle()->getPrefixedText(),
60 'title_url' => $rc->
getTitle()->getCanonicalURL(),
65 'notify_url' => $recentChangeRCFeedNotifier->getNotifyUrl( $rc ),
68 if ( isset( $feed[
'channel'] ) ) {
69 $packet[
'channel'] = $feed[
'channel'];
73 if (
$source == RecentChange::SRC_EDIT ||
$source == RecentChange::SRC_NEW ) {
76 $packet[
'minor'] = (bool)$rc->
getAttribute(
'rc_minor' );
77 if ( $useRCPatrol || (
$source == RecentChange::SRC_NEW && $useNPPatrol ) ) {
78 $packet[
'patrolled'] = (bool)$rc->
getAttribute(
'rc_patrolled' );
83 case RecentChange::SRC_EDIT:
88 $packet[
'revision'] = [
94 case RecentChange::SRC_NEW:
95 $packet[
'length'] = [
'old' =>
null,
'new' => $rc->
getAttribute(
'rc_new_len' ) ];
96 $packet[
'revision'] = [
'old' =>
null,
'new' => $rc->
getAttribute(
'rc_this_oldid' ) ];
99 case RecentChange::SRC_LOG:
101 $packet[
'log_type'] = $rc->
getAttribute(
'rc_log_type' );
102 $packet[
'log_action'] = $rc->
getAttribute(
'rc_log_action' );
107 $rc->
getAttribute(
'rc_params' ) == serialize(
false ) ||
114 foreach ( $params as $key => $value ) {
115 if ( !str_contains( $key,
':' ) ) {
116 $logParams[$key] = $value;
119 $logParam = explode(
':', $key, 3 );
120 $logParams[$logParam[2]] = $value;
122 $packet[
'log_params'] = $logParams;
124 $packet[
'log_params'] = explode(
"\n", $rc->
getAttribute(
'rc_params' ) );
127 $packet[
'log_action_comment'] = $actionComment;
131 $packet[
'server_url'] = $canonicalServer;
132 $packet[
'server_name'] = $serverName;
134 $packet[
'server_script_path'] = $scriptPath ?:
'/';
135 $packet[
'wiki'] = WikiMap::getCurrentWikiId();
141class_alias( MachineReadableRCFeedFormatter::class,
'MachineReadableRCFeedFormatter' );
wfTimestamp( $outputtype=TS::UNIX, $ts=0)
Get a timestamp string in one of various formats.
A class containing constants representing the names of configuration variables.
const ServerName
Name constant for the ServerName setting, for use with Config::get()
const UseRCPatrol
Name constant for the UseRCPatrol setting, for use with Config::get()
const CanonicalServer
Name constant for the CanonicalServer setting, for use with Config::get()
const ScriptPath
Name constant for the ScriptPath setting, for use with Config::get()
const UseNPPatrol
Name constant for the UseNPPatrol setting, for use with Config::get()