From: Tim Düsterhus Date: Thu, 4 Mar 2021 13:26:27 +0000 (+0100) Subject: Fix rendering issue in docs/migration/wsc53/php.md X-Git-Tag: 5.6.final~300 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e72f0388ff5f82509622ca97a272d0fd8a611ad9;p=GitHub%2FWoltLab%2Fwoltlab.github.io.git Fix rendering issue in docs/migration/wsc53/php.md --- diff --git a/docs/migration/wsc53/php.md b/docs/migration/wsc53/php.md index 85cbf2cf..0bedceb0 100644 --- a/docs/migration/wsc53/php.md +++ b/docs/migration/wsc53/php.md @@ -21,25 +21,26 @@ Leveraging this API is easily done. 1. Register an object type for the definition `com.woltlab.wcf.floodControl`: `com.example.foo.myContent`. 2. Whenever the active user creates content of this type, call - ```php - FloodControl::getInstance()->registerContent('com.example.foo.myContent'); - ``` - You should only call this method if the user creates the content themselves. - If the content is automatically created by the system, for example when copying / duplicating existing content, no activity should be registered. + ```php + FloodControl::getInstance()->registerContent('com.example.foo.myContent'); + ``` + You should only call this method if the user creates the content themselves. + If the content is automatically created by the system, for example when copying / duplicating existing content, no activity should be registered. 3. To check the last time when the active user created content of the relevant type, use - ```php - FloodControl::getInstance()->getLastTime('com.example.foo.myContent'); - ``` - If you want to limit the number of content items created within a certain period of time, for example within one day, use - ```php - $data = FloodControl::getInstance()->countContent('com.example.foo.myContent', new \DateInterval('P1D')); - // number of content items created within the last day - $count = $data['count']; - // timestamp when the earliest content item was created within the last day - $earliestTime = $data['earliestTime']; - ``` - The method also returns `earliestTime` so that you can tell the user in the error message when they are able again to create new content of the relevant type. - !!! info "Flood control entries are only stored for 31 days and older entries are cleaned up daily." + ```php + FloodControl::getInstance()->getLastTime('com.example.foo.myContent'); + ``` + If you want to limit the number of content items created within a certain period of time, for example within one day, use + ```php + $data = FloodControl::getInstance()->countContent('com.example.foo.myContent', new \DateInterval('P1D')); + // number of content items created within the last day + $count = $data['count']; + // timestamp when the earliest content item was created within the last day + $earliestTime = $data['earliestTime']; + ``` + The method also returns `earliestTime` so that you can tell the user in the error message when they are able again to create new content of the relevant type. + + !!! info "Flood control entries are only stored for 31 days and older entries are cleaned up daily." The previously mentioned methods of `FloodControl` use the active user and the current timestamp as reference point. `FloodControl` also provides methods to register content or check flood control for other registered users or for guests via their IP address.