From: jenkins-bot Date: Thu, 15 Dec 2016 06:54:13 +0000 (+0000) Subject: Merge "Add maintenance/view.php for viewing page contents" X-Git-Tag: 1.31.0-rc.0~4581 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=02abae3248b9273be6b312aeb9f1cae81a3ac6c0;hp=22a2fa0d49507dcfc11d7294d0b75f6bbd662582;p=lhc%2Fweb%2Fwiklou.git Merge "Add maintenance/view.php for viewing page contents" --- diff --git a/autoload.php b/autoload.php index e079686bc4..0283d3c512 100644 --- a/autoload.php +++ b/autoload.php @@ -1524,6 +1524,7 @@ $wgAutoloadLocalClasses = [ 'VFormHTMLForm' => __DIR__ . '/includes/htmlform/VFormHTMLForm.php', 'ValidateRegistrationFile' => __DIR__ . '/maintenance/validateRegistrationFile.php', 'ViewAction' => __DIR__ . '/includes/actions/ViewAction.php', + 'ViewCLI' => __DIR__ . '/maintenance/view.php', 'VirtualRESTService' => __DIR__ . '/includes/libs/virtualrest/VirtualRESTService.php', 'VirtualRESTServiceClient' => __DIR__ . '/includes/libs/virtualrest/VirtualRESTServiceClient.php', 'WANObjectCache' => __DIR__ . '/includes/libs/objectcache/WANObjectCache.php', diff --git a/maintenance/view.php b/maintenance/view.php new file mode 100644 index 0000000000..af7eb2d923 --- /dev/null +++ b/maintenance/view.php @@ -0,0 +1,59 @@ +addDescription( 'Show article contents on the command line' ); + $this->addArg( 'title', 'Title of article to view' ); + } + + public function execute() { + $title = Title::newFromText( $this->getArg() ); + if ( !$title ) { + $this->error( "Invalid title", true ); + } + + $page = WikiPage::factory( $title ); + + $content = $page->getContent( Revision::RAW ); + if ( !$content ) { + $this->error( "Page has no content", true ); + } + if ( !$content instanceof TextContent ) { + $this->error( "Non-text content models not supported", true ); + } + + $this->output( $content->getNativeData() ); + } +} + +$maintClass = "ViewCLI"; +require_once RUN_MAINTENANCE_IF_MAIN;