Pagine speciali bloccate per i visitatori (non loggati)
Versione del 24 apr 2020 alle 20:00 di Andrea (discussione | contributi)
Grazie alla guida https://www.mediawiki.org/wiki/Manual:Hooks/SpecialPage_initList
Abbiamo distillato questo codice che permette di bloccare le pagine speciali se non si è loggati.
// disabilitazione pagine speciali function disableAllSpecialPages( &$list ) { global $wgUser; if( ! $wgUser->isLoggedIn() ) { $list = array(); // Abilito solo la pagina di login $list['Userlogin'] = "SpecialUserLogin"; } return true; } $wgHooks['SpecialPage_initList'][] = 'disableAllSpecialPages';
Nota Bene
Il codice $list['Userlogin'] = "SpecialUserLogin"; potrebbe cambiare in base alla versione di MediaWiki utilizzata.
Abilitazione pagine speciali singolarmente
Array ( [BrokenRedirects] => BrokenRedirectsPage [Deadendpages] => DeadendPagesPage [DoubleRedirects] => DoubleRedirectsPage [Longpages] => LongPagesPage [Ancientpages] => AncientPagesPage [Lonelypages] => LonelyPagesPage [Fewestrevisions] => FewestrevisionsPage [Withoutinterwiki] => WithoutInterwikiPage [Protectedpages] => SpecialProtectedpages [Protectedtitles] => SpecialProtectedtitles [Shortpages] => ShortPagesPage [Uncategorizedcategories] => UncategorizedCategoriesPage [Uncategorizedimages] => UncategorizedImagesPage [Uncategorizedpages] => UncategorizedPagesPage [Uncategorizedtemplates] => UncategorizedTemplatesPage [Unusedcategories] => UnusedCategoriesPage [Unusedimages] => UnusedimagesPage [Unusedtemplates] => UnusedtemplatesPage [Unwatchedpages] => UnwatchedpagesPage [Wantedcategories] => WantedCategoriesPage [Wantedfiles] => WantedFilesPage [Wantedpages] => WantedPagesPage [Wantedtemplates] => WantedTemplatesPage [Allpages] => SpecialAllPages [Prefixindex] => SpecialPrefixindex [Categories] => SpecialCategories [Listredirects] => ListredirectsPage [PagesWithProp] => SpecialPagesWithProp [TrackingCategories] => SpecialTrackingCategories [Userlogin] => SpecialUserLogin - pagina di login [Userlogout] => SpecialUserLogout - pagina di logout [CreateAccount] => SpecialCreateAccount [LinkAccounts] => SpecialLinkAccounts [UnlinkAccounts] => SpecialUnlinkAccounts [ChangeCredentials] => SpecialChangeCredentials [RemoveCredentials] => SpecialRemoveCredentials [Activeusers] => SpecialActiveUsers [Block] => SpecialBlock [Unblock] => SpecialUnblock [BlockList] => SpecialBlockList [AutoblockList] => SpecialAutoblockList [ChangePassword] => SpecialChangePassword [BotPasswords] => SpecialBotPasswords [PasswordReset] => SpecialPasswordReset [DeletedContributions] => DeletedContributionsPage [Preferences] => SpecialPreferences [ResetTokens] => SpecialResetTokens [Contributions] => SpecialContributions [Listgrouprights] => SpecialListGroupRights [Listgrants] => SpecialListGrants [Listusers] => SpecialListUsers [Listadmins] => SpecialListAdmins [Listbots] => SpecialListBots [Userrights] => UserrightsPage [EditWatchlist] => SpecialEditWatchlist [Newimages] => SpecialNewFiles [Log] => SpecialLog [Watchlist] => SpecialWatchlist [Newpages] => SpecialNewpages [Recentchanges] => SpecialRecentChanges [Recentchangeslinked] => SpecialRecentChangesLinked [Tags] => SpecialTags [Listfiles] => SpecialListFiles [Filepath] => SpecialFilepath [MediaStatistics] => MediaStatisticsPage [MIMEsearch] => MIMEsearchPage [FileDuplicateSearch] => FileDuplicateSearchPage [Upload] => SpecialUpload [UploadStash] => SpecialUploadStash [ListDuplicatedFiles] => ListDuplicatedFilesPage [ApiSandbox] => SpecialApiSandbox [Statistics] => SpecialStatistics [Allmessages] => SpecialAllMessages [Version] => SpecialVersion [Lockdb] => SpecialLockdb [Unlockdb] => SpecialUnlockdb [LinkSearch] => LinkSearchPage [Randompage] => RandomPage [RandomInCategory] => SpecialRandomInCategory [Randomredirect] => SpecialRandomredirect [Randomrootpage] => SpecialRandomrootpage [GoToInterwiki] => SpecialGoToInterwiki [Mostlinkedcategories] => MostlinkedCategoriesPage [Mostimages] => MostimagesPage [Mostinterwikis] => MostinterwikisPage [Mostlinked] => MostlinkedPage [Mostlinkedtemplates] => MostlinkedTemplatesPage [Mostcategories] => MostcategoriesPage [Mostrevisions] => MostrevisionsPage [ComparePages] => SpecialComparePages [Export] => SpecialExport [Import] => SpecialImport [Undelete] => SpecialUndelete [Whatlinkshere] => SpecialWhatLinksHere [MergeHistory] => SpecialMergeHistory [ExpandTemplates] => SpecialExpandTemplates [Booksources] => SpecialBookSources [ApiHelp] => SpecialApiHelp [Blankpage] => SpecialBlankpage [Diff] => SpecialDiff [EditTags] => SpecialEditTags [Emailuser] => SpecialEmailUser [Movepage] => MovePageForm [Mycontributions] => SpecialMycontributions [MyLanguage] => SpecialMyLanguage [Mypage] => SpecialMypage [Mytalk] => SpecialMytalk [Myuploads] => SpecialMyuploads [AllMyUploads] => SpecialAllMyUploads [PermanentLink] => SpecialPermanentLink [Redirect] => SpecialRedirect [Revisiondelete] => SpecialRevisionDelete [RunJobs] => SpecialRunJobs [Specialpages] => SpecialSpecialpages [PageData] => SpecialPageData [Search] => SpecialSearch [Confirmemail] => EmailConfirmation [Invalidateemail] => EmailInvalidation [ChangeEmail] => SpecialChangeEmail [ChangeContentModel] => SpecialChangeContentModel )