Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
PageStabilityGeneralForm
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 6
110
0.00% covered (danger)
0.00%
0 / 1
 getReviewThis
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setReviewThis
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getOverride
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setOverride
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 reallyDoPreloadParameters
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
 reallyDoCheckParameters
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2
3// Assumes $wgFlaggedRevsProtection is off
4use MediaWiki\MediaWikiServices;
5
6class 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    protected function reallyDoCheckParameters() {
45        $this->override = $this->override ? 1 : 0; // default version settings is 0 or 1
46        // Check autoreview restriction setting
47        if ( $this->autoreview != '' // restriction other than 'none'
48            && !in_array( $this->autoreview, FlaggedRevs::getRestrictionLevels() )
49        ) {
50            return 'stabilize_invalid_autoreview'; // invalid value
51        }
52        if ( !FlaggedRevs::userCanSetAutoreviewLevel( $this->user, $this->autoreview ) ) {
53            return 'stabilize_denied'; // invalid value
54        }
55        return true;
56    }
57}