[AppDB] integrate bugzilla

tony_lambregts at telusplanet.net tony_lambregts at telusplanet.net
Sun Dec 12 20:15:33 CST 2004


Change Log: Integrate AppDB with Bugzilla to use the versions table from Buzilla.

Files changed: preferences.php include/config.php.sample include/util.php

Files Added: tables/bugzilla_tables.sql tables/create_bugzilla_tables


-------------- next part --------------
Index: README
===================================================================
RCS file: /home/wine/appdb/README,v
retrieving revision 1.3
diff -u -r1.3 README
--- README	25 Mar 2004 16:29:47 -0000	1.3
+++ README	12 Dec 2004 20:45:34 -0000
@@ -1,32 +1,71 @@
-WineHQ Application Database
-------------------------------------------------------------------------
-Authors:
-    Jeremy Newman <jnewman at codeweavers.com>
-    Charles Leop <charles at codeweavers.com>
-    
-Contributors:
-    Paul van Schayck <info at wwwdesign.tmfweb.nl>
-    Chris Morgan <cmorgan at alum.wpi.edu>
+WineHQ Application Database
+#------------------------------------------------------------------------#
+Authors:
+    Jeremy Newman <jnewman at codeweavers.com>
+    Charles Leop <charles at codeweavers.com>
+    
+Contributors:
+    Paul van Schayck <polleke at gmail.com>
+    Chris Morgan <cmorgan at alum.wpi.edu>
+    Tony Lambregts <tony_lambregts at telusplanet.net>
+    Jonathan Ernst <Jonathan at ErnstFamily.ch>
+
+To install locally for testing/hacking:
+#------------------------------------------------------------------------#
+
+# Symlink from /var/www to the appdb directory
+
+# Copy include/config.php.sample to include/config.php
+
+# Edit include/config.php as you see fit, the default name of the database 
+  used in the table creation step below is "apidb", you'll have to modify 
+  these files if you change this in config.php
+
+# cd tables, run ./create_tables to create the database tables
+
+# Try to open up localhost/appdb, if you get a directory listing
+  Edit your /etc/apache/httpd.conf "DirectoryIndex" to include index.php 
+  so apache will open index.php after not finding index.html/index.htm etc
+
+# Check your /etc/php/php.ini to ensure that
+  'register_globals = On' (variables won't get passed)
+  'magic_quotes_gpc = Off' (you would end up with \ everywhere)
+  'session.bug_compat_42' = On' (Problem with auto-globals and session variables)
 
+#------------------------------------------------------------------------#
+You can create ether set up a real bugzilla database or a fake one 
 
-To install locally for testing/hacking:
-------------------------------------------------------------------------
+# cd tables, run ./create_bugzilla_tables to create the fake bugzilla tables
+#------------------------------------------------------------------------#
+# or installing a real bugzilla database (hope this helps)
 
-- Symlink from /var/www to the appdb directory
+# download buzilla  (password for cvs is cvs)
 
-- Copy include/config.php.sample to include/config.php
+cd /var/www/html
+export CVSROOT=:pserver:cvs at cvs.winehq.org:/home/wine
+cvs login
+cvs -z 0 checkout bugzilla
 
-- Edit include/config.php as you see fit, the default name of the database 
-  used in the table creation step below is "apidb", you'll have to modify 
-  these files if you change this in config.php
+# change directory to bugzilla and change the group ownership to apache.
 
-- cd tables, run ./create_tables to create the database tables
+cd bugzilla
+chgrp -R apache .
+chmod -R g+rX .
 
-- Try to open up localhost/appdb, if you get a directory listing
-  Edit your /etc/apache/httpd.conf "DirectoryIndex" to include index.php 
-  so apache will open index.php after not finding index.html/index.htm etc
 
-- Check your /etc/php/php.ini to ensure that
-  'register_globals = On' (variables won't get passed)
-  'magic_quotes_gpc = Off' (you would end up with \ everywhere)
-  'session.bug_compat_42' = On' (Problem with auto-globals and session variables)
+# change to su and run ./checksetup.pl and fix up what it finds wrong.
+# this may take several runs 
+
+su
+./checksetup.pl
+
+# in the /etc/httpd/conf/hppt.conf file find "AddHandler cgi-script .cgi" and add the following.
+
+<Directory "/var/www/html/bugzilla">
+Options ExecCGI
+AllowOverride Limit
+Order allow,deny
+Allow from all
+</Directory>
+
+# edit local config as nessary to allow access.
Index: preferences.php
===================================================================
RCS file: /home/wine/appdb/preferences.php,v
retrieving revision 1.3
diff -u -r1.3 preferences.php
--- preferences.php	12 Dec 2004 03:51:51 -0000	1.3
+++ preferences.php	12 Dec 2004 20:45:34 -0000
@@ -15,41 +15,46 @@
 
     $result = mysql_query("SELECT * FROM prefs_list ORDER BY id");
     while($r = mysql_fetch_object($result))
-	{
-	    //skip admin options
-	    //TODO: add a field to prefs_list to flag the user level for the pref
-	    if(!havepriv("admin"))
-		{
-		    if($r->name == "query:mode")
-			continue;
-		    if($r->name == "sidebar")
-			continue;
-		    if($r->name == "window:query")
-			continue;
-		    if($r->name == "query:hide_header")
-			continue;
-		    if($r->name == "query:hide_sidebar")
-			continue;
-		    if($r->name == "debug")
-			continue;
-		}
-		
-	    $input = html_select("pref_$r->name", explode('|', $r->value_list), 
-				 $_SESSION['current']->getpref($r->name, $r->def_value));
-	    echo html_tr(array("&nbsp; $r->description", $input));
-	}
+        {
+            //skip admin options
+            //TODO: add a field to prefs_list to flag the user level for the pref
+            if(!havepriv("admin"))
+                {
+                    if($r->name == "query:mode")
+                        continue;
+                    if($r->name == "sidebar")
+                        continue;
+                    if($r->name == "window:query")
+                        continue;
+                    if($r->name == "query:hide_header")
+                        continue;
+                    if($r->name == "query:hide_sidebar")
+                        continue;
+                    if($r->name == "debug")
+                        continue;
+                }
+                
+            $input = html_select("pref_$r->name", explode('|', $r->value_list), 
+                                 $_SESSION['current']->getpref($r->name, $r->def_value));
+            echo html_tr(array("&nbsp; $r->description", $input));
+        }
 }
 
 function show_user_fields()
 {
-	
-	$user = new User();
-	
-	$ext_username = $_SESSION['current']->username;
-	$ext_realname = $user->lookup_realname($_SESSION['current']->userid);
-	$ext_email = $user->lookup_email($_SESSION['current']->userid);
-	
-	include(BASE."include/"."form_edit.php");
+        
+        $user = new User();
+        
+        $ext_username = $_SESSION['current']->username;
+        $ext_realname = $user->lookup_realname($_SESSION['current']->userid);
+        $ext_email = $user->lookup_email($_SESSION['current']->userid);
+        
+        include(BASE."include/"."form_edit.php");
+        $version = "unspecified";
+        echo "<tr><td>&nbsp; wine version </td><td>";
+        make_bugzilla_version_list("version", $version);
+        echo "</td></tr>";
+
 }
 
 if($HTTP_POST_VARS)
@@ -60,11 +65,11 @@
     $user = new User();
     
     while(list($key, $value) = each($HTTP_POST_VARS))
-	{
-	    if(!ereg("^pref_(.+)$", $key, $arr))
-		continue;
-	    $_SESSION['current']->setpref($arr[1], $value);
-	}
+        {
+            if(!ereg("^pref_(.+)$", $key, $arr))
+                continue;
+            $_SESSION['current']->setpref($arr[1], $value);
+        }
     
     if ($ext_password == $ext_password2)
     {
Index: include/config.php.sample
===================================================================
RCS file: /home/wine/appdb/include/config.php.sample,v
retrieving revision 1.3
diff -u -r1.3 config.php.sample
--- include/config.php.sample	12 Dec 2004 03:55:14 -0000	1.3
+++ include/config.php.sample	12 Dec 2004 20:45:34 -0000
@@ -26,4 +26,14 @@
 $userdb_dbhost = "localhost";
 $userdb_db     = "apidb";
 
+/*
+ * Bugzilla database info
+ */
+$bugzilla_dbuser = "root";
+$bugzilla_dbpass = "";
+$bugzilla_dbhost = "localhost";
+$bugzilla_db     = "bugs";
+/* $bugzilla_db_port = 3306; is this needed? I dont think so.*/
+$bugzilla_product_id = 1;
+
 ?>
Index: include/util.php
===================================================================
RCS file: /home/wine/appdb/include/util.php,v
retrieving revision 1.7
diff -u -r1.7 util.php
--- include/util.php	10 Dec 2004 01:07:45 -0000	1.7
+++ include/util.php	12 Dec 2004 20:45:34 -0000
@@ -171,6 +171,68 @@
     }
 }
 
