Changeset 9365
- Timestamp:
- 12/19/2019 08:21:26 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php
r9340 r9365 39 39 40 40 /** 41 * Find a WordPress.org user by a Github login. 42 */ 43 function find_wporg_user_by_github( $github_user ) { 44 global $wpdb; 45 46 return $wpdb->get_var( $wpdb->prepare( 47 "SELECT u.user_login 48 FROM {$wpdb->base_prefix}github_users g 49 JOIN {$wpdb->users} u ON g.user_id = u.ID 50 WHERE g.github_user = %s", 51 $github_user 52 ) ); 53 } 54 55 /** 41 56 * A simple wrapper to make a Github API request.. 42 57 */ … … 47 62 } 48 63 49 $context = stream_context_create( $c =[ 'http' => [64 $context = stream_context_create( [ 'http' => [ 50 65 'method' => $method ?: ( is_null( $args ) ? 'GET' : 'POST' ), 51 66 'user_agent' => 'WordPress.org Trac; trac.WordPress.org', … … 53 68 'timeout' => 5, 54 69 'ignore_errors' => true, 55 'header s'=> array_merge(70 'header' => array_merge( 56 71 [ 57 'Accept ' => 'application/json',58 'Authorization ' =>get_authorization_token(),72 'Accept: application/json', 73 'Authorization: ' . get_authorization_token(), 59 74 ], 60 75 $headers 61 76 ), 62 ' body'=> $args ?: null,77 'content' => $args ?: null, 63 78 ] ] ); 64 79 … … 75 90 function get_authorization_token() { 76 91 global $wpdb; 77 92 78 93 // TODO: This needs to be switched to a Github App token. 79 94 // This works temporarily to avoid the low unauthenticated limits.
Note: See TracChangeset
for help on using the changeset viewer.