Add recentChangesLine to ChangesList

This method is implemented in all sub classes.

Not having this method here looks odd as
ChangesList::newFromContext returns a ChangesList
and parts of the code base then call recentChangesLine
on that object which may not exist..

In the future we might even have some interface here?

Change-Id: Iad00a956862c078a2bcaf3ef0602abcf3fedb7d2
This commit is contained in:
addshore 2015-10-13 10:56:04 +01:00
parent f82b0c0fe7
commit 304a56f7d8
2 changed files with 20 additions and 4 deletions

View file

@ -76,6 +76,21 @@ class ChangesList extends ContextSource {
}
}
/**
* Format a line
*
* @since 1.27
*
* @param RecentChange $rc Passed by reference
* @param bool $watched (default false)
* @param int $linenumber (default null)
*
* @return string|bool
*/
public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
throw new RuntimeException( 'recentChangesLine should be implemented' );
}
/**
* Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag
* @param bool $value

View file

@ -83,15 +83,16 @@ class EnhancedChangesList extends ChangesList {
/**
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*
* @param RecentChange $baseRC
* @param RecentChange $rc
* @param bool $watched
* @param int $linenumber (default null)
*
* @return string
*/
public function recentChangesLine( &$baseRC, $watched = false ) {
public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
$date = $this->getLanguage()->userDate(
$baseRC->mAttribs['rc_timestamp'],
$rc->mAttribs['rc_timestamp'],
$this->getUser()
);
@ -106,7 +107,7 @@ class EnhancedChangesList extends ChangesList {
$this->lastdate = $date;
}
$cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $baseRC, $watched );
$cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $rc, $watched );
$this->addCacheEntry( $cacheEntry );
return $ret;