Skip to content
Snippets Groups Projects
Commit 8a3512d4 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Updated the throttle module to the new documentation scheme.
parent 49fb60a0
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
<?php
/* System hook, sets description of module in admin page */
function throttle_system($field) {
$system["description"] = t("Allows configuration of congestion control auto-throttle mechanism.");
$system["admin_help"] = t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the <a href=\"%access\">access log</a> enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => url("admin/system/modules/statistics")));
$system["description"] = throttle_help("admin/system/modules");
$system["admin_help"] = throttle_help("admin/system/modules/throttle");
return $system[$field];
}
/* Permissions hook, defines module's permissions */
function throttle_perm() {
/*
** throttle module defines the following permissions:
......@@ -17,9 +15,15 @@ function throttle_perm() {
return array("access throttle box");
}
function throttle_help($section = "admin/throttle/help") {
/* Administrative help page */
function throttle_help() {
switch ($section) {
case "admin/system/modules":
$output = "Allows configuration of congestion control auto-throttle mechanism.";
break;
case "admin/system/modules/throttle":
return t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the <a href=\"%access\">access log</a> enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => url("admin/system/modules/statistics")));
case "admin/throttle/help":
$output .= "<h3>Introduction</h3><p>This Drupal module allows you to enable and configure the auto-throttle congestion control mechanism offered by the ". l("statistics.module","admin/statistics") .". The auto-throttle mechanism allows your site to automatically adapt to different server levels.</p>";
$output .= "<p>This module also adds a block that displays the current status of the throttle. You must have ". l("\"access throttle block\"","admin/user/permission") ." privileges to view the block. As a general rule of thumb, only site administrators should be granted access to this block.</p>";
$output .= "<p>The auto-throttle mechanism performs an extra database query in order to determine what the current throttle level should be. Fortunately the throttle can be tuned so these database queries only occur on a fraction of all pages geenrated by your site, reducing the overhead to an insignificant amount. Additionally, when the top-most throttle level is reached, all throttle queries are suspended for a configurable period of time. More detail follows.</p>";
......@@ -50,8 +54,10 @@ function throttle_help() {
else {
// throttle limit not reached, execute normally
}</pre></p>";
return t($output);
break;
}
return t($output);
}
......
<?php
/* System hook, sets description of module in admin page */
function throttle_system($field) {
$system["description"] = t("Allows configuration of congestion control auto-throttle mechanism.");
$system["admin_help"] = t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the <a href=\"%access\">access log</a> enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => url("admin/system/modules/statistics")));
$system["description"] = throttle_help("admin/system/modules");
$system["admin_help"] = throttle_help("admin/system/modules/throttle");
return $system[$field];
}
/* Permissions hook, defines module's permissions */
function throttle_perm() {
/*
** throttle module defines the following permissions:
......@@ -17,9 +15,15 @@ function throttle_perm() {
return array("access throttle box");
}
function throttle_help($section = "admin/throttle/help") {
/* Administrative help page */
function throttle_help() {
switch ($section) {
case "admin/system/modules":
$output = "Allows configuration of congestion control auto-throttle mechanism.";
break;
case "admin/system/modules/throttle":
return t("If your site gets popular, or comes under a \"Denial of Service\" (DOS) attack, your hardware might become overwhelmed. These settings allow you to \"slow down\" the access to your site. To use throttle you need to have the <a href=\"%access\">access log</a> enabled. For Drupal to preform throttling it needs to do an extra database query. This extra query happens on page displays. <b>Auto-throttle probability limiter</b> tells Drupal to do this extra DB query once every \"x\" page displays, where \"x\" is the percentage. So if it is set to 10%, the default, then for every 100 web pages it displays, it will preform the extra query ten time. ", array("%access" => url("admin/system/modules/statistics")));
case "admin/throttle/help":
$output .= "<h3>Introduction</h3><p>This Drupal module allows you to enable and configure the auto-throttle congestion control mechanism offered by the ". l("statistics.module","admin/statistics") .". The auto-throttle mechanism allows your site to automatically adapt to different server levels.</p>";
$output .= "<p>This module also adds a block that displays the current status of the throttle. You must have ". l("\"access throttle block\"","admin/user/permission") ." privileges to view the block. As a general rule of thumb, only site administrators should be granted access to this block.</p>";
$output .= "<p>The auto-throttle mechanism performs an extra database query in order to determine what the current throttle level should be. Fortunately the throttle can be tuned so these database queries only occur on a fraction of all pages geenrated by your site, reducing the overhead to an insignificant amount. Additionally, when the top-most throttle level is reached, all throttle queries are suspended for a configurable period of time. More detail follows.</p>";
......@@ -50,8 +54,10 @@ function throttle_help() {
else {
// throttle limit not reached, execute normally
}</pre></p>";
return t($output);
break;
}
return t($output);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment