[MediaWiki-commits] [Gerrit] Allow PENDINGCHANGELEVEL to work on other pages - change (mediawiki...FlaggedRevs)
Aaron Schulz has submitted this change and it was merged. Change subject: Allow PENDINGCHANGELEVEL to work on other pages .. Allow PENDINGCHANGELEVEL to work on other pages Add an optional parameter to {{PENDINGCHANGELEVEL}} to allow it to work on pages other than the current one. Bug: 56863 Change-Id: Ib461e0a1aa4d26163b3a8e5feb29b7e088382a26 --- M backend/FlaggedRevs.hooks.php 1 file changed, 16 insertions(+), 7 deletions(-) Approvals: Aaron Schulz: Verified; Looks good to me, approved diff --git a/backend/FlaggedRevs.hooks.php b/backend/FlaggedRevs.hooks.php index cb07a64..07aa1e8 100644 --- a/backend/FlaggedRevs.hooks.php +++ b/backend/FlaggedRevs.hooks.php @@ -233,18 +233,14 @@ public static function onParserFirstCallInit( $parser ) { $parser-setFunctionHook( 'pagesusingpendingchanges', 'FlaggedRevsHooks::parserPagesUsingPendingChanges' ); + $parser-setFunctionHook( 'pendingchangelevel', + 'FlaggedRevsHooks::parserPendingChangeLevel', SFH_NO_HASH ); return true; } public static function onParserGetVariableValueSwitch( $parser, $cache, $word, $ret ) { if ( $word == 'pendingchangelevel' ) { - $title = $parser-getTitle(); - if ( !FlaggedRevs::inReviewNamespace( $title ) ) { - $ret = ''; - } else { - $config = FRPageConfig::getStabilitySettings( $title ); - $ret = $config['autoreview']; - } + $ret = FlaggedRevsHooks::parserPendingChangeLevel( $parser ); } return true; } @@ -286,6 +282,19 @@ } } + public static function parserPendingChangeLevel( $parser, $page = '' ) { + $title = Title::newFromText( $page ); + if ( !( $title instanceof Title ) ) { + $title = $parser-getTitle(); + } + if ( !FlaggedRevs::inReviewNamespace( $title ) || !$parser-incrementExpensiveFunctionCount() ) { + return ''; + } else { + $config = FRPageConfig::getStabilitySettings( $title ); + return $config['autoreview']; + } + } + /** * Detect if a ParserOutput object was added without mImageTimeKeys set. * This is needed for older, cached, ParserOutput objects. -- To view, visit https://gerrit.wikimedia.org/r/106898 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib461e0a1aa4d26163b3a8e5feb29b7e088382a26 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/FlaggedRevs Gerrit-Branch: master Gerrit-Owner: Jackmcbarn jackmcb...@gmail.com Gerrit-Reviewer: Aaron Schulz asch...@wikimedia.org Gerrit-Reviewer: Anomie bjor...@wikimedia.org Gerrit-Reviewer: Jackmcbarn jackmcb...@gmail.com Gerrit-Reviewer: Siebrand siebr...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Allow PENDINGCHANGELEVEL to work on other pages - change (mediawiki...FlaggedRevs)
Jackmcbarn has uploaded a new change for review. https://gerrit.wikimedia.org/r/106898 Change subject: Allow PENDINGCHANGELEVEL to work on other pages .. Allow PENDINGCHANGELEVEL to work on other pages Add an optional parameter to {{PENDINGCHANGELEVEL}} to allow it to work on pages other than the current one. Bug: 56863 Change-Id: Ib461e0a1aa4d26163b3a8e5feb29b7e088382a26 --- M backend/FlaggedRevs.hooks.php 1 file changed, 16 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FlaggedRevs refs/changes/98/106898/1 diff --git a/backend/FlaggedRevs.hooks.php b/backend/FlaggedRevs.hooks.php index cb07a64..01ac177 100644 --- a/backend/FlaggedRevs.hooks.php +++ b/backend/FlaggedRevs.hooks.php @@ -233,18 +233,14 @@ public static function onParserFirstCallInit( $parser ) { $parser-setFunctionHook( 'pagesusingpendingchanges', 'FlaggedRevsHooks::parserPagesUsingPendingChanges' ); + $parser-setFunctionHook( 'pendingchangelevel', + 'FlaggedRevsHooks::parserPendingChangeLevel', SFH_NO_HASH ); return true; } public static function onParserGetVariableValueSwitch( $parser, $cache, $word, $ret ) { if ( $word == 'pendingchangelevel' ) { - $title = $parser-getTitle(); - if ( !FlaggedRevs::inReviewNamespace( $title ) ) { - $ret = ''; - } else { - $config = FRPageConfig::getStabilitySettings( $title ); - $ret = $config['autoreview']; - } + $ret = FlaggedRevsHooks::parserPendingChangeLevel( $parser ); } return true; } @@ -286,6 +282,19 @@ } } + public static function parserPendingChangeLevel( $parser, $page = '' ) { + $title = Title::newFromText( $page ); + if( !( $title instanceof Title ) ) { + $title = $parser-mTitle; + } + if ( !FlaggedRevs::inReviewNamespace( $title ) ) { + return ''; + } else { + $config = FRPageConfig::getStabilitySettings( $title ); + return $config['autoreview']; + } + } + /** * Detect if a ParserOutput object was added without mImageTimeKeys set. * This is needed for older, cached, ParserOutput objects. -- To view, visit https://gerrit.wikimedia.org/r/106898 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib461e0a1aa4d26163b3a8e5feb29b7e088382a26 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/FlaggedRevs Gerrit-Branch: master Gerrit-Owner: Jackmcbarn jackmcb...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits