From 2e3696b224b6baf4b71c61331645724a90375f39 Mon Sep 17 00:00:00 2001 From: Ammar Abdulhamid Date: Mon, 9 Mar 2020 09:57:43 +0100 Subject: [PATCH] Add check for page existence Currently even if the page does not exist at all this script just says "there's no content" which is partially true. If the page does exist but with no content and/or blank the same answer is also given, which is OK in that case but less so in the former case. Also handle special pages instead of throwing exception. Change-Id: Ia15b336d989d3605ead1891e3396380e8e6d4347 --- maintenance/view.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/maintenance/view.php b/maintenance/view.php index 952b8253ee..b75fe5b10f 100644 --- a/maintenance/view.php +++ b/maintenance/view.php @@ -39,6 +39,10 @@ class ViewCLI extends Maintenance { $title = Title::newFromText( $this->getArg() ); if ( !$title ) { $this->fatalError( "Invalid title" ); + } elseif ( $title->isSpecialPage() ) { + $this->fatalError( "Special Pages not supported" ); + } elseif ( !$title->exists() ) { + $this->fatalError( "Page does not exist" ); } $page = WikiPage::factory( $title ); -- 2.20.1