Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
df631e3c
Commit
df631e3c
authored
19 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#45041
by markus: rand() -> mt_rand() + removed deprecated comments.
parent
cb45cf58
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/throttle.module
+2
-7
2 additions, 7 deletions
modules/throttle.module
modules/throttle/throttle.module
+2
-7
2 additions, 7 deletions
modules/throttle/throttle.module
with
4 additions
and
14 deletions
modules/throttle.module
+
2
−
7
View file @
df631e3c
...
...
@@ -31,18 +31,13 @@ function throttle_status() {
*/
function
throttle_exit
()
{
// The following logic determines what the current throttle level should
// be, and can be disabled by the admin. If enabled, the rand() function
// be, and can be disabled by the admin. If enabled, the
mt_
rand() function
// returns a number between 0 and N, N being specified by the admin. If
// 0 is returned, the throttle logic is run, adding two additional database
// queries. Otherwise, the following logic is skipped. This mechanism is
// referred to in the admin page as the 'probability limiter', roughly
// limiting throttle related database calls to 1 in N.
if
(
!
rand
(
0
,
variable_get
(
'throttle_probability_limiter'
,
9
)))
{
// Note: The rand() function is supported by PHP 3+. However, prior to
// PHP 4.2.0 it needs to be seeded with a call to srand(). It is important
// that this only happens once, so this should be managed by the Drupal
// engine, not this module. The Drupal engine should use phpversion() to
// detect and automatically seed pre-4.2.0 systems.
if
(
!
mt_rand
(
0
,
variable_get
(
'throttle_probability_limiter'
,
9
)))
{
// Count users with activity in the past n seconds, defined in user module
$time_period
=
variable_get
(
'user_block_seconds_online'
,
2700
);
...
...
This diff is collapsed.
Click to expand it.
modules/throttle/throttle.module
+
2
−
7
View file @
df631e3c
...
...
@@ -31,18 +31,13 @@ function throttle_status() {
*/
function
throttle_exit
()
{
// The following logic determines what the current throttle level should
// be, and can be disabled by the admin. If enabled, the rand() function
// be, and can be disabled by the admin. If enabled, the
mt_
rand() function
// returns a number between 0 and N, N being specified by the admin. If
// 0 is returned, the throttle logic is run, adding two additional database
// queries. Otherwise, the following logic is skipped. This mechanism is
// referred to in the admin page as the 'probability limiter', roughly
// limiting throttle related database calls to 1 in N.
if
(
!
rand
(
0
,
variable_get
(
'throttle_probability_limiter'
,
9
)))
{
// Note: The rand() function is supported by PHP 3+. However, prior to
// PHP 4.2.0 it needs to be seeded with a call to srand(). It is important
// that this only happens once, so this should be managed by the Drupal
// engine, not this module. The Drupal engine should use phpversion() to
// detect and automatically seed pre-4.2.0 systems.
if
(
!
mt_rand
(
0
,
variable_get
(
'throttle_probability_limiter'
,
9
)))
{
// Count users with activity in the past n seconds, defined in user module
$time_period
=
variable_get
(
'user_block_seconds_online'
,
2700
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment