Changeset 10410
- Timestamp:
- 10/27/2020 02:41:36 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php
r10243 r10410 1 1 <?php 2 use WordPressdotorg\Theme_Directory\Lib\GitHub; 2 3 3 4 /** … … 323 324 324 325 do_action( 'theme_upload', $this->theme, $this->theme_post ); 326 327 // Initiate a GitHub actions run for the theme. 328 $this->trigger_e2e_run( $ticket_id ); 325 329 326 330 // Success! … … 948 952 } 949 953 954 /** 955 * Triggers a GitHub actions run for the upload. 956 */ 957 public function trigger_e2e_run( $ticket_id ) { 958 $api = GitHub::api( 959 '/repos/' . WPORG_THEMES_E2E_REPO . '/dispatches', 960 json_encode([ 961 'event_type' => $this->theme->display( 'Name' ), 962 'client_payload' => [ 963 'theme_slug' => $this->theme_slug, 964 'theme_zip' => "https://wordpress.org/themes/download/{$this->theme_slug}.{$this->theme->display( 'Version' )}.zip?nostats=1", 965 'accessible_ready' => in_array( 'accessibility-ready', $this->theme->get( 'Tags' ) ), 966 'trac_ticket_id' => $ticket_id, 967 ], 968 ]) 969 ); 970 971 // Upon failure a message is returned, success returns nothing. 972 return empty( $api ); 973 } 974 950 975 // Helper 951 976 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/lib/class-github.php
r10409 r10410 1 1 <?php 2 namespace WordPressdotorg\ Plugin_Directory\Clients;2 namespace WordPressdotorg\Theme_Directory\Lib; 3 3 use Ahc\Jwt\JWT; 4 4 5 5 /** 6 * Simple GitHub client.6 * Simple GitHub API client. 7 7 * 8 * @package WordPressdotorg\ Plugin_Directory\Clients8 * @package WordPressdotorg\Theme_Directory 9 9 */ 10 10 class GitHub { … … 12 12 public static function api( $url, $args = null, $headers = [], $method = null ) { 13 13 // Verify the configuration variables are available. 14 // This re-uses the Plugin Directory constants deliberately. 14 15 if ( ! defined( 'PLUGIN_GITHUB_APP_ID' ) || ! defined( 'PLUGIN_GITHUB_APP_PRIV_KEY' ) ) { 15 16 return false; … … 20 21 $url = 'https://api.github.com' . $url; 21 22 } 22 23 23 24 $request = wp_remote_request( 24 25 $url, … … 105 106 // This should be replaced with an Autoloader. 106 107 if ( ! class_exists( 'Ahc\Jwt\JWT' ) ) { 107 require_once dirname( __DIR__ ) . '/libs/adhocore-php-jwt/JWTException.php';108 require_once dirname( __DIR__ ) . '/libs/adhocore-php-jwt/ValidatesJWT.php';109 require_once dirname( __DIR__ ) . '/libs/adhocore-php-jwt/JWT.php';108 require_once __DIR__ . '/adhocore-php-jwt/JWTException.php'; 109 require_once __DIR__ . '/adhocore-php-jwt/ValidatesJWT.php'; 110 require_once __DIR__ . '/adhocore-php-jwt/JWT.php'; 110 111 } 111 112 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r10311 r10410 35 35 new WordPressdotorg\Theme_Directory\Jobs\Manager(); 36 36 37 // Load the GitHub API client. 38 include __DIR__ . '/lib/class-github.php'; 39 37 40 define( 'WPORG_THEMES_DEFAULT_BROWSE', 'popular' ); 41 42 define( 'WPORG_THEMES_E2E_REPO', 'WordPress/theme-review-e2e' ); 38 43 39 44 /**
Note: See TracChangeset
for help on using the changeset viewer.