X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fdiff%2FDifferenceEngine.php;h=5367199f2f33495c015e48ab9afd533122517cc9;hb=8bb5a6c461c31ee5ce6874548246fc2c520686f6;hp=bd65fb42dc818071429c63208e68b2ac5f85ad23;hpb=4003c43a944ab3c1a7216968ab23ebe6f7d6d01d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index bd65fb42dc..5367199f2f 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -210,7 +210,7 @@ class DifferenceEngine extends ContextSource { if ( $link ) { return "[$link $id]"; } else { - return $id; + return (string)$id; } } @@ -247,8 +247,9 @@ class DifferenceEngine extends ContextSource { Hooks::run( 'DifferenceEngineShowDiffPage', [ $out ] ); if ( !$this->loadRevisionData() ) { - $this->showMissingRevision(); - + if ( Hooks::run( 'DifferenceEngineShowDiffPageMaybeShowMissingRevision', [ $this ] ) ) { + $this->showMissingRevision(); + } return; } @@ -481,7 +482,7 @@ class DifferenceEngine extends ContextSource { * * @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 @@ -761,8 +762,11 @@ class DifferenceEngine extends ContextSource { $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' ); @@ -981,7 +985,7 @@ class DifferenceEngine extends ContextSource { public function localiseLineNumbers( $text ) { return preg_replace_callback( '//', - [ &$this, 'localiseLineNumbersCb' ], + [ $this, 'localiseLineNumbersCb' ], $text ); } @@ -1064,7 +1068,7 @@ class DifferenceEngine extends ContextSource { * * @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(); @@ -1369,6 +1373,7 @@ class DifferenceEngine extends ContextSource { if ( $this->mNewRev ) { $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); + Hooks::run( 'DifferenceEngineLoadTextAfterNewContentIsLoaded', [ $this ] ); if ( $this->mNewContent === null ) { return false; } @@ -1395,6 +1400,8 @@ class DifferenceEngine extends ContextSource { $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); + Hooks::run( 'DifferenceEngineAfterLoadNewText', [ $this ] ); + return true; }