Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| ViewEntitySchemaAction | |
0.00% |
0 / 11 |
|
0.00% |
0 / 4 |
42 | |
0.00% |
0 / 1 |
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onView | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| needsReadRights | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| show | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | declare( strict_types = 1 ); |
| 4 | |
| 5 | namespace EntitySchema\MediaWiki\Actions; |
| 6 | |
| 7 | use MediaWiki\Actions\FormlessAction; |
| 8 | |
| 9 | /** |
| 10 | * Handles the view action for EntitySchemas. |
| 11 | * @license GPL-2.0-or-later |
| 12 | */ |
| 13 | class ViewEntitySchemaAction extends FormlessAction { |
| 14 | |
| 15 | /** @inheritDoc */ |
| 16 | public function getName() { |
| 17 | return 'view'; |
| 18 | } |
| 19 | |
| 20 | /** @inheritDoc */ |
| 21 | public function onView() { |
| 22 | return null; |
| 23 | } |
| 24 | |
| 25 | /** @inheritDoc */ |
| 26 | public function needsReadRights() { |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | /** @inheritDoc */ |
| 31 | public function show() { |
| 32 | if ( $this->getOutput()->checkLastModified( |
| 33 | $this->getWikiPage()->getTouched() |
| 34 | ) ) { |
| 35 | // Client cache fresh and headers sent, nothing more to do. |
| 36 | return null; |
| 37 | } |
| 38 | |
| 39 | $this->getArticle()->view(); |
| 40 | |
| 41 | $meta = $this->getOutput()->getProperty( 'entityschema-meta-tags' ); |
| 42 | if ( $meta !== null ) { |
| 43 | $this->getOutput()->setHTMLTitle( $meta['title'] ); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | } |