Jump to content

Working extension for Bugzilla 4.4.1

Joshua Palmer

Recommended Posts

Hey folks,

We use Bugzilla 4.4.1 over here, so I went ahead and got the bugzilla extension up and running for that version at least. I've attached the working 'plastic.cgi' to this post. Details on changes are listed below. Please read the first item on the "XML::Simple" perl module at least, as it may require you to do more than just download the updated cgi. On a side note, it looks like "sub markasopened" still needs some help, as I didn't see this working...though I currently have no need for it so I haven't spent any time on it.

I believe I saw the source for the extension's client side library somewhere on these forums, so I may grab that and start fiddling soon. It would be useful to us to be able to select a product or at least sort by product in the "Create a new child branch from task" window.

Missing perl module
Initially, the extension (via the Plastic SCM GUI) was complaining that it couldn't connect to my Bugzilla instance. Monitoring the apache logs on the Bugzilla server revealed that I didn't have the required "XML::Simple" perl module installed. Make sure you do that! This immediately solved my connection error and allowed Plastic SCM to communicate with the Bugzilla server. A more motivated person could have plastic.cgi install this module automatically if not found.
While the extension was now able to connect to Bugzilla, it still wasn't displaying anything in the Plastic client, so more was needed.

plastic.cgi changes:
1. Make sure the "@allowed_statuses" array (defined at line #49) contains statuses that are valid to your Bugzilla configuration. We had a few custom ones.

2. The "@selectedcolumns" array contained an invalid column name according to Bugzilla 4.4.1: "short_short_desc". I changed this to "short_desc". This is the title/summary of the bug report.

3. The Bugzilla db query at line #116 doesn't account for the user's security groups. If you're using these in Bugzilla, the query will come back empty, preventing pending tasks from populating when creating a new branch through "Create a new child branch from task". I've added a new argument to the Search function here, "'_no_security_check' => 1", to bypass security groups. If you're uncomfortable with this, you could instead define "my $bugzilla_user = Bugzilla::User->new({name => $user});", then pass " 'user' => $bugzilla_user " into the Search function to prompt Bugzilla to search using the user's security groups. I didn't do this because it only worked when populating pending tasks assigned to the user. Checking the "Display pending tasks from all users" checkbox continued to trigger queries that didn't use the user's security group, returning empty. If anyone can figure out why, please let me know!

4. Bugzilla 4.4.1 uses "Bugzilla::Bug->comments" to store all comments and the bug description, instead of "Bugzilla::Bug->longdesc". That case is handled at line #200, but assumes first-in-last-out. It appears Bugzilla 4.4.1 uses first-in-first-out here, so I changed the reference "$bug->comments->[0]{'thetext'}" to "$bug->comments->[-1]{'thetext'}" on line #200.


  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...