Extension talk:Bugzilla Reports

From MediaWiki.org
Jump to navigation Jump to search

BugzillaReports is a wonderful extension that does exactly what it says on the tin, and does it really well! Our organization have been using this extension since its release and we find it invaluable. Nice one Ian!

Geoff Parkes, Vet-One.co.uk, 2008

ExtensionDistributor[edit]

Currently, Bugzilla Reports isn't listed in Special:ExtensionDistributor. Could it be added? --Catrope 16:48, 15 July 2008 (UTC)

Sure, but I'm not sure how that list of extensions gets generated. Do you know if it's driven from the main MediaWiki SVN repository? --Ian Homer 21:26, 16 July 2008 (UTC)

Using same bz db connection as mediawiki one[edit]

A bug was reported which threw the php exception (not a valid MySQL-Link resource) below. This occurred when you use the same bz db connection as the mediawiki one.

sql_real_escape_string(): 41 is not a valid MySQL-Link resource

This has been fixed and will be released in v0.9.1 (coming very soon) --Ian Homer 08:20, 14 August 2008 (UTC)

Bugzilla 3.2[edit]

Can someone confirm that this still works with bugzilla 3.2?

Yes, it still works with Bugzilla 3.2 Philippe Lambot

Works with 3.6 just fine, thanks bemoko folks! --gvy

Time restriction[edit]

Is there a posibility to restrict the output to the Bugs changed within the last n days? --Joergens.mi 10:56, 9 December 2008 (UTC)

Try "modified=-3d", e.g.

{{#bugzilla:
  |sort=modified
  |order=desc
  |lastcomment=1
  |disablecache=1
  |modified=-3d
}}

--Ian Homer 23:59, 9 December 2008 (UTC)

Bug creation[edit]

Is there a way to get a report of all the bugs created by person X within the last N days?

-- DaveO 2/28/09

