summaryrefslogtreecommitdiff
path: root/modules/block
diff options
context:
space:
mode:
Diffstat (limited to 'modules/block')
-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
4 files changed, 18 insertions, 49 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) {