------------------
What I want to do?
------------------

I want to help dump sanitized data from Gnome Bugzilla by reusing scripts from Mozilla Bugzilla.
Below I'll describe what should be done in detail to help facilitate the dump process.

I'll start by describing the differences between Mozilla Bugzilla and Gnome Bugzilla,
then introducing how the script runs on Mozilla Bugzilla.
At last I'll describe how to revise the scripts on Gnome Bugzilla. 

See the bug description here: 
  https://bugzilla.gnome.org/show_bug.cgi?id=693295
See the similar bug page at Mozilla Bugzilla:
  https://bugzilla.mozilla.org/show_bug.cgi?id=838947

-----------------------------------------------------------
The differences between Mozilla Bugzilla and Gnome Bugzilla 
-----------------------------------------------------------

Mozilla Bugzilla version is 4.2, and Gnome Bugzilla version is 3.4.13. 
Database scheme has some changes between bugzilla 3.4.13 and 4.0 (i.e., 4.2 in this case). 
The script requires revisions to switch from bugzilla-4.2 to bugzilla-3.4.13. 

-------------------------
How to use sanitizeme.pl
-------------------------

The scripts that Mozilla used to obtain sanitized Bugzilla data is at:
  http://bzr.mozilla.org/bmo/4.2-dev/view/head:/contrib/sanitizeme.pl

In order to run sanitizeme.pl, you need to be at the root directory of the bugzilla installation,
and you run it with the parameters for how you want it sanitized.

For example, at the bugzilla's root directory (such as: /var/www/bugzilla-3.4.13), you can run the script with command line: 

  ./sanitizeme.pl [--OPTIONS] 

# Once it's done, the terminal would show the information of deleted data, and database with the bugzilla would be sanitized.

Options:

--dry-run : Don't modify the database, just print out what changes to the 
            database will be made. If you don't know what will be deleted, 
            you can use this option to test.
  
--keep-attachments : Keep attachment data
  
--keep-passwords : Keep user passwords
  
--keep-insider : Keep 'insidergroup' comments and attachments
  
--keep-groups:XXX : Keep data of group:XXX
  
--trace : Enable you to see what's happening about DB.
          The trace output is detailed and typically very useful.
  
--enable-email : Keep email delivery

----------------------------
What has been removed?
----------------------------

This script is designed to sanitize a copy of a Bugzilla database so that it 
doesn't contain any information that can't be viewed from a web browser by a 
user who is not logged in. The sanitization process removes some data about legal, HR ,Privacy or Security. 
If you think there are other data for sanitizing, you can modify the script and remove the data.

For sanitizing the data, the script mainly calls some subroutines in a eval function like that:

  #The eval function is used to trap exceptions, just like "try/catch" in Java
  eval {  
    delete_non_public_products();
    delete_secure_bugs();
    ...
  }; warn $@ if $@;

There calls 7 subroutines in the eval function, every subroutine aims to remove or modify
some data from a specfic aspect. 
Below we list these subroutines and describe their purpose.  
For details of the process, the comments in the scripts are helpful.
 
Subs:

->sub "delete_non_public_products"
  Delete all non-public products, and all data associated with them (including 
  the bugs).

->sub "delete_secure_bugs"
  Delete all data for bugs in security groups.

->sub "delete_insider_comments"
  Delete all 'insidergroup' comments and attachments

->sub "delete_security_groups"
  Delete all security groups.

->sub "delete_sensitive_user_data"
  Remove sensitive user account data.

->sub "delete_attachment_data "
  Delete unnecessary attachment data.

->sub "disable_email_delivery"
  Turn off email delivery for all users.Also clear out the default flag cc.

--------------------------------------------------------
Applying the script to GNOME Bugzilla
--------------------------------------------------------

1, GNOME Bugzilla uses bugzilla-3.4.13, instead of 4.2 used by mozilla. 
Database scheme of bugzilla 3.4.13 and 4.2 are a bit different:
bugzilla-4.2 added some tables that are not in bugzilla-3.4.13, including: 
"profile_search, "login_failure", etc.

Mozilla Bugzilla also added some tables in their database of bugzilla-4.2, including:
"push", "push_backlog", "push_backoff", "push_log", "push_options", etc.

2, It's not clear to us whether or not GNOME Bugzilla has changed its DB schema.

In the script, the only difference we could see that would be different between bugzilla-3.4.13 and Mozilla bugzilla is,
In the sub "delete_sensitive_user_data" (line 156 in sanitizeme.pl), there have lines:

  $dbh->do("DELETE FROM profile_search");
  $dbh->do("DELETE FROM login_failure");
  $dbh->do("DELETE FROM push");
  $dbh->do("DELETE FROM push_backlog");
  $dbh->do("DELETE FROM push_backoff");
  $dbh->do("DELETE FROM push_log");
  $dbh->do("DELETE FROM push_options");

These lines aim to delete these tables : "profile_search, "login_failure", "push", "push_backlog", "push_backoff", 
"push_log", "push_options" that bugzilla-3.4.13 DB doesn't have.
Therefore simply deleting these lines (or ignoring them) would work.

I deleted these lines and tried to run the script on bugzilla-3.4.13. It worked. But I suppose 
Gnome Bugzilla would be much more complicated than my testing DB.
If GNOME Bugzilla has some DB schema changes, or there are some other data that 
should be sanitized, please let me know, we'd like to help with that. It appears
the script could be easily revised.