Not quite, but you can generate all bugs that were created by person X and which were modified in the last N days - {{#bugzilla:debug=1|from=X@bemoko.com|modified=-3d}}. Not the quite the same thing - although it will include all the bugs in that were created by person X within the last N days, but it may include others. If you feel you need the report for "all bugs created by person X within the last N days" could you raise it @ http://code.google.com/p/bugzillareports/issues/list? --Ian Homer 18:38, 1 March 2009 (UTC)
You can now do this in v1.1 (beta) - e.g. {{#bugzilla:created=2009-05-01:2009-05-31|from=me@host.com}} --Ian Homer 13:36, 24 June 2009 (UTC)

Testopia[edit]

It would be nice to integrate this extension with the Bugzilla addon Testopia --189.128.39.211 19:12, 28 March 2009 (UTC)

Sounds an interesting idea - bugzilla reports is now in google code @ http://code.google.com/p/bugzillareports/issues/list - could you raise this in that list and put a few more details around what you'd like to see. If you have skills in this area, the source is all open and I'd welcome patches to cover new features like this --Ian Homer 20:26, 28 March 2009 (UTC)

Writing number of returned bugs into the variable[edit]

Hello,

Is it possible to write the number of returned bugs (rows) to the variable, e.g. using #vardefine ? Then i'd like to use this variable in #expr.

Thanks

Yes, try the example below (you'll need to take v1.1 beta to get this to work) --Ian Homer 13:30, 24 June 2009 (UTC)
{{#vardefine:totalnew|{{#bugzilla:status=NEW|product=live|hide=true|total=summary|headers=hide|format=inline}}}}
{{#vardefine:totalassigned|{{#bugzilla:status=ASSIGNED|product=live|hide=true|total=summary|headers=hide|format=inline}}}}

{{#var:totalnew}} (NEW) + {{#var:totalassigned}} (ASSIGNED) = {{#expr: {{#var:totalnew}} + {{#var:totalassigned}} }} (NEW and ASSIGNED)


Dynamic Filters to bugs[edit]

hello, is it possible to implement dynamic filters for a table generated using this extension. so that one could drill down based on the requirement. Thank you

Not sure I understand what you mean by dynamic filters. The arguments can be taken from parameters (e.g. product={{{1}}}) or other MediaWiki extensions, (e.g. product={{#var:myvar}}) - is this what you are looking for --Ian Homer 12:22, 1 August 2009 (UTC)

SQL error when using "|closed=[edit]

Hi! I have an error when I'm using |closed=

BugzillaReports : Error running the sql : SELECT DISTINCT bugs.bug_id as id, alias, closedactivity.bug_when as closed, quickflag.flagdate as flagdate, priority, products.name as product, bug_severity as severity, bug_status as status, short_desc as summary, bug_file_loc as url, version FROM bugs LEFT JOIN (SELECT bug_id, MAX(bug_when) as bug_when from bugs_activity where fieldid= and added='CLOSED' GROUP BY bug_id) as closedactivity on bugs.bug_id=closedactivity.bug_id LEFT JOIN (SELECT bug_id as quickflagbugid, MAX(creation_date) as flagdate from flags where status='?' group by quickflagbugid) as quickflag on quickflag.quickflagbugid=bugs.bug_id LEFT JOIN products on bugs.product_id=products.id where 1=1 and closedactivity.bug_when >='2009-07-28' and bug_status<>'CLOSED' order by priority,bug_status ASC; ERROR: syntax error at or near "and" LINE 1: ...en) as bug_when from bugs_activity where fieldid= and added=...

Could you please,help? In this way I wanted to know the number of closed bugs per week. Thank you!

Yep I spotted this the other day and fixed under http://code.google.com/p/bugzillareports/issues/detail?id=33&can=1 - just tested {{#bugzilla:closed=-1m|status=*}} on our local system and it works OK. If you want to pick up the fix for this you'll need to take the release from trunk as described @ http://code.google.com/p/bugzillareports/source/checkout since this fix has not made it into a release yet --Ian Homer 22:33, 4 August 2009 (UTC)


"Warnings Were Generated ... Report Truncated Count Greater than Max", etc...[edit]

We're migrating our bug database from Test Track, and have imported them into bugzilla with hopes of integrating into our in-house wiki. I have created a report which returns only two records (which agrees with Test Track), keeping it simple and specifying only the component name. Works fine until I add 'lastcomment=1', at which point I get the above message and only the first record.

Since I can link to the actual bugzilla listing, losing the details is not a big deal, but the 'hover bubble' is a cool feature and it would be nice to have it working.

I have tried bumping up the $maxrowsFromConfigDefault (to as much as 1000!) but while this allows the report to complete and display both records, I still get the message. These entries have A LOT of text in their description fields, but there are only two actual records. Is this a bug, or just new user error?

A great extension - much simpler than writing out all the queries using SQL2wiki or the like.

Thanks! Mickeyf


Oops - I discovered the 'troubleshooting' section at the bottom of the page. I have pasted the SQL into phpMyAdmin, it does not generate any errors, but does generate 1362 rows. In the log I note that of the 1362 rows generated, apparently two are being pulled out for rendering.

That looks like a bug. The report truncation is designed so that an administrator can put a cap on how big reports can get, but given that you've upped the $maxrowsFromConfigDefault AND that the behaviour only happens when you add "lastcomment=1" then it's clearly not behaving well. It might be that the counting of the numbers of rows is amiss since this may be counting all the rows with all the joins (of which only a couple of rows are relevant for your report). Log it @ http://code.google.com/p/bugzillareports/issues/list and I'll review this area of the code --Ian Homer 22:57, 18 August 2009 (UTC)

Resolution Parameter[edit]

Hi Ian,

In update v0.9.8 - 3rd December 2008 you wrote, that

   * Add support for resolution field, e.g. {{#bugzilla:debug=1|columns=+resolution|resolution=fixed,invalid}}

But when I try using resolution, it returns 0 bugs always. Is it a bug in extension, or I do something wrong?

Thank you, Sergii

Sorry, Ian. I found that resolution fields should be written in capital. Then it works.

Summary Counts[edit]

Hello,

How do I generate a table of bug COUNTS per component for given product? (not a list of bugs but just the counts).

Thanks - Martin

Okay, I think I can answer my own question. After using the canned examples for a while, I came back to this page and paid more attention. Higher up on this page is an example with format=inline. This gives me a number I can use anywhere on the page and format it the way I want. Awesome!

Bugzilla 2.23 support[edit]

Do you have an old version that works for MW 1.15 and Bugzilla 2.23?

No, sorry - only supported on later versions. If you have PHP dev skills you would be able to tweak the code to get support on those versions though ... --Ian Homer 08:06, 8 March 2010 (UTC)

Multiple Bugzilla's[edit]

I would like to use the wiki to report on different bugzilla's. Can I somehow configure bugzillareports to do this?

Thanks a lot for this very nice tool.

plstbb.

The trunk version of this plugin now has support for multiple bugzilla instances thanks to Mark Voelker - check out from http://code.google.com/p/bugzillareports/source/checkout . See http://www.mediawiki.org/wiki/Extension:Bugzilla_Reports#Multiple_Bugzilla_Instances for documentation


I have had trouble getting multiple instances working as described but the following setup does work for me.

in the LocalSettings.php file

$wgBugzillaReports = array(
 'host'        => "myserver.domain.com",
 'database'    => "bugs", 
 'user'        => "bugs", 
 'password'    => "mypassword",
 'bzserver'    => "http://myserver.domain.com/bugzilla/",
      'SecondBZ:host'     => "secondserver.domain.com",
      'SecondBZ:database' => "bugzilla_number_two",
      'SecondBZ:user'     => "bugs", 
      'SecondBZ:password' => "mysecondpassword",
      'SecondBZ:bzserver' => "http://secondserver.domain.com/bugzilla/",
           'ThirdBZ:host'      => "thirdserver.domain.com",
            'ThirdBZ:database' => "bugzilla_number_three",
            'ThirdBZ:user'     => "bugs", 
            'ThirdBZ:password' => "mythirdpassword",
            'ThirdBZ:bzserver' => "http://thirdserver.domain.com/bugzilla/",
);


Wiki page

{{#bugzilla:columns=id,priority,status,to,from,hardware,component,summary
 |status=OPEN,PENDING
 |priority=P1 - blocker,P2 - major
 |sort=priority,id
 |noresultsmessage="No matching bugs found."
 |instance=SecondBZ
}}

column for %Complete[edit]

Can anyone tell me how to add the %complete column?

I have tried

{{#bugzilla:columns=+to,+from,+%complete
  |milestone=rel_4_5_8
  |lastcomment=1
}}

But get error

Warnings were generated during the execution of function

   1. Parameter columns=+to,+from,+%complete is invalid using regex /^[\w,_+-~]*$/


Many thanks --Mark 12:38, 24 March 2010 (UTC)

Extension not running[edit]

  1. Downloaded and installed the extension under /var/lib/mediawiki/extensions/.
  2. Proceeded to modify LocalSettings.php per the installation instructions.
  3. Attempted to test the extension by typing {{#bugzilla:}} in the page editor, but mediawiki failed to interpret the code.

I checked the Special:Version page, and it recognizes that the extension is installed. Any idea what might be wrong?

  • MediaWiki 1.15.1, installed through aptitude on Ubuntu 10.04 LTS.
  • Bugzilla 3.4.2 operating on a separate server, with the bugzilla DB operating on a third server.

Thanks!

Never mind - There was an issue with the BugzillaReports.php file that came with the tarball. Updated it to r58 off google code.
--anonymous 15:19, 10 June 2010 (UTC)

Bugzilla 4.0 - Keywords issue?[edit]

For your information.

I just moved to Bugzilla 4.0 and most reports are OK without any change, except the one where I use "|keywords= ...".

I get:

  • Error running the sql: ... Unknown column 'keywords' in 'field list'

Edit BugzillaQuery.php to update:

if ($this->isRequired("keywords")) {
    $sql.=", keywords";
}

TO:

if ($this->isRequired("keywords")) {
    $sql.=", (SELECT group_concat(keyworddefs.name) FROM bugs.keyworddefs WHERE keyworddefs.id in (SELECT keywords.keywordid FROM bugs.keywords WHERE keywords.bug_id=bugs.bug_id )) as keywords";
}

It may not be the most efficient way of going about it, but it works. -- Steve

Thanks, this worked for me on BugZilla 4.0.1 -- Josh

I also changed the skin a little bit:

I added:

table.bugzilla tr.VERIFIED td { text-decoration: line-through; }

Because the end state is now VERIFIED and no longer CLOSED: see http://www.bugzilla.org/docs/4.0/en/html/lifecycle.html

For those using postgre rather than mysql, the above works with the following SQL:

$sql.=", (SELECT STRING_AGG(keyworddefs.name, ',' ORDER BY keyworddefs.name) FROM keyworddefs WHERE keyworddefs.id in (SELECT keywords.keywordid FROM keywords WHERE keywords.bug_id=bugs.bug_id )) as keywords";

-- Chris

Flag Reports[edit]

I'm looking for some more detail on running reports against bugs that are flagged. In particular if I add a flag and then set that flag on 10 bugs to the "+" value how do I create a report to just display those bugs? Is this possible? I'm not setting these flags as requestable so the "?" value is not being used, only the "-" and "+"

I have same question

Multiple search terms?[edit]

http://www.reactos.org/wiki/Explorer.exe

Is there any way to search for multiple terms in a single table? e.g. "explorer, shell, shell32", and match on any one of them?

For example, this query: http://www.reactos.org/bugzilla/buglist.cgi?query_format=advanced&short_desc_type=anywordssubstr&short_desc=explorer+shell+shell32&product=ReactOS&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=

184.229.55.189 08:29, 5 March 2012 (UTC)

detailsrow not working[edit]

Hi there, has anyone got the detailsrow working.

I have added the following but cannot see the detailsrow, I have tried every permutation I can think of,

  • listing columns in both columns and detailsrow
  • not listing in columns

having a look at BugzillaQuery.php I cannot see the detailsrow being used.

{{#bugzilla:to={{{1}}}
  |columns=+id,+priority,+severity,-version,-product,-component,+summary
  |detailsrowprepend=Details:
  |detailsrow=+product,+component,+deadline,+remaining,+status
  |lastcomment=1
  |noresultsmessage=No Tickets found
  |heading=Working on
  |status=ASSIGNED,REOPENED
  |depends=*}}

custom fields[edit]

We have added some custom fields to our bugzilla, is it possible to run Bugzilla reports on these custom fields ?

I have tried adding

|filters= cf_assigned_sub_status%3DAwaiting%20Product%20Management%20triage

But I get error in SQL with note

 Setting parameter bzalternateconfig is not supported

Does this mean just that the filters wil not work with alternate Bugzilla configurations ?

thanks

Mark

See the Multiple Bugzilla's entry above I had the same issue

{{#bugzilla:

 created=-90d

}}

unserialize Error[edit]

We've installed mediawiki 1.20.2 and Bugzilla Reports extension

The bugzilla db and mediawiki are both on mysql in localhost.


When I add code for bugzilla report, the report is correctly generated but at the top of the page i get this error:


Notice: unserialize(): Error at offset 0 of 126 bytes in C:\mediawiki-1.20.2\includes\objectcache\SqlBagOStuff.php on line 539

Bugzilla 4.4[edit]

Bugzilla 4.3 and 4.4 are not listed under #Pre-requisities and it's not clear whether this is a list of all supported version or newer versions will work.. So, will this extension work with bugzilla 4.4? 2aprilboy (talk) 14:30, 8 July 2013 (UTC)

The old version of the extension (v1.1) will work with Bugzilla 4.3 and older. The new version (v1.3) will work with Bugzilla 4.4. CiaranG (talk) 11:55, 4 August 2013 (UTC)

Negated keywords search ignores tickets with no keywords[edit]

When I use |keywords=!ddd, only bugzilla tickets with some keyword(s) in them are included. The bugs without any keyword are not. Is it possible to search for bugs with no keywords? --2aprilboy (talk) 11:18, 15 October 2013 (UTC)

2aprilboy (talk) 11:24, 17 October 2013 (UTC): I'm not familiar with the source code yet, but the change in SQL output needs to be from:
and EXISTS (
       SELECT keywordid,
       keywords.bug_id
       from `bugs`.keywords as keywords
       LEFT JOIN `bugs`.keyworddefs as keyworddefs on keywords.keywordid=keyworddefs.id
       where keywords.bug_id=bugs.bug_id and keyworddefs.name <> 'xxx'
   )

to:

and NOT EXISTS (
       SELECT keywordid,
       keywords.bug_id
       from `bugs`.keywords as keywords
       LEFT JOIN `bugs`.keyworddefs as keyworddefs on keywords.keywordid=keyworddefs.id
       where keywords.bug_id=bugs.bug_id and keyworddefs.name = 'xxx'
   )

Please help with Stand-alone Report -- report.php RESOLVED[edit]

I got it working, so I thought I would share what I found.

I'm not sure whether a new version of mediawiki or PHP broke the report.php code, or whether it never really worked as written. However, now I've got basic functionality and I can refine it from there.
Original Post:

Hi, I've got the basic reporting working fine, even with multiple instances of Bugzilla. I'm trying to get the report.php standalone working, but I'm getting an error.

Fatal error: Call to undefined function wfMsgForContent() in /var/www/html/bugzilla/extensions/BugzillaReports/BugzillaReport.php on line 212.

Here's what I've done so far:

  • My Bugzilla code is loaded in /var/www/html/bugzilla, with the extension unzipped to /var/www/html/bugzilla/extensions/BugzillaReports.
  • Mediawiki is installed on /var/www/html/mediawiki.
  • I copied the value of the $wgBugzillaReports array from my LocalSettings.php file into report.php.

I put the reports.php file into the /var/www/html/mediawiki/ directory, and I initially got an error: init.php was not found.

I changed:

require_once("init.php");

to:

require_once("/var/www/html/bugzilla/extensions/BugzillaReports/init.php");

So, that worked, or at least I got past that particular error. Now I'm getting the error shown at the top of this posting.

I have tried various settings for $bzScriptPath, but nothing has worked. Somebody must have this working. What am I doing wrong?

Thanks in advance...

klever@rtlogic.com


Solution:

  • I located report.php in the base mediawiki directory.
  • I copied the content of my changes to LocalSettings.php, where the main and alternate Bugzilla databases and usernames and passwords are defined. I set up a user named "reports" and set the password for that user.
define('BUGZILLAREPORTS',1);
$bzScriptPath="/var/www/html/bugzilla/extensions/BugzillaReports";
require_once("/var/www/html/bugzilla/extensions/BugzillaReports/init.php");

$wgBugzillaReports = array(
  'host'        => "localhost",
  'database'    => "zilla_bugs",
  'user'        => "reports",
  'password'    => "reports-password",
  'bzserver'    => "https://ourhost.ourdomain.com/zilla_bugs/",
  'bzAlternateConfigs' => array(
     'CM_Tools' => array (
         'host' => "localhost",
         'database' => "CM_Tools",
         'user' => "reports",
         'password' => "reports-password",
         'bzserver' => "https://ourhost.ourdomain.com/CM_Tools/"
     ),
     'ProjectDB_1' => array (
         'host' => "localhost",
         'database' => "ProjectDB_1",
         'user' => "reports",
         'password' => "reports-password",
         'bzserver' => "https://ourhost.ourdomain.com/ProjectDB_1/"
     )
  )
);
  • I set up that user in mysql for each of the Bugzilla databases.
# cd /var/lib/mysql
# mysql -p
mysql> grant select on zilla_bugs.* to 'reports'@'localhost' identified by 'reports-password';
              (repeat the step above for each of the Bugzilla DBs)
mysql> quit
  • The following changes are required to report.php in order to make it function.
    • Add the following lines above the call $parser=new BParser();
#  This step is done in mediawiki's index.php, but was
#  missing in the original report.php.  It is required!
require __DIR__ . '/includes/WebStart.php';
    • REPLACE the php code at the bottom of the file with the following, and you'll actually get some output:
$head=$parser->mOutput->head;
$out=$bugzillaReport->render(array("priority=*"));
?>
<html>
  <head>
     <?php
        print $head;
     ?>
  </head>
  <body>
     <?php
        print $out;
     ?>
  </body>
</html>

lastcomment rendered incorrectly on IIS 7[edit]

  • Symptoms:
    • When I used lastcomment=1 on IIS 6, it had been rendered correctly as a bubble.
    • Now, I use IIS 7 and lastcomment seems to be rendered somehow inline. The result is, that the screen flickers whenever I move the mouse over a bug line. It looks like "mouseover" inserts the comment between the lines (and therefore shifts the whole screen below and alters the width of the table column(s)), instead of rendering it as a bubble.
  • Result
    • I feel urged not to use lastcomment=1 any more, in spite of I really liked it as a very useful feature, when it worked correctly.
    • Can you please make it compatible with IIS 7 (or tell me what else I might be doing wrong)?
  • Thanks!

Issues with detailsrow[edit]

I have some issues when using detailsrow I'd like to see fixed:

  1. That the background alternating color be turned off so that each main row is shaded, and subsequent detail rows are not shaded.
  2. That the detailsrow be it's own table that colspan's the main row columns, having the 1st column be the detailsrowprepend text, and the 2nd and perhaps subsequent columns be the detail.

As it is now, the alternating backgrounds make the report a little confusing, and the detail makes the 1st column wider than it needs to be. Perhaps there is already some solution for this, or maybe I'm doing something incorrectly, but looking through the code I don't see it.

If I could get a push in the right direction, I'm willing to make these changes and contribute.

-Bill

UPDATE: Took care of #1 with this

if ($even && !$this->query->get('detailsrow')) {
    $class.="bz_row_even";
} else {
    $class.="bz_row_odd";
}

For # 2 the issue is in the function renderDetailsRow. If the detail is very long, the 1st main column width is bigger than is needed. I fixed this by increasing the base estimated width to 80.

$estimatedWidth=80 + $this->numberOfMainRowColumns * 5;
$this->output.="<div title=\"$title\" class=\"bz_details\" style=\"margin-left:2em;margin-right:-".$estimatedWidth."em;overflow:auto\">";

UPDATE: The change I made for #2 isn't really working out either. What I've done now is to make detailrow(s) additional table rows, and the detailsrowprepend (if provided) a table header above any details. The rows are set to colspan the entire width of the table. I split off the renderDetailsRow into a new renderDependsBlockRow for the calls made for depends and blocks, and changed the leftover renderDetailsRow to suite my needs. I'll work on getting this committed and released.

These changes are now located in the 1.4 branch.

Google Code Shutting Down[edit]

Hello, As you are likely aware, Google is shutting down their Google Code service in January of 2016. This extension appears to house its code with Google Code and is at risk to creating broken links and confusion of users in the near future.

I’m helping to let folks know about this coming update and provide some helpful links to make this migration easy. I hope you’ll take a moment and migrate your extension to a new hosting solution.

For extensions that have a compatible license, you can request developer access to the MediaWiki source repositories for extensions and get a new repository created for you. Alternatively, you may also export your code to other popular repositories such as Github and Bitbucket. Google has provided tools to help with this migration.

Ckoerner (talk) 17:15, 7 July 2015 (UTC)

Martin Sugioarto picked up development of this extension at https://github.com/nakal/mediawiki-bugzillareports and rewrote it to Bugzilla 5.0 (at this time only 5.0 and newer is supported without compatiblity for older Bugzilla versions) --Hendrik Brummermann (talk) 10:05, 10 September 2015 (UTC)