diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 534b647..dfe76d6 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -559,7 +559,7 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) { * return the expected values. * * Most other parameters do not need to be passed in, but may be necessary in - * some cases; for example, if Drupal::service('request')->getClientIP() + * some cases; for example, if Drupal::request()->getClientIP() * needs to return anything but the standard localhost value ('127.0.0.1'), * the command line script should pass in the desired value via the * 'REMOTE_ADDR' key. @@ -1791,8 +1791,8 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG 'uid' => $user_uid, 'request_uri' => $base_root . request_uri(), 'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', - 'ip' => Drupal::service('request')->getClientIP(), - // Request time isn't accurate for long processes, use time() instead. + 'ip' => Drupal::request()->getClientIP(), + // Request time isn(t accurate for long processes, use time() instead. 'timestamp' => time(), ); @@ -2055,7 +2055,7 @@ function drupal_hash_base64($data) { function drupal_anonymous_user() { $values = array( 'uid' => 0, - 'hostname' => Drupal::service('request')->getClientIP(), + 'hostname' => Drupal::request()->getClientIP(), 'roles' => array( DRUPAL_ANONYMOUS_RID => DRUPAL_ANONYMOUS_RID, ), diff --git a/core/includes/session.inc b/core/includes/session.inc index 5c09535..937b0f2 100644 --- a/core/includes/session.inc +++ b/core/includes/session.inc @@ -173,7 +173,7 @@ function _drupal_session_write($sid, $value) { // Either ssid or sid or both will be added from $key below. $fields = array( 'uid' => $user->uid, - 'hostname' => Drupal::service('request')->getClientIP(), + 'hostname' => Drupal::request()->getClientIP(), 'session' => $value, 'timestamp' => REQUEST_TIME, ); diff --git a/core/modules/action/tests/action_loop_test/action_loop_test.module b/core/modules/action/tests/action_loop_test/action_loop_test.module index dfc5226..36f6d9b 100644 --- a/core/modules/action/tests/action_loop_test/action_loop_test.module +++ b/core/modules/action/tests/action_loop_test/action_loop_test.module @@ -69,7 +69,7 @@ function watchdog_skip_semaphore($type, $message, $variables = array(), $severit 'uid' => isset($user->uid) ? $user->uid : 0, 'request_uri' => $base_root . request_uri(), 'referer' => $_SERVER['HTTP_REFERER'], - 'ip' => Drupal::service('request')->getClientIP(), + 'ip' => Drupal::request()->getClientIP(), 'timestamp' => REQUEST_TIME, ); diff --git a/core/modules/ban/ban.admin.inc b/core/modules/ban/ban.admin.inc index 6def75e..9f20a45 100644 --- a/core/modules/ban/ban.admin.inc +++ b/core/modules/ban/ban.admin.inc @@ -85,7 +85,7 @@ function ban_ip_form_validate($form, &$form_state) { if (db_query("SELECT * FROM {ban_ip} WHERE ip = :ip", array(':ip' => $ip))->fetchField()) { form_set_error('ip', t('This IP address is already banned.')); } - elseif ($ip == Drupal::service('request')->getClientIP()) { + elseif ($ip == Drupal::request()->getClientIP()) { form_set_error('ip', t('You may not ban your own IP address.')); } elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) == FALSE) { diff --git a/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php b/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php index b058f11..8009de3 100644 --- a/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php +++ b/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php @@ -78,7 +78,7 @@ function testIPAddressValidation() { // manually. // TODO: On some systems this test fails due to a bug/inconsistency in cURL. // $edit = array(); - // $edit['ip'] = \Drupal::service('request')->getClientIP(); + // $edit['ip'] = \Drupal::request()->getClientIP(); // $this->drupalPost('admin/config/people/ban', $edit, t('Save')); // $this->assertText(t('You may not ban your own IP address.')); } diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index aa7df09..c005cb0 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -153,7 +153,7 @@ protected function preSave(EntityInterface $comment) { } // Add the values which aren't passed into the function. $comment->thread->value = $thread; - $comment->hostname->value = \Drupal::service('request')->getClientIP(); + $comment->hostname->value = \Drupal::request()->getClientIP(); } } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index 1edce50..5585650 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -145,7 +145,7 @@ function setEnvironment(array $info) { 'uid' => 0, 'status' => COMMENT_PUBLISHED, 'subject' => $this->randomName(), - 'hostname' => \Drupal::service('request')->getClientIP(), + 'hostname' => '127.0.0.1', 'langcode' => LANGUAGE_NOT_SPECIFIED, 'comment_body' => array(LANGUAGE_NOT_SPECIFIED => array($this->randomName())), )); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php index 6d36525..818227e 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php @@ -52,7 +52,7 @@ public function testCommentNewCommentsIndicator() { 'uid' => $this->loggedInUser->uid, 'status' => COMMENT_PUBLISHED, 'subject' => $this->randomName(), - 'hostname' => \Drupal::service('request')->getClientIP(), + 'hostname' => '127.0.0.1', 'langcode' => LANGUAGE_NOT_SPECIFIED, 'comment_body' => array(LANGUAGE_NOT_SPECIFIED => array($this->randomName())), )); diff --git a/core/modules/config/config.admin.inc b/core/modules/config/config.admin.inc index e81c582..51e5f8e 100644 --- a/core/modules/config/config.admin.inc +++ b/core/modules/config/config.admin.inc @@ -182,8 +182,8 @@ function config_admin_diff_page($config_file) { // Return AJAX requests as a dialog. // @todo: Set up separate content callbacks for the non-JS and dialog versions - // of this page using the router system. See http://drupal.org/node/1944472. - if (Drupal::service('request')->isXmlHttpRequest()) { + // of this page using the router system. See http://drupal.org/node/1944472. + if (Drupal::request()->isXmlHttpRequest()) { // Add class to the close link. $output['back']['#attributes']['class'][] = 'dialog-cancel'; diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php index 17df6a1..9fcc1ee 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php +++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DBLogTest.php @@ -137,7 +137,7 @@ private function generateLogEntries($count, $type = 'custom', $severity = WATCHD 'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0, 'request_uri' => $base_root . request_uri(), 'referer' => $_SERVER['HTTP_REFERER'], - 'ip' => \Drupal::service('request')->getClientIP(), + 'ip' => '127.0.0.1', 'timestamp' => REQUEST_TIME, ); $message = 'Log entry added to test the dblog row limit. Entry #'; @@ -424,7 +424,7 @@ protected function testDBLogAddAndClear() { 'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0, 'request_uri' => $base_root . request_uri(), 'referer' => $_SERVER['HTTP_REFERER'], - 'ip' => \Drupal::service('request')->getClientIP(), + 'ip' => '127.0.0.1', 'timestamp' => REQUEST_TIME, ); // Add a watchdog entry. diff --git a/core/modules/openid/openid.module b/core/modules/openid/openid.module index b23473b..79858fd 100644 --- a/core/modules/openid/openid.module +++ b/core/modules/openid/openid.module @@ -1066,7 +1066,7 @@ function openid_verify_assertion_nonce($service, $response) { return TRUE; } else { - watchdog('openid', 'Nonce replay attempt blocked from @ip, nonce: @nonce.', array('@ip' => Drupal::service('request')->getClientIP(), '@nonce' => $response['openid.response_nonce']), WATCHDOG_CRITICAL); + watchdog('openid', 'Nonce replay attempt blocked from @ip, nonce: @nonce.', array('@ip' => Drupal::request()->getClientIP(), '@nonce' => $response['openid.response_nonce']), WATCHDOG_CRITICAL); return FALSE; } } diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 200ac00..f2654b0 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1324,7 +1324,7 @@ function user_login_authenticate_validate($form, &$form_state) { // The default identifier is a combination of uid and IP address. This // is less secure but more resistant to denial-of-service attacks that // could lock out all users with public user names. - $identifier = $account->uid . '-' . Drupal::service('request')->getClientIP(); + $identifier = $account->uid . '-' . Drupal::request()->getClientIP(); } $form_state['flood_control_user_identifier'] = $identifier; diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index a660b0d..2239431 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -724,7 +724,7 @@ public function renderDisplayTop(ViewUI $view) { * should not yet redirect to the destination. */ public function submitDelayDestination($form, &$form_state) { - $query = \Drupal::service('request')->query; + $query = \Drupal::request()->query; // @todo: Revisit this when http://drupal.org/node/1668866 is in. $destination = $query->get('destination'); if (isset($destination) && $form_state['redirect'] !== FALSE) {