public function __get($name)Inherited
$name |
wild |
public function __set($name, $value)Inherited
$name | ||
$value |
wild |
public function current()Inherited
wild |
public function key()Inherited
wild |
public function next()Inherited
wild |
public function rewind()Inherited
wild |
public function valid()Inherited
wild |
private function throwOnAttemptedIteration()Inherited
wild |
public function getPhobjectClassConstant($key, $byte_limit)Inherited
Read the value of a class constant.
This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.
string | $key | Name of the constant. |
int|null | $byte_limit | Maximum number of bytes permitted in the value. |
string | Value of the constant. |
public static function willTakeAction($actors, $action, $score)
Prepare to take an action, throwing an exception if the user has exceeded the rate limit.
The $actors are a list of strings. Normally this will be a list of user PHIDs, but some systems use other identifiers (like email addresses). Each actor's score threshold is tracked independently. If any actor exceeds the rate limit for the action, this method throws.
The $action defines the actual thing being rate limited, and sets the limit.
You can pass either a positive, zero, or negative $score to this method:
- If the score is positive, the user is given that many points toward the rate limit after the limit is checked. Over time, this will cause them to hit the rate limit and be prevented from taking further actions.
- If the score is zero, the rate limit is checked but no score changes are made. This allows you to check for a rate limit before beginning a workflow, so the user doesn't fill in a form only to get rate limited at the end.
- If the score is negative, the user is credited points, allowing them to take more actions than the limit normally permits. By awarding points for failed actions and credits for successful actions, a system can be sensitive to failure without overly restricting legitimate uses.
If any actor is exceeding their rate limit, this method throws a PhabricatorSystemActionRateLimitException.
list<string> | $actors | List of actors. |
PhabricatorSystemAction | $action | Action being taken. |
float | $score | Score or credit, see above. |
void |
public static function loadBlockedActors($actors, $action, $score)
array | $actors | |
PhabricatorSystemAction | $action | |
$score |
wild |
public static function loadScores($actors, $action)
array | $actors | |
PhabricatorSystemAction | $action |
wild |
private static function recordAction($actors, $action, $score)
array | $actors | |
PhabricatorSystemAction | $action | |
$score |
wild |
private static function getWindow()
wild |
public static function resetActions($actors)
Reset all action counts for actions taken by some set of actors in the previous action window.
list<string> | $actors | Actors to reset counts for. |
int | Number of actions cleared. |
public static function newActorFromRequest($request)
AphrontRequest | $request |
wild |