jenkins-bot has submitted this change and it was merged.
Change subject: Show 404 when accessing Special:MobileEditor directly
......................................................................
Show 404 when accessing Special:MobileEditor directly
This resolves bug 59873. Also introduces
MobileSpecialPage::showPageNotFound() to show a generic 404 error.
Bug: 59873
Change-Id: I7bc6675b4046a3daf0093e3a58fa5fd985f16b11
---
M MobileFrontend.i18n.php
M includes/specials/MobileSpecialPage.php
M includes/specials/SpecialMobileEditor.php
3 files changed, 15 insertions(+), 0 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index f4ee4d2..ad47a32 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -43,6 +43,9 @@
'mobile-frontend-logged-in-homepage-notification' => 'Welcome, $1!',
'mobile-frontend-logged-in-toast-notification' => 'Logged in as $1.',
+ 'mobile-frontend-generic-404-title' => 'Error - Page not found',
+ 'mobile-frontend-generic-404-desc' => 'The page you are looking for
could not be found.',
+
/** log-in page **/
'mobile-frontend-sign-up-heading' => 'Sign up',
'mobile-frontend-sign-in-heading' => 'Sign in',
@@ -485,6 +488,8 @@
{{Identical|Not logged in}}',
'mobile-frontend-logged-in-homepage-notification' => 'Heading at top of
homepage telling user they are logged in. Parameters:
* $1 - username',
+ 'mobile-frontend-generic-404-title' => 'Title for a generic HTTP 404
error page',
+ 'mobile-frontend-generic-404-desc' => 'Generic description of the HTTP
404 error shown to users',
'mobile-frontend-logged-in-toast-notification' => 'Message telling user
that they are logged in. Shows as a notification at bottom of page
*$1 - username',
'mobile-frontend-sign-up-heading' => 'Header for sign up page.
diff --git a/includes/specials/MobileSpecialPage.php
b/includes/specials/MobileSpecialPage.php
index 3e3393b..268dcb8 100644
--- a/includes/specials/MobileSpecialPage.php
+++ b/includes/specials/MobileSpecialPage.php
@@ -75,4 +75,9 @@
public function isListed() {
return $this->listed;
}
+
+ protected function showPageNotFound() {
+ wfHttpError( 404, $this->msg(
'mobile-frontend-generic-404-title' )->text(),
+ $this->msg( 'mobile-frontend-generic-404-desc'
)->text() );
+ }
}
diff --git a/includes/specials/SpecialMobileEditor.php
b/includes/specials/SpecialMobileEditor.php
index a4628ec..665dd78 100644
--- a/includes/specials/SpecialMobileEditor.php
+++ b/includes/specials/SpecialMobileEditor.php
@@ -11,6 +11,11 @@
$title = Title::newFromText( $subpage );
+ if ( is_null( $title )) {
+ $this->showPageNotFound();
+ return;
+ }
+
$data = $this->getRequest()->getValues();
unset( $data['title'] ); // Remove the title of the special page
--
To view, visit https://gerrit.wikimedia.org/r/107305
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7bc6675b4046a3daf0093e3a58fa5fd985f16b11
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Awjrichards <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits