diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 542e04b1d03..863bc7a20b8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -20,6 +20,9 @@ Drupal 7.0, xxxx-xx-xx (development version) simple method for blocking IP addresses. E-mail and username restrictions are now available in a contributed module. IP address range blocking is no longer supported and should be done at the server level. +- Removed throttle module: + * The throttle module has been removed. Alternative methods to improve + performance are available in core and contributed modules. Drupal 6.0, 2008-02-13 ---------------------- diff --git a/includes/install.inc b/includes/install.inc index 2d74a9230ed..9398077a10a 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -359,7 +359,7 @@ function drupal_install_system() { module_invoke('system', 'install'); $system_versions = drupal_get_schema_versions('system'); $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; - db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, 0, 0, $system_version); + db_query("INSERT INTO {system} (filename, name, type, owner, status, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, 0, $system_version); // Now that we've installed things properly, bootstrap the full Drupal environment drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); module_rebuild_cache(); diff --git a/includes/module.inc b/includes/module.inc index c87393c7b22..d0f10029845 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -58,21 +58,15 @@ function module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE, $fixed_ } else { if ($bootstrap) { - $result = db_query("SELECT name, filename, throttle FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC"); + $result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC"); } else { - $result = db_query("SELECT name, filename, throttle FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC"); + $result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC"); } while ($module = db_fetch_object($result)) { if (file_exists($module->filename)) { - // Determine the current throttle status and see if the module should be - // loaded based on server load. We have to directly access the throttle - // variables, since throttle.module may not be loaded yet. - $throttle = ($module->throttle && variable_get('throttle_level', 0) > 0); - if (!$throttle) { - drupal_get_filename('module', $module->name, $module->filename); - $list[$module->name] = $module->name; - } + drupal_get_filename('module', $module->name, $module->filename); + $list[$module->name] = $module->name; } } } @@ -143,8 +137,7 @@ function module_rebuild_cache() { else { // This is a new module. $files[$filename]->status = 0; - $files[$filename]->throttle = 0; - db_query("INSERT INTO {system} (name, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, serialize($files[$filename]->info), 'module', $file->filename, 0, 0, $bootstrap); + db_query("INSERT INTO {system} (name, info, type, filename, status, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d)", $file->name, serialize($files[$filename]->info), 'module', $file->filename, 0, $bootstrap); } } $files = _module_build_dependencies($files); @@ -289,7 +282,7 @@ function module_enable($module_list) { $existing = db_fetch_object(db_query("SELECT status FROM {system} WHERE type = '%s' AND name = '%s'", 'module', $module)); if ($existing->status == 0) { module_load_install($module); - db_query("UPDATE {system} SET status = %d, throttle = %d WHERE type = '%s' AND name = '%s'", 1, 0, 'module', $module); + db_query("UPDATE {system} SET status = %d WHERE type = '%s' AND name = '%s'", 1, 'module', $module); drupal_load('module', $module); $invoke_modules[] = $module; } @@ -331,7 +324,7 @@ function module_disable($module_list) { module_load_install($module); module_invoke($module, 'disable'); - db_query("UPDATE {system} SET status = %d, throttle = %d WHERE type = '%s' AND name = '%s'", 0, 0, 'module', $module); + db_query("UPDATE {system} SET status = %d WHERE type = '%s' AND name = '%s'", 0, 'module', $module); $invoke_modules[] = $module; } } diff --git a/includes/session.inc b/includes/session.inc index 25d2479d4ab..b3ef15c3c80 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -68,7 +68,7 @@ function sess_write($key, $value) { // Only save session data when when the browser sends a cookie. This keeps // crawlers out of session table. This reduces memory and server load, // and gives more useful statistics. We can't eliminate anonymous session - // table rows without breaking throttle module and "Who's Online" block. + // table rows without breaking "Who's Online" block. if ($user->uid || $value || count($_COOKIE)) { db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : '', ip_address(), $value, time()); } diff --git a/modules/block/block-admin-display-form.tpl.php b/modules/block/block-admin-display-form.tpl.php index 369d0934630..5e45ca3f342 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 @@
' . t('When working with blocks, remember that:') . '
'; $output .= '' . t('For more information, see the online handbook entry for Block module.', array('@block' => 'http://drupal.org/handbook/modules/block/')) . '
'; return $output; case 'admin/build/block': - $throttle = module_exists('throttle'); $output = '' . 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 Block 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 Save blocks button at the bottom of the page.') . '
'; - if ($throttle) { - $output .= '' . t('To reduce CPU usage, database traffic or bandwidth, blocks may be automatically disabled during high server loads by selecting their Throttle checkbox. Adjust throttle thresholds on the throttle configuration page.', array('@throttleconfig' => url('admin/settings/throttle'))) . '
'; - } $output .= '' . t('Click the configure link next to each block to configure its specific title and visibility settings. Use the add block page to create a custom block.', array('@add-block' => url('admin/build/block/add'))) . '
'; 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 3f43406b340..fcf99076599 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 8c9d0aa0ebf..c92ac2acb8f 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 a8aa9d92767..6d9625774c6 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', @@ -2852,6 +2845,21 @@ function system_update_7004(&$sandbox) { return $ret; } +/** + * 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 432881ef989..52c183a5e7d 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 '' . 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.') . '
'; case 'admin/build/modules': - $output = '' . t('Modules are plugins that extend Drupal\'s core functionality. Enable modules by selecting the Enabled checkboxes below and clicking the Save configuration button. Once a module is enabled, new permissions may be available. To reduce server load, modules with their Throttle checkbox selected are temporarily disabled when your site becomes extremely busy. (Note that the Throttle 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 throttle configuration page after having enabled the throttle module.', array('@throttle' => url('admin/settings/throttle'))); - } - $output .= '
'; + $output = '' . t('Modules are plugins that extend Drupal\'s core functionality. Enable modules by selecting the Enabled checkboxes below and clicking the Save configuration button. Once a module is enabled, new permissions may be available.)', array('@permissions' => url('admin/user/permissions'))) . '
'; $output .= '' . t('It is important that update.php is run every time a module is updated to a newer version.', array('@update-php' => $base_url . '/update.php')) . '
'; $output .= '' . t('You can find all administration tasks belonging to a particular module on the administration by module page.', array('@by-module' => url('admin/by-module'))) . '
'; $output .= '' . t('To extend the functionality of your site, a number of contributed modules are available.', array('@modules' => 'http://drupal.org/project/modules')) . '
'; @@ -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']); } } }