Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| PageStabilityGeneralForm | |
0.00% |
0 / 16 |
|
0.00% |
0 / 6 |
110 | |
0.00% |
0 / 1 |
| getReviewThis | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setReviewThis | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getOverride | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setOverride | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| reallyDoPreloadParameters | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| reallyDoCheckParameters | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
30 | |||
| 1 | <?php |
| 2 | |
| 3 | // Assumes $wgFlaggedRevsProtection is off |
| 4 | use MediaWiki\MediaWikiServices; |
| 5 | |
| 6 | class PageStabilityGeneralForm extends PageStabilityForm { |
| 7 | |
| 8 | /** |
| 9 | * @return bool|null |
| 10 | */ |
| 11 | public function getReviewThis() { |
| 12 | return $this->reviewThis; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * @param bool $value |
| 17 | */ |
| 18 | public function setReviewThis( $value ) { |
| 19 | $this->trySet( $this->reviewThis, $value ); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @return int |
| 24 | */ |
| 25 | public function getOverride() { |
| 26 | return $this->override; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @param int $value |
| 31 | */ |
| 32 | public function setOverride( $value ) { |
| 33 | $this->trySet( $this->override, $value ); |
| 34 | } |
| 35 | |
| 36 | protected function reallyDoPreloadParameters() { |
| 37 | $oldConfig = $this->getOldConfig(); |
| 38 | $this->override = $oldConfig['override']; |
| 39 | $this->autoreview = $oldConfig['autoreview']; |
| 40 | $this->watchThis = MediaWikiServices::getInstance()->getWatchlistManager() |
| 41 | ->isWatched( $this->getUser(), $this->title ); |
| 42 | } |
| 43 | |
| 44 | /** @return string|true */ |
| 45 | protected function reallyDoCheckParameters() { |
| 46 | $this->override = $this->override ? 1 : 0; // default version settings is 0 or 1 |
| 47 | // Check autoreview restriction setting |
| 48 | if ( $this->autoreview != '' // restriction other than 'none' |
| 49 | && !in_array( $this->autoreview, FlaggedRevs::getRestrictionLevels() ) |
| 50 | ) { |
| 51 | return 'stabilize_invalid_autoreview'; // invalid value |
| 52 | } |
| 53 | if ( !FlaggedRevs::userCanSetAutoreviewLevel( $this->user, $this->autoreview ) ) { |
| 54 | return 'stabilize_denied'; // invalid value |
| 55 | } |
| 56 | return true; |
| 57 | } |
| 58 | } |