Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| EditAction | |
0.00% |
0 / 12 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 1 |
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onView | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| show | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |||
| doesWrites | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | * @ingroup Actions |
| 6 | */ |
| 7 | |
| 8 | namespace MediaWiki\Actions; |
| 9 | |
| 10 | use MediaWiki\EditPage\EditPage; |
| 11 | |
| 12 | /** |
| 13 | * Page edition handler (action=edit) |
| 14 | * |
| 15 | * This is a wrapper that will call the EditPage class or a custom editor from an extension. |
| 16 | * |
| 17 | * @stable to extend |
| 18 | * @ingroup Actions |
| 19 | */ |
| 20 | class EditAction extends FormlessAction { |
| 21 | |
| 22 | /** |
| 23 | * @stable to override |
| 24 | * @return string |
| 25 | */ |
| 26 | public function getName() { |
| 27 | return 'edit'; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @stable to override |
| 32 | * @return string|null |
| 33 | */ |
| 34 | public function onView() { |
| 35 | return null; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @stable to override |
| 40 | */ |
| 41 | public function show() { |
| 42 | $this->useTransactionalTimeLimit(); |
| 43 | |
| 44 | $out = $this->getOutput(); |
| 45 | $out->setRobotPolicy( 'noindex,nofollow' ); |
| 46 | |
| 47 | // The editor should always see the latest content when starting their edit. |
| 48 | // Also to ensure cookie blocks can be set (T152462). |
| 49 | $out->disableClientCache(); |
| 50 | |
| 51 | $article = $this->getArticle(); |
| 52 | if ( $this->getHookRunner()->onCustomEditor( $article, $this->getUser() ) ) { |
| 53 | $editor = new EditPage( $article ); |
| 54 | $editor->setContextTitle( $this->getTitle() ); |
| 55 | $editor->edit(); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** @inheritDoc */ |
| 60 | public function doesWrites() { |
| 61 | return true; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** @deprecated class alias since 1.44 */ |
| 66 | class_alias( EditAction::class, 'EditAction' ); |