Page MenuHomePhabricator

MediaWiki_-_SpecialSpecialpage_Sections.patch

Authored By
bzimport
Nov 21 2014, 9:50 PM
Size
16 KB
Referenced Files
None
Subscribers
None

MediaWiki_-_SpecialSpecialpage_Sections.patch

Index: includes/SpecialPage.php
===================================================================
--- includes/SpecialPage.php (revision 32403)
+++ includes/SpecialPage.php (working copy)
@@ -72,85 +72,89 @@
* Query parameters that can be passed through redirects
*/
var $mAllowedRedirectParams = array();
+ /**
+ * Section under which the page is listed on Special:SpecialPages
+ */
+ var $mSection;
static public $mList = array(
- 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects' ),
- 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects' ),
- 'Disambiguations' => array( 'SpecialPage', 'Disambiguations' ),
+ 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects', 'section' => 'cleanup' ),
+ 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects', 'section' => 'cleanup' ),
+ 'Disambiguations' => array( 'SpecialPage', 'Disambiguations', 'section' => 'cleanup' ),
- 'Userlogin' => array( 'SpecialPage', 'Userlogin' ),
+ 'Userlogin' => array( 'SpecialPage', 'Userlogin', 'section' => 'personal' ),
'Userlogout' => array( 'UnlistedSpecialPage', 'Userlogout' ),
'CreateAccount' => array( 'SpecialRedirectToSpecial', 'CreateAccount', 'Userlogin', 'signup', array( 'uselang' ) ),
- 'Preferences' => array( 'SpecialPage', 'Preferences' ),
- 'Watchlist' => array( 'SpecialPage', 'Watchlist' ),
+ 'Preferences' => array( 'SpecialPage', 'Preferences', 'section' => 'personal' ),
+ 'Watchlist' => array( 'SpecialPage', 'Watchlist', 'section' => 'personal' ),
- 'Recentchanges' => array( 'IncludableSpecialPage', 'Recentchanges' ),
- 'Upload' => array( 'SpecialPage', 'Upload' ),
- 'Imagelist' => array( 'SpecialPage', 'Imagelist' ),
- 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ),
- 'Listusers' => array( 'SpecialPage', 'Listusers' ),
- 'Statistics' => array( 'SpecialPage', 'Statistics' ),
- 'Randompage' => 'Randompage',
- 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
- 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages' ),
- 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories' ),
- 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages' ),
- 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates' ),
- 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ),
- 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ),
- 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ),
- 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ),
- 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ),
- 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ),
- 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ),
- 'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ),
- 'Mostimages' => array( 'SpecialPage', 'Mostimages' ),
- 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ),
- 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
- 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
- 'Longpages' => array( 'SpecialPage', 'Longpages' ),
- 'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ),
- 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
- 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
- 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
- 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
- 'Allpages' => array( 'IncludableSpecialPage', 'Allpages' ),
- 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex' ) ,
- 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
+ 'Recentchanges' => array( 'IncludableSpecialPage', 'Recentchanges', 'section' => 'cleanup' ),
+ 'Upload' => array( 'SpecialPage', 'Upload', 'section' => 'utility' ),
+ 'Imagelist' => array( 'SpecialPage', 'Imagelist', 'section' => 'lists' ),
+ 'Newimages' => array( 'IncludableSpecialPage', 'Newimages', 'section' => 'lists' ),
+ 'Listusers' => array( 'SpecialPage', 'Listusers', 'section' => 'users' ),
+ 'Statistics' => array( 'SpecialPage', 'Statistics', 'section' => 'wiki' ),
+ 'Randompage' => array( 'Randompage', 'section' => 'lists' ),
+ 'Lonelypages' => array( 'SpecialPage', 'Lonelypages', 'section' => 'lists' ),
+ 'Uncategorizedpages' => array( 'SpecialPage', 'Uncategorizedpages', 'section' => 'cleanup' ),
+ 'Uncategorizedcategories' => array( 'SpecialPage', 'Uncategorizedcategories', 'section' => 'cleanup' ),
+ 'Uncategorizedimages' => array( 'SpecialPage', 'Uncategorizedimages', 'section' => 'cleanup' ),
+ 'Uncategorizedtemplates' => array( 'SpecialPage', 'Uncategorizedtemplates', 'section' => 'cleanup' ),
+ 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories', 'section' => 'cleanup' ),
+ 'Unusedimages' => array( 'SpecialPage', 'Unusedimages', 'section' => 'cleanup' ),
+ 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages', 'section' => 'cleanup' ),
+ 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories', 'section' => 'cleanup' ),
+ 'Mostlinked' => array( 'SpecialPage', 'Mostlinked', 'section' => 'lists' ),
+ 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories', 'section' => 'lists' ),
+ 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates', 'section' => 'lists' ),
+ 'Mostcategories' => array( 'SpecialPage', 'Mostcategories', 'section' => 'lists' ),
+ 'Mostimages' => array( 'SpecialPage', 'Mostimages', 'section' => 'lists' ),
+ 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions', 'section' => 'lists' ),
+ 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions', 'section' => 'lists' ),
+ 'Shortpages' => array( 'SpecialPage', 'Shortpages', 'section' => 'lists' ),
+ 'Longpages' => array( 'SpecialPage', 'Longpages', 'section' => 'lists' ),
+ 'Newpages' => array( 'IncludableSpecialPage', 'Newpages', 'section' => 'lists' ),
+ 'Ancientpages' => array( 'SpecialPage', 'Ancientpages', 'section' => 'lists' ),
+ 'Deadendpages' => array( 'SpecialPage', 'Deadendpages', 'section' => 'cleanup' ),
+ 'Protectedpages' => array( 'SpecialPage', 'Protectedpages', 'section' => 'cleanup' ),
+ 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles', 'section' => 'cleanup' ),
+ 'Allpages' => array( 'IncludableSpecialPage', 'Allpages', 'section' => 'lists' ),
+ 'Prefixindex' => array( 'IncludableSpecialPage', 'Prefixindex', 'section' => 'lists' ) ,
+ 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist', 'section' => 'users' ),
'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ),
- 'Contributions' => array( 'SpecialPage', 'Contributions' ),
+ 'Contributions' => array( 'SpecialPage', 'Contributions', 'section' => 'users' ),
'Emailuser' => array( 'UnlistedSpecialPage', 'Emailuser' ),
- 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ),
+ 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere', 'section' => 'utility' ),
'Recentchangeslinked' => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ),
'Movepage' => array( 'UnlistedSpecialPage', 'Movepage' ),
'Blockme' => array( 'UnlistedSpecialPage', 'Blockme' ),
'Resetpass' => array( 'UnlistedSpecialPage', 'Resetpass' ),
- 'Booksources' => 'SpecialBookSources',
- 'Categories' => array( 'SpecialPage', 'Categories' ),
- 'Export' => array( 'SpecialPage', 'Export' ),
- 'Version' => array( 'SpecialPage', 'Version' ),
- 'Allmessages' => array( 'SpecialPage', 'Allmessages' ),
- 'Log' => array( 'SpecialPage', 'Log' ),
- 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
- 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
- 'Import' => array( 'SpecialPage', 'Import', 'import' ),
- 'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin' ),
- 'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin' ),
- 'Userrights' => 'UserrightsPage',
- 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch' ),
- 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages' ),
- 'Listredirects' => array( 'SpecialPage', 'Listredirects' ),
- 'Revisiondelete' => array( 'UnlistedSpecialPage', 'Revisiondelete', 'deleterevision' ),
- 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates' ),
- 'Randomredirect' => 'SpecialRandomredirect',
- 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
- 'Filepath' => array( 'SpecialPage', 'Filepath' ),
+ 'Booksources' => array( 'SpecialBookSources', 'section' => 'info' ),
+ 'Categories' => array( 'SpecialPage', 'Categories', 'section' => 'lists' ),
+ 'Export' => array( 'SpecialPage', 'Export', 'section' => 'utility' ),
+ 'Version' => array( 'SpecialPage', 'Version', 'section' => 'wiki' ),
+ 'Allmessages' => array( 'SpecialPage', 'Allmessages', 'section' => 'wiki' ),
+ 'Log' => array( 'SpecialPage', 'Log', 'section' => 'wiki' ),
+ 'Blockip' => array( 'SpecialPage', 'Blockip', 'block', 'section' => 'users' ),
+ 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory', 'section' => 'lists' ),
+ 'Import' => array( 'SpecialPage', 'Import', 'import', 'section' => 'utility' ),
+ 'Lockdb' => array( 'SpecialPage', 'Lockdb', 'siteadmin', 'section' => 'utility' ),
+ 'Unlockdb' => array( 'SpecialPage', 'Unlockdb', 'siteadmin', 'section' => 'utilit' ),
+ 'Userrights' => array( 'UserrightsPage', 'section' => 'users' ),
+ 'MIMEsearch' => array( 'SpecialPage', 'MIMEsearch', 'section' => 'info' ),
+ 'Unwatchedpages' => array( 'SpecialPage', 'Unwatchedpages', 'unwatchedpages', 'section' => 'cleanup' ),
+ 'Listredirects' => array( 'SpecialPage', 'Listredirects', 'section' => 'cleanup' ),
+ 'Revisiondelete' => array( 'UnlistedSpecialPage', 'Revisiondelete', 'deleterevision', 'section' => 'cleanup' ),
+ 'Unusedtemplates' => array( 'SpecialPage', 'Unusedtemplates', 'section' => 'cleanup' ),
+ 'Randomredirect' => array( 'SpecialRandomredirect', 'section' => 'lists' ),
+ 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki', 'section' => 'cleanup' ),
+ 'Filepath' => array( 'SpecialPage', 'Filepath', 'section' => 'utility' ),
'Mypage' => array( 'SpecialMypage' ),
'Mytalk' => array( 'SpecialMytalk' ),
'Mycontributions' => array( 'SpecialMycontributions' ),
'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
- 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
+ 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory', 'section' => 'utility' ),
'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
);
@@ -176,11 +180,11 @@
self::$mListInitialised = true;
if( !$wgDisableCounters ) {
- self::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages' );
+ self::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages', 'section' => 'lists' );
}
if( !$wgDisableInternalSearch ) {
- self::$mList['Search'] = array( 'SpecialPage', 'Search' );
+ self::$mList['Search'] = array( 'SpecialPage', 'Search', 'section' => 'wiki' );
}
if( $wgEmailAuthentication ) {
@@ -320,9 +324,16 @@
$className = $rec;
self::$mList[$name] = new $className;
} elseif ( is_array( $rec ) ) {
+ if ( isset( $rec['section'] ) ) {
+ $section = $rec['section'];
+ unset( $rec['section'] );
+ }
$className = array_shift( $rec );
self::$mList[$name] = wfCreateObject( $className, $rec );
}
+ if ( isset( $section) ) {
+ self::$mList[$name]->mSection = $section;
+ }
return self::$mList[$name];
} else {
return NULL;
@@ -741,6 +752,10 @@
return count( $params ) ? implode( '&', $params ) : false;
}
+
+ function getSection() {
+ return $this->mSection;
+ }
}
/**
Index: includes/SpecialSpecialpages.php
===================================================================
--- includes/SpecialSpecialpages.php (revision 32403)
+++ includes/SpecialSpecialpages.php (working copy)
@@ -38,24 +38,57 @@
/** Put them into a sortable array */
$sortedPages = array();
+ $miscPages = array();
foreach ( $pages as $page ) {
if ( $page->isListed() ) {
- $sortedPages[$page->getDescription()] = $page->getTitle();
+ $section = $page->getSection();
+ if ( $section == NULL || $section == "misc") {
+ $miscPages[$page->getDescription()] = $page->getTitle();
+ }
+ else {
+ $section = wfMsg( 'spsection-' . $section );
+ $sortedPages[$section][$page->getDescription()] = $page->getTitle();
+ }
}
}
/** Sort */
if ( $wgSortSpecialPages ) {
ksort( $sortedPages );
+ foreach ( $sortedPages as $key => $arr ) {
+ /** Only allow sections with 2 or more entries. Otherwise, move the entry to misc. */
+ if ( count($arr) < 2 ) {
+ $miscPages += $arr;
+ unset( $sortedPages[$key] );
+ }
+ else {
+ ksort( $arr );
+ $sortedPages[$key] = $arr;
+ }
+ }
}
/** Now output the HTML */
- $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
- foreach ( $sortedPages as $desc => $title ) {
+ $wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n" );
+ foreach ( $sortedPages as $section => $pages ) {
+ wfSpecialSpecialpages_gen2($section, $pages, $sk);
+ }
+
+ if ( count($miscPages) > 0 ) {
+ if ( $wgSortSpecialPages ) {
+ ksort( $miscPages );
+ }
+ wfSpecialSpecialpages_gen2(wfMsg( 'spsection-misc' ), $miscPages, $sk);
+ }
+}
+
+function wfSpecialSpecialpages_gen2($section, $pages, $sk) {
+ global $wgOut;
+
+ $wgOut->addHTML( '<h3>' . $section . "</h3>\n<ul>" );
+ foreach ( $pages as $desc => $title ) {
$link = $sk->makeKnownLinkObj( $title , htmlspecialchars( $desc ) );
$wgOut->addHTML( "<li>{$link}</li>\n" );
}
$wgOut->addHTML( "</ul>\n" );
-}
-
-
+}
\ No newline at end of file
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 32403)
+++ languages/messages/MessagesEn.php (working copy)
@@ -1693,6 +1693,14 @@
'specialpages' => 'Special pages',
'specialpages-summary' => '', # only translate this message to other languages if you have to change it
'spheading' => 'Special pages for all users',
+'spsection-cleanup' => 'Clean-Up',
+'spsection-info' => 'Other Information Pages',
+'spsection-lists' => 'Page Lists',
+'spsection-misc' => 'Miscellaneous',
+'spsection-personal' => 'Users',
+'spsection-users' => 'User Management',
+'spsection-utility' => 'Utility',
+'spsection-wiki' => 'Information About This Wiki',
'restrictedpheading' => 'Restricted special pages',
'newpages' => 'New pages',
'newpages-summary' => '', # only translate this message to other languages if you have to change it

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3623
Default Alt Text
MediaWiki_-_SpecialSpecialpage_Sections.patch (16 KB)

Event Timeline