37 private string $oldContentModel;
38 private string $newContentModel;
41 private string $result;
46 string $oldContentModel,
47 string $newContentModel
49 $this->limiter = $limiter;
50 $this->subject = $subject;
51 $this->oldContentModel = $oldContentModel;
52 $this->newContentModel = $newContentModel;
55 private function limit(
string $action,
int $inc = 1 ) {
56 return $this->limiter->limit( $this->subject, $action, $inc );
61 $contentModelChange = ( $this->newContentModel !== $this->oldContentModel );
66 if ( $this->limit(
'edit' )
67 || $this->limit(
'linkpurge', 0 )
68 || ( $contentModelChange && $this->limit(
'editcontentmodel' ) )
70 $this->result = self::CONSTRAINT_FAILED;
72 $this->result = self::CONSTRAINT_PASSED;
81 if ( $this->result === self::CONSTRAINT_FAILED ) {
82 $statusValue->
fatal(
'actionthrottledtext' );
83 $statusValue->value = self::AS_RATE_LIMITED;
Verify user doesn't exceed rate limits.
getLegacyStatus()
Get the legacy status for failure (or success)
__construct(RateLimiter $limiter, RateLimitSubject $subject, string $oldContentModel, string $newContentModel)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
fatal( $message,... $parameters)
Add an error and set OK to false, indicating that the operation as a whole was fatal.
Interface for all constraints that can prevent edits.