summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-04-16 11:35:52 +0000
committerDries Buytaert <dries@buytaert.net>2008-04-16 11:35:52 +0000
commit76151a8bc900ebb38c76170283a05df791311f76 (patch)
treedf9d3103010eb9452a55e2a0e901faf30d5e58bc /modules
parent46546ef478615dc1ac371c12cf392cabc1901cba (diff)
downloadbrdo-76151a8bc900ebb38c76170283a05df791311f76.tar.gz
brdo-76151a8bc900ebb38c76170283a05df791311f76.tar.bz2
- Patch #245504 by catch, David_Rothstein, Freso, et al: removed the throttle module from Drupal core.
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block-admin-display-form.tpl.php12
-rw-r--r--modules/block/block.admin.inc9
-rw-r--r--modules/block/block.install7
-rw-r--r--modules/block/block.module39
-rw-r--r--modules/statistics/statistics.module2
-rw-r--r--modules/system/system.admin.inc33
-rw-r--r--modules/system/system.install22
-rw-r--r--modules/system/system.module14
8 files changed, 39 insertions, 99 deletions
diff --git a/modules/block/block-admin-display-form.tpl.php b/modules/block/block-admin-display-form.tpl.php
index 369d09346..5e45ca3f3 100644
--- a/modules/block/block-admin-display-form.tpl.php
+++ b/modules/block/block-admin-display-form.tpl.php
@@ -9,7 +9,6 @@
* - $block_regions: An array of regions. Keyed by name with the title as value.
* - $block_listing: An array of blocks keyed by region and then delta.
* - $form_submit: Form submit button.
- * - $throttle: TRUE or FALSE depending on throttle module being enabled.
*
* Each $block_listing[$region] contains an array of blocks for that region.
*
@@ -18,7 +17,6 @@
* - $data->block_title: Block title.
* - $data->region_select: Drop-down menu for assigning a region.
* - $data->weight_select: Drop-down menu for setting weights.
- * - $data->throttle_check: Checkbox to enable throttling.
* - $data->configure_link: Block configuration link.
* - $data->delete_link: For deleting user added blocks.
*
@@ -41,9 +39,6 @@
<th><?php print t('Block'); ?></th>
<th><?php print t('Region'); ?></th>
<th><?php print t('Weight'); ?></th>
- <?php if ($throttle): ?>
- <th><?php print t('Throttle'); ?></th>
- <?php endif; ?>
<th colspan="2"><?php print t('Operations'); ?></th>
</tr>
</thead>
@@ -51,19 +46,16 @@
<?php $row = 0; ?>
<?php foreach ($block_regions as $region => $title): ?>
<tr class="region region-<?php print $region?>">
- <td colspan="<?php print $throttle ? '6' : '5'; ?>" class="region"><?php print $title; ?></td>
+ <td colspan="5" class="region"><?php print $title; ?></td>
</tr>
<tr class="region-message region-<?php print $region?>-message <?php print empty($block_listing[$region]) ? 'region-empty' : 'region-populated'; ?>">
- <td colspan="<?php print $throttle ? '6' : '5'; ?>"><em><?php print t('No blocks in this region'); ?></em></td>
+ <td colspan="5"><em><?php print t('No blocks in this region'); ?></em></td>
</tr>
<?php foreach ($block_listing[$region] as $delta => $data): ?>
<tr class="draggable <?php print $row % 2 == 0 ? 'odd' : 'even'; ?><?php print $data->row_class ? ' ' . $data->row_class : ''; ?>">
<td class="block"><?php print $data->block_title; ?></td>
<td><?php print $data->region_select; ?></td>
<td><?php print $data->weight_select; ?></td>
- <?php if ($throttle): ?>
- <td><?php print $data->throttle_check; ?></td>
- <?php endif; ?>
<td><?php print $data->configure_link; ?></td>
<td><?php print $data->delete_link; ?></td>
</tr>
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc
index ab125d792..2c53c998c 100644
--- a/modules/block/block.admin.inc
+++ b/modules/block/block.admin.inc
@@ -35,7 +35,6 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
$custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland');
init_theme();
- $throttle = module_exists('throttle');
$block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<' . t('none') . '>');
// Build form tree
@@ -70,10 +69,6 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
'#default_value' => $block['region'],
'#options' => $block_regions,
);
-
- if ($throttle) {
- $form[$key]['throttle'] = array('#type' => 'checkbox', '#default_value' => isset($block['throttle']) ? $block['throttle'] : FALSE);
- }
$form[$key]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/' . $block['module'] . '/' . $block['delta']));
if ($block['module'] == 'block') {
$form[$key]['delete'] = array('#value' => l(t('delete'), 'admin/build/block/delete/' . $block['delta']));
@@ -95,7 +90,7 @@ function block_admin_display_form_submit($form, &$form_state) {
foreach ($form_state['values'] as $block) {
$block['status'] = $block['region'] != BLOCK_REGION_NONE;
$block['region'] = $block['status'] ? $block['region'] : '';
- db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s', throttle = %d WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $block['status'], $block['weight'], $block['region'], isset($block['throttle']) ? $block['throttle'] : 0, $block['module'], $block['delta'], $block['theme']);
+ db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s' WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $block['status'], $block['weight'], $block['region'], $block['module'], $block['delta'], $block['theme']);
}
drupal_set_message(t('The block settings have been updated.'));
cache_clear_all();
@@ -354,7 +349,6 @@ function template_preprocess_block_admin_display_form(&$variables) {
global $theme_key;
$block_regions = system_region_list($theme_key);
- $variables['throttle'] = module_exists('throttle');
$variables['block_regions'] = $block_regions + array(BLOCK_REGION_NONE => t('Disabled'));
foreach ($block_regions as $key => $value) {
@@ -386,7 +380,6 @@ function template_preprocess_block_admin_display_form(&$variables) {
$variables['block_listing'][$region][$i]->block_title = drupal_render($block['info']);
$variables['block_listing'][$region][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']);
$variables['block_listing'][$region][$i]->weight_select = drupal_render($block['weight']);
- $variables['block_listing'][$region][$i]->throttle_check = $variables['throttle'] ? drupal_render($block['throttle']) : '';
$variables['block_listing'][$region][$i]->configure_link = drupal_render($block['configure']);
$variables['block_listing'][$region][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : '';
$variables['block_listing'][$region][$i]->printed = FALSE;
diff --git a/modules/block/block.install b/modules/block/block.install
index 83bc7b8d1..23cb8f30e 100644
--- a/modules/block/block.install
+++ b/modules/block/block.install
@@ -62,13 +62,6 @@ function block_schema() {
'size' => 'tiny',
'description' => t('Flag to indicate how users may control visibility of the block. (0 = Users cannot control, 1 = On by default, but can be hidden, 2 = Hidden by default, but can be shown)'),
),
- 'throttle' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => t('Flag to indicate whether or not to remove block when website traffic is high. (1 = throttle, 0 = do not throttle)'),
- ),
'visibility' => array(
'type' => 'int',
'not null' => TRUE,
diff --git a/modules/block/block.module b/modules/block/block.module
index c6e9ebd0b..3d4a94450 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -72,7 +72,6 @@ function block_help($path, $arg) {
$output .= '<p>' . t('When working with blocks, remember that:') . '</p>';
$output .= '<ul><li>' . t('since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis.') . '</li>';
$output .= '<li>' . t('disabled blocks, or blocks not in a region, are never shown.') . '</li>';
- $output .= '<li>' . t('when throttle module is enabled, throttled blocks (blocks with the <em>Throttle</em> checkbox selected) are hidden during high server loads.') . '</li>';
$output .= '<li>' . t('blocks can be configured to be visible only on certain pages.') . '</li>';
$output .= '<li>' . t('blocks can be configured to be visible only when specific conditions are true.') . '</li>';
$output .= '<li>' . t('blocks can be configured to be visible only for certain user roles.') . '</li>';
@@ -81,11 +80,7 @@ function block_help($path, $arg) {
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@block">Block module</a>.', array('@block' => 'http://drupal.org/handbook/modules/block/')) . '</p>';
return $output;
case 'admin/build/block':
- $throttle = module_exists('throttle');
$output = '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. To change the region or order of a block, grab a drag-and-drop handle under the <em>Block</em> column and drag the block to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
- if ($throttle) {
- $output .= '<p>' . t('To reduce CPU usage, database traffic or bandwidth, blocks may be automatically disabled during high server loads by selecting their <em>Throttle</em> checkbox. Adjust throttle thresholds on the <a href="@throttleconfig">throttle configuration page</a>.', array('@throttleconfig' => url('admin/settings/throttle'))) . '</p>';
- }
$output .= '<p>' . t('Click the <em>configure</em> link next to each block to configure its specific title and visibility settings. Use the <a href="@add-block">add block page</a> to create a custom block.', array('@add-block' => url('admin/build/block/add'))) . '</p>';
return $output;
case 'admin/build/block/add':
@@ -474,7 +469,7 @@ function _block_load_blocks() {
* An array of block objects such as returned for one region by _block_load_blocks()
*
* @return
- * An array of visible or not-throttled blocks with subject and content rendered.
+ * An array of visible blocks with subject and content rendered.
*/
function _block_render_blocks($region_blocks) {
foreach ($region_blocks as $key => $block) {
@@ -483,26 +478,22 @@ function _block_render_blocks($region_blocks) {
// Erase the block from the static array - we'll put it back if it has content.
unset($region_blocks[$key]);
if ($block->enabled && $block->page_match) {
- // Check the current throttle status and see if block should be displayed
- // based on server load.
- if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
- // Try fetching the block from cache. Block caching is not compatible with
- // node_access modules. We also preserve the submission of forms in blocks,
- // by fetching from cache only if the request method is 'GET'.
- if (!count(module_implements('node_grants')) && $_SERVER['REQUEST_METHOD'] == 'GET' && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
- $array = $cache->data;
- }
- else {
- $array = module_invoke($block->module, 'block', 'view', $block->delta);
- if (isset($cid)) {
- cache_set($cid, $array, 'cache_block', CACHE_TEMPORARY);
- }
+ // Try fetching the block from cache. Block caching is not compatible with
+ // node_access modules. We also preserve the submission of forms in blocks,
+ // by fetching from cache only if the request method is 'GET'.
+ if (!count(module_implements('node_grants')) && $_SERVER['REQUEST_METHOD'] == 'GET' && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
+ $array = $cache->data;
+ }
+ else {
+ $array = module_invoke($block->module, 'block', 'view', $block->delta);
+ if (isset($cid)) {
+ cache_set($cid, $array, 'cache_block', CACHE_TEMPORARY);
}
+ }
- if (isset($array) && is_array($array)) {
- foreach ($array as $k => $v) {
- $block->$k = $v;
- }
+ if (isset($array) && is_array($array)) {
+ foreach ($array as $k => $v) {
+ $block->$k = $v;
}
}
if (isset($block->content) && $block->content) {
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 3f43406b3..fcf990765 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -59,7 +59,7 @@ function statistics_exit() {
}
}
}
- if ((variable_get('statistics_enable_access_log', 0)) && (module_invoke('throttle', 'status') == 0)) {
+ if (variable_get('statistics_enable_access_log', 0)) {
// Log this page access.
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", strip_tags(drupal_get_title()), $_GET['q'], referer_uri(), ip_address(), $user->uid, session_id(), timer_read('page'), time());
}
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 8c9d0aa0e..c92ac2acb 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -588,7 +588,6 @@ function _system_is_incompatible(&$incompatible, $files, $file) {
/**
* Menu callback; provides module enable/disable interface.
*
- * Modules can be enabled or disabled and set for throttling if the throttle module is enabled.
* The list of modules gets populated by module.info files, which contain each module's name,
* description and dependencies.
* @see drupal_parse_info_file for information on module.info descriptors.
@@ -642,7 +641,6 @@ function system_modules($form_state = array()) {
// Array for disabling checkboxes in callback system_module_disable.
$disabled = array();
- $throttle = array();
// Traverse the files retrieved and build the form.
foreach ($files as $filename => $file) {
$form['name'][$filename] = array('#value' => $file->info['name']);
@@ -658,9 +656,6 @@ function system_modules($form_state = array()) {
if ($file->status) {
$status[] = $file->name;
}
- if ($file->throttle) {
- $throttle[] = $file->name;
- }
$dependencies = array();
// Check for missing dependencies.
@@ -736,21 +731,6 @@ function system_modules($form_state = array()) {
'#incompatible_modules_php' => $incompatible_php,
);
- // Handle throttle checkboxes, including overriding the
- // generated checkboxes for required modules.
- if (module_exists('throttle')) {
- $form['throttle'] = array(
- '#type' => 'checkboxes',
- '#default_value' => $throttle,
- '#options' => $options,
- '#process' => array(
- 'expand_checkboxes',
- 'system_modules_disable',
- ),
- '#disabled_modules' => array_merge($modules_required, array('throttle')),
- );
- }
-
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
@@ -861,13 +841,6 @@ function system_modules_submit($form, &$form_state) {
$dependencies = NULL;
}
- // Update throttle settings, if present
- if (isset($form_state['values']['throttle'])) {
- foreach ($form_state['values']['throttle'] as $key => $choice) {
- db_query("UPDATE {system} SET throttle = %d WHERE type = 'module' and name = '%s'", $choice ? 1 : 0, $key);
- }
- }
-
// If there where unmet dependencies and they haven't confirmed don't process
// the submission yet. Store the form submission data needed later.
if ($dependencies) {
@@ -2085,9 +2058,6 @@ function theme_system_modules($form) {
// Individual table headers.
$header = array();
$header[] = array('data' => t('Enabled'), 'class' => 'checkbox');
- if (module_exists('throttle')) {
- $header[] = array('data' => t('Throttle'), 'class' => 'checkbox');
- }
$header[] = t('Name');
$header[] = t('Version');
$header[] = t('Description');
@@ -2127,9 +2097,6 @@ function theme_system_modules($form) {
$status = drupal_render($form['status'][$key]);
}
$row[] = array('data' => $status, 'class' => 'checkbox');
- if (module_exists('throttle')) {
- $row[] = array('data' => drupal_render($form['throttle'][$key]), 'class' => 'checkbox');
- }
// Add labels only when there is also a checkbox.
if (isset($form['status'][$key])) {
diff --git a/modules/system/system.install b/modules/system/system.install
index a8aa9d927..6d9625774 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -1149,13 +1149,6 @@ function system_schema() {
'default' => 0,
'size' => 'tiny',
),
- 'throttle' => array(
- 'description' => t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'),
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- ),
'bootstrap' => array(
'description' => t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."),
'type' => 'int',
@@ -2853,6 +2846,21 @@ function system_update_7004(&$sandbox) {
}
/**
+ * Remove throttle columns and variables.
+ */
+function system_update_7005() {
+ $ret = array();
+ db_drop_field($ret, 'blocks', 'throttle');
+ db_drop_field($ret, 'system', 'throttle');
+ variable_del('throttle_user');
+ variable_del('throttle_anonymous');
+ variable_del('throttle_level');
+ variable_del('throttle_probability_limiter');
+
+ return $ret;
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
diff --git a/modules/system/system.module b/modules/system/system.module
index 432881ef9..52c183a5e 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -73,11 +73,7 @@ function system_help($path, $arg) {
case 'admin/build/themes/settings':
return '<p>' . t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') . '</p>';
case 'admin/build/modules':
- $output = '<p>' . t('Modules are plugins that extend Drupal\'s core functionality. Enable modules by selecting the <em>Enabled</em> checkboxes below and clicking the <em>Save configuration</em> button. Once a module is enabled, new <a href="@permissions">permissions</a> may be available. To reduce server load, modules with their <em>Throttle</em> checkbox selected are temporarily disabled when your site becomes extremely busy. (Note that the <em>Throttle</em> checkbox is only available if the Throttle module is enabled.)', array('@permissions' => url('admin/user/permissions')));
- if (module_exists('throttle')) {
- $output .= ' ' . t('The auto-throttle functionality must be enabled on the <a href="@throttle">throttle configuration page</a> after having enabled the throttle module.', array('@throttle' => url('admin/settings/throttle')));
- }
- $output .= '</p>';
+ $output = '<p>' . t('Modules are plugins that extend Drupal\'s core functionality. Enable modules by selecting the <em>Enabled</em> checkboxes below and clicking the <em>Save configuration</em> button. Once a module is enabled, new <a href="@permissions">permissions</a> may be available.)', array('@permissions' => url('admin/user/permissions'))) . '</p>';
$output .= '<p>' . t('It is important that <a href="@update-php">update.php</a> is run every time a module is updated to a newer version.', array('@update-php' => $base_url . '/update.php')) . '</p>';
$output .= '<p>' . t('You can find all administration tasks belonging to a particular module on the <a href="@by-module">administration by module page</a>.', array('@by-module' => url('admin/by-module'))) . '</p>';
$output .= '<p>' . t('To extend the functionality of your site, a number of <a href="@modules">contributed modules</a> are available.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
@@ -899,7 +895,7 @@ function system_check_directory($form_element) {
*/
function system_get_files_database(&$files, $type) {
// Extract current files from database.
- $result = db_query("SELECT filename, name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
+ $result = db_query("SELECT filename, name, type, status, schema_version FROM {system} WHERE type = '%s'", $type);
while ($file = db_fetch_object($result)) {
if (isset($files[$file->name]) && is_object($files[$file->name])) {
$file->old_filename = $file->filename;
@@ -969,7 +965,7 @@ function system_theme_data() {
$theme->owner = '';
}
- db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0);
+ db_query("INSERT INTO {system} (name, owner, info, type, filename, status, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0);
}
return $themes;
@@ -1155,8 +1151,8 @@ function system_initialize_theme_blocks($theme) {
if (!array_key_exists($block['region'], $regions)) {
$block['region'] = system_default_region($theme);
}
- db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, %d)",
- $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['cache']);
+ db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d)",
+ $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['cache']);
}
}
}