Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| RateLimits | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| validate | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| enabled | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\SpamFilter; |
| 4 | |
| 5 | use Flow\Model\AbstractRevision; |
| 6 | use MediaWiki\Context\IContextSource; |
| 7 | use MediaWiki\Status\Status; |
| 8 | use MediaWiki\Title\Title; |
| 9 | |
| 10 | class RateLimits implements SpamFilter { |
| 11 | /** |
| 12 | * @param IContextSource $context |
| 13 | * @param AbstractRevision $newRevision |
| 14 | * @param AbstractRevision|null $oldRevision |
| 15 | * @param Title $title |
| 16 | * @param Title $ownerTitle |
| 17 | * @return Status |
| 18 | */ |
| 19 | public function validate( |
| 20 | IContextSource $context, |
| 21 | AbstractRevision $newRevision, |
| 22 | ?AbstractRevision $oldRevision, |
| 23 | Title $title, |
| 24 | Title $ownerTitle |
| 25 | ) { |
| 26 | if ( $context->getUser()->pingLimiter( 'edit' ) ) { |
| 27 | return Status::newFatal( 'actionthrottledtext' ); |
| 28 | } |
| 29 | |
| 30 | return Status::newGood(); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Checks if RateLimits is enabled. |
| 35 | * |
| 36 | * @return bool |
| 37 | */ |
| 38 | public function enabled() { |
| 39 | return true; |
| 40 | } |
| 41 | } |