-
Notifications
You must be signed in to change notification settings - Fork 11
Refactor denyAccessPretty to clear HTML and return to main #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,16 +119,19 @@ protected function denyAccessRaw( string $header, string $message ): void { | |
| * @return void | ||
| */ | ||
| protected function denyAccessPretty( $output ): void { | ||
| $output->clearHTML(); | ||
| $output->setStatusCode( 403 ); | ||
|
Comment on lines
116
to
117
|
||
| $output->addWikiTextAsInterface( | ||
| wfMessage( 'crawlerprotection-accessdenied-text' )->plain() | ||
| ); | ||
|
|
||
| if ( version_compare( MW_VERSION, '1.41', '<' ) ) { | ||
| $output->setPageTitle( wfMessage( 'crawlerprotection-accessdenied-title' ) ); | ||
| } else { | ||
| // @phan-suppress-next-line PhanUndeclaredMethod Exists in 1.41+ | ||
| $output->setPageTitleMsg( wfMessage( 'crawlerprotection-accessdenied-title' ) ); | ||
| } | ||
|
|
||
| $output->addWikiTextAsInterface( | ||
| wfMessage( 'crawlerprotection-accessdenied-text' )->plain() | ||
| ); | ||
| $output->returnToMain(); | ||
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of adding this at the beginning of the page? It's currently unclear what this does, but if there's a good reason for it, an explanatory comment would be much appreciated.