From a135fa4471085654e56c5de3e2550a8bd28f32fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Bru=CC=88cke?= Date: Thu, 16 Jul 2015 12:26:37 +0200 Subject: [PATCH] Issue #2534412 by Blackice2999: Remove D7 way function of calling l() and watchdog() --- src/Authentication/Provider/OAuthDrupalProvider.php | 5 +++-- src/Controller/OAuthController.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Authentication/Provider/OAuthDrupalProvider.php b/src/Authentication/Provider/OAuthDrupalProvider.php index 9be22ef..4219ae3 100644 --- a/src/Authentication/Provider/OAuthDrupalProvider.php +++ b/src/Authentication/Provider/OAuthDrupalProvider.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use \OauthProvider; use \OauthException; +use Drupal\user\Entity\User; /** * Oauth authentication provider. @@ -53,7 +54,7 @@ class OAuthDrupalProvider implements AuthenticationProviderInterface { } catch (OAuthException $e) { // The OAuth extension throws an alert when there is something wrong // with the request (ie. the consumer key is invalid). - watchdog('oauth', $e->getMessage(), array(), WATCHDOG_WARNING); + \Drupal::logger('oauth')->warning($e->getMessage()); return NULL; } @@ -94,7 +95,7 @@ class OAuthDrupalProvider implements AuthenticationProviderInterface { array(':consumer_key' => $provider->consumer_key))->fetchObject(); if (!empty($row)) { $provider->consumer_secret = $row->consumer_secret; - $this->user = user_load($row->uid); + $this->user = User::load($row->uid); return OAUTH_OK; } else { diff --git a/src/Controller/OAuthController.php b/src/Controller/OAuthController.php index ab3efe6..fdb4040 100644 --- a/src/Controller/OAuthController.php +++ b/src/Controller/OAuthController.php @@ -10,6 +10,7 @@ namespace Drupal\oauth\Controller; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\user\UserInterface; +use Drupal\Core\Url; use Drupal\oauth\Form\OAuthDeleteConsumerForm; /** @@ -43,7 +44,7 @@ class OAuthController implements ContainerInjectionInterface { $request = \Drupal::request(); $list = array(); - $list['heading']['#markup'] = l(t('Add consumer'), 'oauth/consumer/add'); + $list['heading']['#markup'] = \Drupal::l(t('Add consumer'), Url::fromRoute('oauth.user_consumer_add')); // Get the list of consumers. $result = db_query('select * -- 2.2.1