Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -255,6 +255,17 @@ |
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
| 259 | + * Get the appropriate PageStabilityForm depending on whether protection |
| 260 | + * levels are being used |
| 261 | + * @return PageStabilityForm |
| 262 | + */ |
| 263 | + public static function getPageStabilityForm() { |
| 264 | + return FlaggedRevs::useProtectionLevels() ? |
| 265 | + new PageStabilityProtectForm() : |
| 266 | + new PageStabilityGeneralForm(); |
| 267 | + } |
| 268 | + |
| 269 | + /** |
259 | 270 | * Get the autoreview restriction levels available |
260 | 271 | * @returns array |
261 | 272 | */ |
Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php |
— | — | @@ -46,11 +46,9 @@ |
47 | 47 | // We don't care about multiple errors, just report one of them |
48 | 48 | $this->dieUsageMsg( reset( $errors ) ); |
49 | 49 | } |
50 | | - // TODO: factory function? |
51 | | - $form = FlaggedRevs::useProtectionLevels() |
52 | | - ? new PageStabilityProtectForm() |
53 | | - : new PageStabilityGeneralForm(); |
54 | 50 | |
| 51 | + $form = FlaggedRevs::getPageStabilityForm(); |
| 52 | + |
55 | 53 | $form->setPage( $title ); # Our target page |
56 | 54 | $form->setWatchThis( $params['watch'] ); # Watch this page |
57 | 55 | $form->setReason( $params['reason'] ); # Reason |