Index: modules/statistics/statistics.test =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.test,v retrieving revision 1.6 diff -u -r1.6 statistics.test --- modules/statistics/statistics.test 30 Dec 2008 16:43:18 -0000 1.6 +++ modules/statistics/statistics.test 21 Feb 2009 16:41:05 -0000 @@ -43,7 +43,7 @@ $edit = array(); $edit['ip'] = $test_ip_address; $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save')); - $ip = db_result(db_query("SELECT iid from {blocked_ips} WHERE ip = '%s'", $edit['ip'])); + $ip = db_result(db_query("SELECT iid from {blocked_ip} WHERE ip = '%s'", $edit['ip'])); $this->assertNotNull($ip, t('IP address found in database')); $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.18 diff -u -r1.18 statistics.admin.inc --- modules/statistics/statistics.admin.inc 18 Feb 2009 15:19:56 -0000 1.18 +++ modules/statistics/statistics.admin.inc 21 Feb 2009 16:41:05 -0000 @@ -82,7 +82,7 @@ array('data' => user_access('block IP addresses') ? t('Operations') : '', 'colspan' => 2), ); - $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, bl.iid FROM {accesslog} a LEFT JOIN {blocked_ips} bl ON a.hostname = bl.ip LEFT JOIN {user} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, bl.iid" . tablesort_sql($header); + $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, bl.iid FROM {accesslog} a LEFT JOIN {blocked_ip} bl ON a.hostname = bl.ip LEFT JOIN {user} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, bl.iid" . tablesort_sql($header); $sql_cnt = "SELECT COUNT(DISTINCT(CONCAT(CAST(uid AS char), hostname))) FROM {accesslog}"; $result = pager_query($sql, 30, 0, $sql_cnt); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.667 diff -u -r1.667 system.module --- modules/system/system.module 11 Feb 2009 05:33:18 -0000 1.667 +++ modules/system/system.module 21 Feb 2009 16:41:08 -0000 @@ -765,7 +765,7 @@ * The blocked IP address from the database as an array. */ function blocked_ip_load($iid) { - $blocked_ip = db_fetch_array(db_query("SELECT * FROM {blocked_ips} WHERE iid = %d", $iid)); + $blocked_ip = db_fetch_array(db_query("SELECT * FROM {blocked_ip} WHERE iid = %d", $iid)); return $blocked_ip; } @@ -2180,7 +2180,7 @@ */ function system_block_ip_action() { $ip = ip_address(); - db_query("INSERT INTO {blocked_ips} (ip) VALUES ('%s')", $ip); + db_query("INSERT INTO {blocked_ip} (ip) VALUES ('%s')", $ip); watchdog('action', 'Banned IP address %ip', array('%ip' => $ip)); } Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.127 diff -u -r1.127 system.admin.inc --- modules/system/system.admin.inc 18 Feb 2009 15:19:56 -0000 1.127 +++ modules/system/system.admin.inc 21 Feb 2009 16:41:06 -0000 @@ -1084,7 +1084,7 @@ $output = ''; $rows = array(); $header = array(t('IP address'), t('Operations')); - $result = db_query('SELECT * FROM {blocked_ips}'); + $result = db_query('SELECT * FROM {blocked_ip}'); while ($ip = db_fetch_object($result)) { $rows[] = array( $ip->ip, @@ -1126,7 +1126,7 @@ function system_ip_blocking_form_validate($form, &$form_state) { $ip = trim($form_state['values']['ip']); - if (db_result(db_query("SELECT * FROM {blocked_ips} WHERE ip = '%s'", $ip))) { + if (db_result(db_query("SELECT * FROM {blocked_ip} WHERE ip = '%s'", $ip))) { form_set_error('ip', t('This IP address is already blocked.')); } elseif ($ip == ip_address()) { @@ -1139,7 +1139,7 @@ function system_ip_blocking_form_submit($form, &$form_state) { $ip = trim($form_state['values']['ip']); - db_query("INSERT INTO {blocked_ips} (ip) VALUES ('%s')", $ip); + db_query("INSERT INTO {blocked_ip} (ip) VALUES ('%s')", $ip); drupal_set_message(t('The IP address %ip has been blocked.', array('%ip' => $ip))); $form_state['redirect'] = 'admin/settings/ip-blocking'; return; @@ -1163,7 +1163,7 @@ */ function system_ip_blocking_delete_submit($form, &$form_state) { $blocked_ip = $form_state['values']['blocked_ip']; - db_query("DELETE FROM {blocked_ips} WHERE iid = %d", $blocked_ip['iid']); + db_query("DELETE FROM {blocked_ip} WHERE iid = %d", $blocked_ip['iid']); watchdog('user', 'Deleted %ip', array('%ip' => $blocked_ip['ip'])); drupal_set_message(t('The IP address %ip was deleted.', array('%ip' => $blocked_ip['ip']))); $form_state['redirect'] = 'admin/settings/ip-blocking'; Index: modules/system/system.test =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.test,v retrieving revision 1.39 diff -u -r1.39 system.test --- modules/system/system.test 11 Feb 2009 05:33:18 -0000 1.39 +++ modules/system/system.test 21 Feb 2009 16:41:09 -0000 @@ -213,7 +213,7 @@ $edit = array(); $edit['ip'] = '192.168.1.1'; $this->drupalPost('admin/settings/ip-blocking', $edit, t('Save')); - $ip = db_result(db_query("SELECT iid from {blocked_ips} WHERE ip = '%s'", $edit['ip'])); + $ip = db_result(db_query("SELECT iid from {blocked_ip} WHERE ip = '%s'", $edit['ip'])); $this->assertNotNull($ip, t('IP address found in database')); $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.308 diff -u -r1.308 system.install --- modules/system/system.install 18 Feb 2009 15:19:56 -0000 1.308 +++ modules/system/system.install 21 Feb 2009 16:41:08 -0000 @@ -519,7 +519,7 @@ ), ); - $schema['blocked_ips'] = array( + $schema['blocked_ip'] = array( 'description' => 'Stores blocked IP addresses.', 'fields' => array( 'iid' => array( @@ -3225,6 +3225,18 @@ return $ret; } + /** + * Rename table {blocked_ips} to {blocked_ip}. + */ +function system_update_7020() { + $ret = array(); + + db_rename_table($ret, 'blocked_ips', 'blocked_ip'); + + return $ret; +} + + /** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.274 diff -u -r1.274 update.php --- update.php 20 Feb 2009 07:14:42 -0000 1.274 +++ update.php 21 Feb 2009 16:41:05 -0000 @@ -593,7 +593,7 @@ spl_autoload_unregister('drupal_autoload_class'); spl_autoload_unregister('drupal_autoload_interface'); update_prepare_d7_bootstrap_rename(); - // The new {blocked_ips} table is used in Drupal 7 to store a list of + // The new {blocked_ip} table is used in Drupal 7 to store a list of // banned IP addresses. If this table doesn't exist then we are still // running on a Drupal 6 database, so suppress the unavoidable errors // that occur. @@ -601,7 +601,7 @@ drupal_bootstrap(DRUPAL_BOOTSTRAP_ACCESS); } catch (Exception $e) { - if (db_table_exists('blocked_ips')) { + if (db_table_exists('blocked_ip')) { throw $e; } } Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.269 diff -u -r1.269 bootstrap.inc --- includes/bootstrap.inc 31 Jan 2009 16:50:56 -0000 1.269 +++ includes/bootstrap.inc 21 Feb 2009 16:41:05 -0000 @@ -1051,7 +1051,7 @@ return in_array($ip, $blocked_ips); } else { - return (bool)db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchField(); + return (bool)db_query("SELECT 1 FROM {blocked_ip} WHERE ip = :ip", array(':ip' => $ip))->fetchField(); } } Index: sites/default/default.settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/default.settings.php,v retrieving revision 1.19 diff -u -r1.19 default.settings.php --- sites/default/default.settings.php 18 Feb 2009 15:19:57 -0000 1.19 +++ sites/default/default.settings.php 21 Feb 2009 16:41:09 -0000 @@ -294,7 +294,7 @@ * IP blocking: * * To bypass database queries for denied IP addresses, use this setting. - * Drupal queries the {blocked_ips} table by default on every page request + * Drupal queries the {blocked_ip} table by default on every page request * for both authenticated and anonymous users. This allows the system to * block IP addresses from within the administrative interface and before any * modules are loaded. However on high traffic websites you may want to avoid