(bug 37627) generic exception for not logged in users
We have various place in MediaWiki core and in extensions which are
showing anonymous user a very standard error page about them not being
logged in. Each developer ends up writing its own because we do not
provide a generic error, that is what this patch does.
This UserNotLoggedIn exception, when called, will show the usual
ErrorPage with a default title and default reason text. That makes it as
easy to use as doing:
if( $user->isAnon() ) {
throw new UserNotLoggedIn();
}
One can override the default reason by passing a message key as the
first parameter:
if( $user->isAnon() ) {
throw new UserNotLoggedIn( 'nologin-reason-text' );
}
In that case, the page title will still be the default 'Not Logged In.'
Change-Id: Id81272995627bf0f5bbef785230a8e6e4e8582ca