5use Psr\Log\LoggerInterface;
38 $this->logger = $logger;
43 MediaWikiServices::getInstance()->getMainWANObjectCache(),
44 ObjectCache::getLocalClusterInstance(),
45 [ $this,
'getTitleChangeEvents' ],
46 [ $this,
'getEventAffectedKeys' ],
48 'channel' =>
'table:recentchanges:' . $this->db->getDomainID(),
49 'logger' => $this->logger
53 $reaper->invoke( 100 );
73 [
'rc_namespace',
'rc_title',
'rc_timestamp',
'rc_id' ],
76 "rc_timestamp > $encStart",
77 "rc_timestamp = $encStart AND rc_id > " . $db->
addQuotes( $id )
79 "rc_timestamp < $encEnd"
82 [
'ORDER BY' => [
'rc_timestamp ASC',
'rc_id ASC' ],
'LIMIT' => $limit ]
86 foreach (
$res as $row ) {
88 'id' => (int)$row->rc_id,
89 'pos' => (
int)
wfTimestamp( TS_UNIX, $row->rc_timestamp ),
90 'item' =>
new TitleValue( (
int)$row->rc_namespace, $row->rc_title )
112 if (
$t->getNamespace() >= 0 ) {
113 $entities[] = MediaWikiServices::getInstance()->getWikiPageFactory()
114 ->newFromLinkTarget(
$t );
118 $entities[] = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
119 ->newFile(
$t->getText() );
126 foreach ( $entities as $entity ) {
132 $this->logger->debug( __CLASS__ .
': got key(s) ' . implode(
', ',
$keys ) );
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Represents a page (or page fragment) title within MediaWiki.
static newFromName( $name, $validate='valid')
Class for fixing stale WANObjectCache keys using a purge event source.
getEventAffectedKeys(WANObjectCache $cache, LinkTarget $t)
Gets a list of important cache keys associated with a title.
doUpdate()
Perform the actual work.
getTitleChangeEvents( $start, $id, $end, $limit)
__construct(IDatabase $db, LoggerInterface $logger)
Class for scanning through chronological, log-structured data or change logs and locally purging cach...
Multi-datacenter aware caching interface.
Interface that deferrable updates should implement.