From: addshore Date: Tue, 13 Oct 2015 09:56:04 +0000 (+0100) Subject: Add recentChangesLine to ChangesList X-Git-Tag: 1.31.0-rc.0~9399^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=304a56f7d81a114677f78463ffc32e5c3662e4b8;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index fdc9944fdc..01f10d8110 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -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 "
  • " tag * @param bool $value diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 1dcb7aef48..f10307db79 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -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;