(bug 14645) Show expensive special pages differently in miser mode on Special:SpecialPages. Patch by Jarry1250 with a few tweaks by me. Tested, saw no errors or warnings.
This commit is contained in:
parent
8c69bdb0a6
commit
7b9aaf7832
6 changed files with 41 additions and 9 deletions
1
CREDITS
1
CREDITS
|
|
@ -139,6 +139,7 @@ following names for their contribution to the product.
|
|||
* Umherirrender
|
||||
* Ville Stadista
|
||||
* Zachary Hauri
|
||||
* Jarry1250
|
||||
|
||||
== Translators ==
|
||||
* Anders Wegge Jakobsen
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ PHP if you have not done so prior to upgrading MediaWiki.
|
|||
* CSS stylesheet MediaWiki:Noscript.css is now loaded for users with JavaScript
|
||||
disabled (enclosed in the head in a <noscript> tag)
|
||||
* Added UserGetLanguageObject hook to change the language used in $wgLang
|
||||
* (bug 14645) When $wgMiserMode is on, expensive special pages are styled
|
||||
differently (italicized by default) on Special:SpecialPages
|
||||
|
||||
=== Bug fixes in 1.18 ===
|
||||
* (bug 23119) WikiError class and subclasses are now marked as deprecated
|
||||
|
|
|
|||
|
|
@ -819,6 +819,18 @@ class SpecialPage {
|
|||
return $this->mLocalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this page expensive (for some definition of expensive)?
|
||||
* Expensive pages are disabled or cached in miser mode. Originally used
|
||||
* (and still overridden) by QueryPage and subclasses, moved here so that
|
||||
* Special:SpecialPages can safely call it for all special pages.
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public function isExpensive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be overridden by subclasses with more complicated permissions
|
||||
* schemes.
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
|
|||
if( !isset( $groups[$group] ) ) {
|
||||
$groups[$group] = array();
|
||||
}
|
||||
$groups[$group][$page->getDescription()] = array( $page->getTitle(), $page->isRestricted() );
|
||||
$groups[$group][$page->getDescription()] = array( $page->getTitle(), $page->isRestricted(), $page->isExpensive() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,10 +87,11 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
|
|||
}
|
||||
|
||||
private function outputPageList( $groups ) {
|
||||
global $wgUser, $wgOut;
|
||||
global $wgUser, $wgOut, $wgMiserMode;
|
||||
|
||||
$sk = $wgUser->getSkin();
|
||||
$includesRestrictedPages = false;
|
||||
$includesCachedPages = false;
|
||||
|
||||
foreach ( $groups as $group => $sortedPages ) {
|
||||
$middle = ceil( count( $sortedPages )/2 );
|
||||
|
|
@ -105,14 +106,20 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
|
|||
Html::openElement( 'ul' ) . "\n"
|
||||
);
|
||||
foreach( $sortedPages as $desc => $specialpage ) {
|
||||
list( $title, $restricted ) = $specialpage;
|
||||
$link = $sk->linkKnown( $title , htmlspecialchars( $desc ) );
|
||||
list( $title, $restricted, $expensive) = $specialpage;
|
||||
|
||||
$pageClasses = array();
|
||||
if ( $expensive && $wgMiserMode ){
|
||||
$includesCachedPages = true;
|
||||
$pageClasses[] = 'mw-specialpagecached';
|
||||
}
|
||||
if( $restricted ) {
|
||||
$includesRestrictedPages = true;
|
||||
$wgOut->addHTML( Html::rawElement( 'li', array( 'class' => 'mw-specialpages-page mw-specialpagerestricted' ), Html::rawElement( 'strong', array(), $link ) ) . "\n" );
|
||||
} else {
|
||||
$wgOut->addHTML( Html::rawElement( 'li', array(), $link ) . "\n" );
|
||||
$pageClasses[] = 'mw-specialpagerestricted';
|
||||
}
|
||||
|
||||
$link = $sk->linkKnown( $title , htmlspecialchars( $desc ) );
|
||||
$wgOut->addHTML( Html::rawElement( 'li', array( 'class' => implode( ' ', $pageClasses ) ), $link ) . "\n" );
|
||||
|
||||
# Split up the larger groups
|
||||
$count++;
|
||||
|
|
@ -131,7 +138,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
|
|||
);
|
||||
}
|
||||
|
||||
if ( $includesRestrictedPages ) {
|
||||
if ( $includesRestrictedPages || $includesCachedPages ) {
|
||||
$wgOut->wrapWikiMsg( "<div class=\"mw-specialpages-notes\">\n$1\n</div>", 'specialpages-note' );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4366,7 +4366,8 @@ Enter the file name without the "{{ns:file}}:" prefix.',
|
|||
'specialpages-summary' => '', # do not translate or duplicate this message to other languages
|
||||
'specialpages-note' => '----
|
||||
* Normal special pages.
|
||||
* <strong class="mw-specialpagerestricted">Restricted special pages.</strong>',
|
||||
* <span class="mw-specialpagerestricted">Restricted special pages.</span>
|
||||
* <span class="mw-specialpagecached">Cached-only special pages.</span>',
|
||||
'specialpages-group-maintenance' => 'Maintenance reports',
|
||||
'specialpages-group-other' => 'Other special pages',
|
||||
'specialpages-group-login' => 'Login / sign up',
|
||||
|
|
|
|||
|
|
@ -493,6 +493,15 @@ td#mw-prefixindex-nav-form {
|
|||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Special:Specialpages style */
|
||||
.mw-specialpagecached{
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
.mw-specialpagerestricted{
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/*
|
||||
* Recreating deleted page warning
|
||||
* Reupload file warning
|
||||
|
|
|
|||
Loading…
Reference in a new issue