r92614 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92613‎ | r92614 | r92615 >
Date:09:41, 20 July 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* Use SkinTemplateNavigation::Universal hook instead of SkinTemplateContentActions
* Use Skin's Title object instead of $wgTitle
Modified paths:
  • /trunk/extensions/Purge/Purge.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Purge/Purge.php
@@ -16,20 +16,21 @@
1717 );
1818
1919 $dir = dirname( __FILE__ ) . '/';
20 -$wgHooks['SkinTemplateContentActions'][] = 'PurgeActionExtension::contentHook';
 20+$wgHooks['SkinTemplateNavigation::Universal'][] = 'PurgeActionExtension::contentHook';
2121 $wgExtensionMessagesFiles['Purge'] = $dir . 'Purge.i18n.php';
2222
2323 class PurgeActionExtension{
24 - public static function contentHook( array &$content_actions ) {
25 - global $wgRequest, $wgTitle, $wgUser;
 24+ public static function contentHook( $skin, array &$content_actions ) {
 25+ global $wgRequest, $wgUser;
2626
27 - if ( $wgTitle->getNamespace() !== NS_SPECIAL && $wgUser->isAllowed( 'purge' ) ) {
 27+ $title = $skin->getTitle();
 28+ if ( $title->getNamespace() !== NS_SPECIAL && $wgUser->isAllowed( 'purge' ) ) {
2829 $action = $wgRequest->getText( 'action' );
2930
30 - $content_actions['purge'] = array(
 31+ $content_actions['actions']['purge'] = array(
3132 'class' => $action === 'purge' ? 'selected' : false,
3233 'text' => wfMsg( 'purge' ),
33 - 'href' => $wgTitle->getLocalUrl( 'action=purge' )
 34+ 'href' => $title->getLocalUrl( 'action=purge' )
3435 );
3536 }
3637

Sign-offs

UserFlagDate
Nikerabbitinspected10:00, 20 July 2011

Comments

#Comment by Nikerabbit (talk | contribs)   09:59, 20 July 2011

One killed, two left :)

Would this hook also fix the reason why I need to use two different hooks to add tabs to monobook/vector?

Status & tagging log