Skip to content

Instantly share code, notes, and snippets.

@victorskl
Created August 15, 2013 21:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save victorskl/6245051 to your computer and use it in GitHub Desktop.
Save victorskl/6245051 to your computer and use it in GitHub Desktop.
Making Mediawiki SpecialPages only viewable by admin.
/*
Making Mediawiki SpecialPages only viewable by admin.
Copy and paste this to end of LocalSettings.php
*/
function disableSomeSpecialPages(&$list) {
global $wgUser;
if(!$wgUser->isAllowed('editinterface')) {
//remove some
#unset($list['Version']);
//remove exhaust list
foreach(array(
'Mostlinkedcategories',
'Export',
'Uncategorizedtemplates',
'Listredirects',
'DoubleRedirects',
'DeletedContributions',
'Mostcategories',
'Search',
'Block',
'Movepage',
'Mostrevisions',
'Unusedimages',
'Log',
'Mostlinkedtemplates',
'Deadendpages',
'JavaScriptTest',
'Userrights',
'Import',
'Ancientpages',
'Uncategorizedcategories',
'Activeusers',
'MergeHistory',
'Recentchanges',
'Randompage',
'Protectedpages',
'Wantedfiles',
'Listgrouprights',
'EditWatchlist',
'Blockme',
'FileDuplicateSearch',
'Withoutinterwiki',
'Randomredirect',
'BlockList',
'Popularpages',
'Emailuser',
'Booksources',
'Upload',
'Confirmemail',
'Watchlist',
'MIMEsearch',
'Allpages',
'Fewestrevisions',
'Unblock',
'ComparePages',
'Uncategorizedimages',
'Mostinterwikis',
'Preferences',
'Categories',
'Statistics',
'Version',
'UploadStash',
'Undelete',
'Whatlinkshere',
'Lockdb',
'Lonelypages',
'Mostimages',
'Unwatchedpages',
'Shortpages',
'Protectedtitles',
'Revisiondelete',
'Newpages',
'Unusedtemplates',
'Allmessages',
'CachedPage',
'Filepath',
'ChangePassword',
'Wantedpages',
'LinkSearch',
'Prefixindex',
'Recentchangeslinked',
'BrokenRedirects',
'Mostlinked',
'Tags',
'ChangeEmail',
'Longpages',
'Uncategorizedpages',
'Newimages',
'Blankpage',
'Disambiguations',
'Unusedcategories',
'Wantedcategories',
'PasswordReset',
'Unlockdb',
'PagesWithProp',
'Specialpages',
'Listfiles',
'Contributions',
'Listusers',
'Wantedtemplates'
)as $i){unset($list[$i]);}
}
return true;
}
$wgHooks['SpecialPage_initList'][]='disableSomeSpecialPages';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment