RAN1 has uploaded a new change for review. https://gerrit.wikimedia.org/r/70029
Change subject: Update twitteroauth files to fix for Twitter API v1.1 ...................................................................... Update twitteroauth files to fix for Twitter API v1.1 Recently Twitter discontinued version 1.0 of its API in favor of version 1.1. This commit introduces the patches made at https://github.com/abraham/twitteroauth to allow tweeting again. However, there is still a bug currently that prevents getting the Twitter timeline, also preventing the deletion of tweets made. This should be looked into relatively soon, but I'm posting this patch so we can at least get partial functionality back up. Change-Id: Ie7f2aa7a5875c1e9636f40156d314d6d4c420d0e --- M includes/OAuth.php M includes/TWITTEROAUTH-LICENSE M includes/twitteroauth.php 3 files changed, 22 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommunityTwitter refs/changes/29/70029/1 diff --git a/includes/OAuth.php b/includes/OAuth.php index 22f8816..4570013 100644 --- a/includes/OAuth.php +++ b/includes/OAuth.php @@ -3,8 +3,10 @@ /* Generic exception class */ -class OAuthException extends Exception { - // pass +if (!class_exists('OAuthException')) { + class OAuthException extends Exception { + // pass + } } class OAuthConsumer { @@ -90,9 +92,9 @@ } /** - * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] - * where the Signature Base String is the text and the key is the concatenated values (each first - * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&' + * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] + * where the Signature Base String is the text and the key is the concatenated values (each first + * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&' * character (ASCII code 38) even if empty. * - Chapter 9.2 ("HMAC-SHA1") */ @@ -118,7 +120,7 @@ } /** - * The PLAINTEXT method does not provide any security protection and SHOULD only be used + * The PLAINTEXT method does not provide any security protection and SHOULD only be used * over a secure channel such as HTTPS. It does not use the Signature Base String. * - Chapter 9.4 ("PLAINTEXT") */ @@ -128,8 +130,8 @@ } /** - * oauth_signature is set to the concatenated encoded values of the Consumer Secret and - * Token Secret, separated by a '&' character (ASCII code 38), even if either secret is + * oauth_signature is set to the concatenated encoded values of the Consumer Secret and + * Token Secret, separated by a '&' character (ASCII code 38), even if either secret is * empty. The result MUST be encoded again. * - Chapter 9.4.1 ("Generating Signatures") * @@ -151,10 +153,10 @@ } /** - * The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in - * [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for - * EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a - * verified way to the Service Provider, in a manner which is beyond the scope of this + * The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in + * [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for + * EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a + * verified way to the Service Provider, in a manner which is beyond the scope of this * specification. * - Chapter 9.3 ("RSA-SHA1") */ @@ -556,7 +558,7 @@ private function get_version(&$request) { $version = $request->get_parameter("oauth_version"); if (!$version) { - // Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present. + // Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present. // Chapter 7.0 ("Accessing Protected Ressources") $version = '1.0'; } @@ -656,7 +658,7 @@ throw new OAuthException( 'Missing timestamp parameter. The parameter is required' ); - + // verify that timestamp is recentish $now = time(); if (abs($now - $timestamp) > $this->timestamp_threshold) { diff --git a/includes/TWITTEROAUTH-LICENSE b/includes/TWITTEROAUTH-LICENSE index e60f470..3a631e0 100644 --- a/includes/TWITTEROAUTH-LICENSE +++ b/includes/TWITTEROAUTH-LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 Abraham Williams - http://abrah.am - abra...@poseurte.ch +Copyright (c) 2009 Abraham Williams - http://abrah.am - abra...@abrah.am Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/includes/twitteroauth.php b/includes/twitteroauth.php index 1603ed3..3fb5052 100644 --- a/includes/twitteroauth.php +++ b/includes/twitteroauth.php @@ -18,11 +18,11 @@ /* Contains the last API call. */ public $url; /* Set up the API root URL. */ - public $host = "https://api.twitter.com/1/"; + public $host = "https://api.twitter.com/1.1/"; /* Set timeout default. */ public $timeout = 30; /* Set connect timeout. */ - public $connecttimeout = 30; + public $connecttimeout = 30; /* Verify SSL Cert. */ public $ssl_verifypeer = FALSE; /* Respons format. */ @@ -74,7 +74,7 @@ */ function getRequestToken($oauth_callback) { $parameters = array(); - $parameters['oauth_callback'] = $oauth_callback; + $parameters['oauth_callback'] = $oauth_callback; $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters); $token = OAuthUtil::parse_parameters($request); $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); @@ -123,7 +123,7 @@ * "user_id" => "9436992", * "screen_name" => "abraham", * "x_auth_expires" => "0") - */ + */ function getXAuthToken($username, $password) { $parameters = array(); $parameters['x_auth_username'] = $username; @@ -145,7 +145,7 @@ } return $response; } - + /** * POST wrapper for oAuthRequest. */ -- To view, visit https://gerrit.wikimedia.org/r/70029 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie7f2aa7a5875c1e9636f40156d314d6d4c420d0e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CommunityTwitter Gerrit-Branch: master Gerrit-Owner: RAN1 <r...@fastlizard4.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits