From 3a7be6fd4959c8a925b38ef7e928d41ae1daa0c7 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 8683eed5c5..81c3f3e0ac 100644 --- a/maintenance/view.php +++ b/maintenance/view.php @@ -41,6 +41,10 @@ class ViewCLI extends Maintenance { $title = Title::newFromText( $this->getArg( 0 ) ); 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