+/* bugzilla functions */
+
+function openbugzilladb()
+{
+    global $bugzilla_dbuser, $bugzilla_dbpass, $bugzilla_dbhost, $bugzilla_db, $bugzilla_product_id;
+    global $dbcon, $dbref;
+
+    $dbref++;
+
+    if($dbcon)
+        return $dbcon;
+
+    $dbcon = mysql_connect($bugzilla_dbhost, $bugzilla_dbuser, $bugzilla_dbpass);
+    if(!$dbcon) 
+	{
+	    echo "An error occurred: ".mysql_error()."<p>\n";
+	    exit;
+	}
+    mysql_select_db($bugzilla_db);
+    return $dbcon;
+}
+
+function closebugzilladb()
+{
+    global $dbcon, $dbref;
+
+    if(--$dbref)
+        return;
+
+    mysql_close($adbcon);
+}
+
+function make_bugzilla_version_list($varname, $cvalue)
+{
+    global $bugzilla_db, $bugzilla_product_id;
+
+    $table = $bugzilla_db.".versions";
+    $where = "WHERE product_id=".$bugzilla_product_id;
+    $query = "SELECT value FROM $table $where ORDER BY value";
+
+    openbugzilladb();
+
+    $result = mysql_query($query);
+
+    if(!$result)
+    {
+        closebugzilladb();
+        return; // Oops
+    }
+    echo "<select name='$varname'>\n";
+    echo "<option value=0>Choose ...</option>\n";
+    while(list($value) = mysql_fetch_row($result))
+    {
+        if($id == $cvalue)
+            echo "<option value=$value selected>$value\n";
+        else
+            echo "<option value=$value>$value\n";
+    }
+    echo "</select>\n";
+    closebugzilladb();
+}
+
 /* get the number of applications in the appQueue table */
 function getQueuedAppCount()
 {
--- /dev/null	2003-01-30 03:24:37.000000000 -0700
+++ tables/bugzilla_tables.sql	2004-12-10 14:10:49.000000000 -0700
@@ -0,0 +1,62 @@
+create database if not exists bugs;
+
+use bugs;
+
+drop table if exists versions;
+
+
+/*
+ * versions information
+ */
+create table versions (
+       value tinytext,
+       product_id smallint not null
+);
+
+INSERT INTO versions VALUES ('unspecified', 1 );
+INSERT INTO versions VALUES ('20010112', 1 );
+INSERT INTO versions VALUES ('20010216', 1 );
+INSERT INTO versions VALUES ('20010305', 1 );
+INSERT INTO versions VALUES ('20010326', 1 );
+INSERT INTO versions VALUES ('20010418', 1 );
+INSERT INTO versions VALUES ('20010510', 1 );
+INSERT INTO versions VALUES ('20010629', 1 );
+INSERT INTO versions VALUES ('20010824', 1 );
+INSERT INTO versions VALUES ('20011004', 1 );
+INSERT INTO versions VALUES ('20011108', 1 );
+INSERT INTO versions VALUES ('20020228', 1 );
+INSERT INTO versions VALUES ('20020310', 1 );
+INSERT INTO versions VALUES ('20020411', 1 );
+INSERT INTO versions VALUES ('20020509', 1 );
+INSERT INTO versions VALUES ('20020605', 1 );
+INSERT INTO versions VALUES ('20020710', 1 );
+INSERT INTO versions VALUES ('20020804', 1 );
+INSERT INTO versions VALUES ('20020904', 1 );
+INSERT INTO versions VALUES ('20021007', 1 );
+INSERT INTO versions VALUES ('20021031', 1 );
+INSERT INTO versions VALUES ('20021125', 1 );
+INSERT INTO versions VALUES ('20021219', 1 );
+INSERT INTO versions VALUES ('20030115', 1 );
+INSERT INTO versions VALUES ('20030219', 1 );
+INSERT INTO versions VALUES ('20030318', 1 );
+INSERT INTO versions VALUES ('20030408', 1 );
+INSERT INTO versions VALUES ('20030508', 1 );
+INSERT INTO versions VALUES ('20030618', 1 );
+INSERT INTO versions VALUES ('20030709', 1 );
+INSERT INTO versions VALUES ('20030813', 1 );
+INSERT INTO versions VALUES ('20030911', 1 );
+INSERT INTO versions VALUES ('20031016', 1 );
+INSERT INTO versions VALUES ('20031118', 1 );
+INSERT INTO versions VALUES ('20031212', 1 );
+INSERT INTO versions VALUES ('20040121', 1 );
+INSERT INTO versions VALUES ('20040213', 1 );
+INSERT INTO versions VALUES ('20040309', 1 );
+INSERT INTO versions VALUES ('20040408', 1 );
+INSERT INTO versions VALUES ('20040505', 1 );
+INSERT INTO versions VALUES ('20040615', 1 );
+INSERT INTO versions VALUES ('20040716', 1 );
+INSERT INTO versions VALUES ('20040813', 1 );
+INSERT INTO versions VALUES ('20040914', 1 );
+INSERT INTO versions VALUES ('20041019', 1 );
+INSERT INTO versions VALUES ('20041201', 1 );
+INSERT INTO versions VALUES ('CVS', 1 );
--- /dev/null	2003-01-30 03:24:37.000000000 -0700
+++ tables/create_bugzilla_tables	2004-12-10 13:41:28.000000000 -0700
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+echo Creating fake Bugzilla tables
+mysql -u root < bugzilla_tables.sql


More information about the wine-patches mailing list