Index: /sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php
===================================================================
--- /sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php (revision 9371)
+++ /sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php (revision 9372)
@@ -144,2 +144,10 @@
}
+/**
+ * Returns a instance of the Trac class for a given trac.
+ */
+function get_trac_instance( $trac ) {
+ $trac_uri = 'https://' . $trac . '.trac.wordpress.org/login/rpc';
+
+ return new Trac( GH_PRBOT_USER, GH_PRBOT_PASS, $trac_uri );
+}
Index: /sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php
===================================================================
--- /sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php (revision 9371)
+++ /sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php (revision 9372)
@@ -77,6 +77,5 @@
// Add a mention to the Trac Ticket.
- $trac_uri = 'https://' . $pr_data->trac_ticket[0] . '.trac.wordpress.org/login/rpc';
- $trac = new Trac( GH_PRBOT_USER, GH_PRBOT_PASS, $trac_uri );
+ $trac = get_trac_instance( $pr_data->trac_ticket[0] );
$trac->update(