if ( $link ) {
return "[$link $id]";
} else {
- return $id;
+ return (string)$id;
}
}
Hooks::run( 'DifferenceEngineShowDiffPage', [ $out ] );
if ( !$this->loadRevisionData() ) {
- $this->showMissingRevision();
-
+ if ( Hooks::run( 'DifferenceEngineShowDiffPageMaybeShowMissingRevision', [ $this ] ) ) {
+ $this->showMissingRevision();
+ }
return;
}
*
* @return string HTML or empty string
*/
- protected function markPatrolledLink() {
+ public function markPatrolledLink() {
if ( $this->mMarkPatrolledLink === null ) {
$linkInfo = $this->getMarkPatrolledLinkInfo();
// If false, there is no patrol link needed/allowed
$difftext = $this->generateContentDiffBody( $this->mOldContent, $this->mNewContent );
+ // Avoid PHP 7.1 warning from passing $this by reference
+ $diffEngine = $this;
+
// Save to cache for 7 days
- if ( !Hooks::run( 'AbortDiffCache', [ &$this ] ) ) {
+ if ( !Hooks::run( 'AbortDiffCache', [ &$diffEngine ] ) ) {
wfIncrStats( 'diff_cache.uncacheable' );
} elseif ( $key !== false && $difftext !== false ) {
wfIncrStats( 'diff_cache.miss' );
public function localiseLineNumbers( $text ) {
return preg_replace_callback(
'/<!--LINE (\d+)-->/',
- [ &$this, 'localiseLineNumbersCb' ],
+ [ $this, 'localiseLineNumbersCb' ],
$text
);
}
*
* @return string HTML fragment
*/
- protected function getRevisionHeader( Revision $rev, $complete = '' ) {
+ public function getRevisionHeader( Revision $rev, $complete = '' ) {
$lang = $this->getLanguage();
$user = $this->getUser();
$revtimestamp = $rev->getTimestamp();
if ( $this->mNewRev ) {
$this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
+ Hooks::run( 'DifferenceEngineLoadTextAfterNewContentIsLoaded', [ $this ] );
if ( $this->mNewContent === null ) {
return false;
}
$this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
+ Hooks::run( 'DifferenceEngineAfterLoadNewText', [ $this ] );
+
return true;
}