WordPress.org

Making WordPress.org

Changeset 9372


Ignore:
Timestamp:
12/20/2019 08:32:47 AM (3 months ago)
Author:
dd32
Message:

Trac: Github PRs: Add a wrapper for the Trac class for easier testing.

See #4903.

Location:
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php

    r9371 r9372  
    144144}
    145145
     146/**
     147 * Returns a instance of the Trac class for a given trac.
     148 */
     149function get_trac_instance( $trac ) {
     150    $trac_uri = 'https://' . $trac . '.trac.wordpress.org/login/rpc';
     151
     152    return new Trac( GH_PRBOT_USER, GH_PRBOT_PASS, $trac_uri );
     153}
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php

    r9366 r9372  
    7777
    7878            // Add a mention to the Trac Ticket.
    79             $trac_uri = 'https://' . $pr_data->trac_ticket[0] . '.trac.wordpress.org/login/rpc';
    80             $trac = new Trac( GH_PRBOT_USER, GH_PRBOT_PASS, $trac_uri );
     79            $trac = get_trac_instance( $pr_data->trac_ticket[0] );
    8180
    8281            $trac->update(
Note: See TracChangeset for help on using the changeset viewer.