Integrate APPDB with Bugzilla to use the versions table from Bugzilla.

This commit is contained in:
Tony Lambregts
2004-12-13 03:50:11 +00:00
committed by WineHQ
parent 5642e73425
commit dca5a408cb
6 changed files with 228 additions and 46 deletions

59
README
View File

@@ -1,32 +1,71 @@
WineHQ Application Database
------------------------------------------------------------------------
#------------------------------------------------------------------------#
Authors:
Jeremy Newman <jnewman@codeweavers.com>
Charles Leop <charles@codeweavers.com>
Contributors:
Paul van Schayck <info@wwwdesign.tmfweb.nl>
Paul van Schayck <polleke@gmail.com>
Chris Morgan <cmorgan@alum.wpi.edu>
Tony Lambregts <tony_lambregts@telusplanet.net>
Jonathan Ernst <Jonathan@ErnstFamily.ch>
To install locally for testing/hacking:
------------------------------------------------------------------------
#------------------------------------------------------------------------#
- Symlink from /var/www to the appdb directory
# Symlink from /var/www to the appdb directory
- Copy include/config.php.sample to include/config.php
# Copy include/config.php.sample to include/config.php
- Edit include/config.php as you see fit, the default name of the database
# 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
# cd tables, run ./create_tables to create the database tables
- Try to open up localhost/appdb, if you get a directory listing
# 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
# 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
# cd tables, run ./create_bugzilla_tables to create the fake bugzilla tables
#------------------------------------------------------------------------#
# or installing a real bugzilla database (hope this helps)
# download buzilla (password for cvs is cvs)
cd /var/www/html
export CVSROOT=:pserver:cvs@cvs.winehq.org:/home/wine
cvs login
cvs -z 0 checkout bugzilla
# change directory to bugzilla and change the group ownership to apache.
cd bugzilla
chgrp -R apache .
chmod -R g+rX .
# 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.

View File

@@ -26,4 +26,14 @@ $userdb_dbpass = "lemonade";
$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;
?>

View File

@@ -171,6 +171,68 @@ function get_xml_tag ($file, $mode = null)
}
}
/* 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()
{

View File

@@ -15,41 +15,46 @@ function build_prefs_list()
$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;
}
{
//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));
}
$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();
$user = new User();
$ext_username = $_SESSION['current']->username;
$ext_realname = $user->lookup_realname($_SESSION['current']->userid);
$ext_email = $user->lookup_email($_SESSION['current']->userid);
$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>";
include(BASE."include/"."form_edit.php");
}
if($HTTP_POST_VARS)
@@ -60,11 +65,11 @@ if($HTTP_POST_VARS)
$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)
{

View File

@@ -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 );

View File

@@ -0,0 +1,4 @@
#! /bin/sh
echo Creating fake Bugzilla tables
mysql -u root < bugzilla_tables.sql