From cbe6b0c397d0577f4764791d9a9fa21cef760a4e Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 10 May 2014 15:13:53 +0100 Subject: [PATCH] Add Page Existance checking maintenance script Change-Id: I0121f9b4d67d6dd2d27f5719d61c70683f1bae66 --- maintenance/pageExists.php | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 maintenance/pageExists.php diff --git a/maintenance/pageExists.php b/maintenance/pageExists.php new file mode 100644 index 0000000000..c4b208a59c --- /dev/null +++ b/maintenance/pageExists.php @@ -0,0 +1,54 @@ +mDescription = "Report whether a specific page exists"; + $this->addArg( 'title', 'Page title to check whether it exists' ); + } + + public function execute() { + $titleArg = $this->getArg(); + $title = Title::newFromText( $titleArg ); + $pageExists = $title && $title->exists(); + + $text = ''; + $code = 0; + if ( $pageExists ) { + $text = "{$title} exists."; + } else { + $text = "{$title} doesn't exist."; + $code = 1; + } + $this->output( $text ); + $this->error( '', $code ); + } +} + +$maintClass = "PageExists"; +require_once RUN_MAINTENANCE_IF_MAIN; + -- 2.20.1