head	1.13;
access;
symbols
	TIGRIS_1_1_0RC2:1.5.4.1.4.1.2.1
	TIGRIS_1_1_0RC1:1.5.4.1.4.1
	TIGRIS_1_1:1.5.4.1.4.1.0.2
	TIGRIS_1_0_8:1.5.4.1.4.1
	TIGRIS_1_0_8RC3:1.5.4.1.4.1
	TIGRIS_1_0_8RC2:1.5.4.1.4.1
	TIGRIS_1_0_8RC1:1.5.4.1.4.1
	TIGRIS_1_0_7:1.5.4.1.4.1
	TIGRIS_1_0_7RC3:1.5.4.1.4.1
	TIGRIS_1_0_7RC2:1.5.4.1.4.1
	TIGRIS_1_0_7RC1:1.5.4.1.4.1
	TIGRIS_1_0_6:1.5.4.1.4.1
	TIGRIS_1_0_6RC5:1.5.4.1.4.1
	TIGRIS_1_0_6RC4:1.5.4.1.4.1
	TIGRIS_1_0_6RC3:1.5.4.1.4.1
	TIGRIS_1_0_6RC2:1.5.4.1.4.1
	TIGRIS_1_0_6RC1:1.5.4.1.4.1
	TIGRIS_1_0_5:1.5.4.1
	TIGRIS_1_0_5RC6:1.5.4.1
	TIGRIS_1_0_5RC5:1.5.4.1
	TIGRIS_1_0_5RC4:1.5.4.1
	TIGRIS_1_0_5RC3:1.5.4.1
	TIGRIS_1_0_5RC2:1.5.4.1
	TIGRIS_1_0_5RC1:1.5.4.1
	TIGRIS_1_0_4:1.5.4.1
	TIGRIS_1_0_3:1.5.4.1
	TIGRIS_1_0_2:1.5.4.1
	TIGRIS_1_0_1:1.5.4.1
	TIGRIS_1_0:1.5.4.1.0.4
	TIGRIS_1_0_0:1.5.4.1
	TIGRIS_1_0_0_RC1:1.5.0.4
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.5
	TIGRIS_0_9_2_3:1.5
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.5
	TIGRIS_0_9_2_1:1.5
	TIGRIS_0_9_2:1.5.0.2
	TIGRIS_0_9_0:1.2.0.4
	TIGRIS_0_8_4:1.2.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.13
date	2001.08.14.18.54.08;	author kmaples;	state Exp;
branches;
next	1.12;

1.12
date	2001.07.30.18.07.19;	author kmaples;	state Exp;
branches;
next	1.11;

1.11
date	2001.06.05.22.36.18;	author kmaples;	state Exp;
branches;
next	1.10;

1.10
date	2001.04.20.00.02.50;	author kmaples;	state Exp;
branches;
next	1.9;

1.9
date	2001.04.18.02.02.58;	author kmaples;	state Exp;
branches;
next	1.8;

1.8
date	2001.04.17.04.44.54;	author kmaples;	state Exp;
branches;
next	1.7;

1.7
date	2001.03.29.00.04.46;	author kmaples;	state Exp;
branches;
next	1.6;

1.6
date	2001.03.28.21.05.59;	author kmaples;	state Exp;
branches;
next	1.5;

1.5
date	2001.01.13.02.04.52;	author kmaples;	state Exp;
branches
	1.5.2.1
	1.5.4.1;
next	1.4;

1.4
date	2000.12.28.01.48.09;	author kmaples;	state Exp;
branches;
next	1.3;

1.3
date	2000.12.27.22.57.44;	author kmaples;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.21.19.07.09;	author kmaples;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.12.21.17.36;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.17.36;	author dlr;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.02.21.00.36.13;	author dlr;	state Exp;
branches;
next	;

1.5.2.1
date	2001.03.29.19.27.53;	author kmaples;	state Exp;
branches;
next	;

1.5.4.1
date	2001.03.29.00.10.03;	author kmaples;	state Exp;
branches
	1.5.4.1.4.1;
next	;

1.5.4.1.4.1
date	2001.05.25.23.43.20;	author kmaples;	state Exp;
branches
	1.5.4.1.4.1.2.1;
next	;

1.5.4.1.4.1.2.1
date	2001.08.13.23.06.41;	author kmaples;	state Exp;
branches;
next	;


desc
@@


1.13
log
@Made sure -D flag is set when calling mysql from the command line.
@
text
@#!/usr/bin/perl

# ================================================================
# Copyright (c) 2000 Collab.Net.  All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement: "This product includes
# software developed by Collab.Net (http://www.Collab.Net/)."
# Alternately, this acknowlegement may appear in the software itself, if
# and wherever such third-party acknowlegements normally appear.
# 
# 4. The hosted project names must not be used to endorse or promote
# products derived from this software without prior written
# permission. For written permission, please contact info@@collab.net.
# 
# 5. Products derived from this software may not use the "Tigris" name
# nor may "Tigris" appear in their names without prior written
# permission of Collab.Net.
# 
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ====================================================================
# 
# This software consists of voluntary contributions made by many
# individuals on behalf of Collab.Net.
#


# 
# $Id: issuezilla-project-delete,v 1.12 2001/07/30 18:07:19 kmaples Exp $
# --------------------
# 

# Flush buffer, just in case:
$| = 1;

use strict;
use DBI;

# For the sake of -T:
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
# Detaint the args by brute force:
@@ARGV = detaint_array(@@ARGV);


# Process arguments
my $sandbox            = $ARGV[0] || '';
my $project_name       = $ARGV[1] || '';
my $dbname             = $ARGV[2] || '';
my $multiple_dbs       = $ARGV[3] || '';  

# NOTE - this script requires the info necessary to connect
# to the correct DB, e.g., username/password, DB name, etc.

my $dbuser         = $ENV{DATABASE_USER}     || '';
my $dbpass         = $ENV{DATABASE_PASSWORD} || '';

my $dbrootuser     = $ENV{DATABASE_ROOTUSER} || '';
my $dbrootpass     = $ENV{DATABASE_ROOTPASS} || '';

# Grab just the filename portion of this script to use as a 
# log identifier:
my $script_name = $0;
$script_name =~ s/^.*\/([^\/]+)$/  $1/;

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
# If issuezilla is in single-db mode, then deletion needs to 
# occur through the interface, not here:

unless($multiple_dbs){
    print "$script_name: Database flag set to SINGLE; no action.\n";
    print "$script_name: Projects must be removed manually\n";
    exit(0);
} 

# This should be pretty straightforward - deletion of a project
# is equivalent to deleting the issues database for that project
# as far as issuezilla is concerned.  For the time being, we do
# a mysql dump of the issues database and move it off to /tmp 
# before destroying everything.  This isn't meant to provide easy
# access to the record before trashing it; only to allow for the 
# possility for recovery.  

print "$script_name: testing for $dbname\n";
my $dbc = join(':','DBI','mysql','mysql',$ENV{DATABASE_HOST}, $ENV{DATABASE_PORT} );
my $CONN = DBI->connect($dbc,$dbrootuser,$dbrootpass);

unless($CONN =~ m/HASH/){
    print "$script_name: no connection to database\n";
    exit(1);	
}

my $query     = qq{ SHOW DATABASES };
my $statement = $CONN->prepare($query);
my $ret       = $statement->execute;
my $found     = 0;

# Check for matching database
while(my (@@record) = $statement->fetchrow_array){
	$found = 1 if $record[0] =~ m/^$dbname$/;
}

if($found){
	print "$script_name: $dbname exists; beginning removal\n";
    print "$script_name: dumping $dbname to /tmp/$project_name.$dbname.sql\n";
    system("mysqldump -u$dbuser -p$dbpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} $dbname | gzip -c > /tmp/$project_name.$dbname.sql.gz") == 0
	    or die "$script_name: unable to dump database $dbname: $!\n";

    print "$script_name: dropping database $dbname\n";
    system("mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -e 'drop database $dbname'") == 0
	    or die "$script_name: unable to drop database $dbname: $!\n";
} else {
    print "$script_name: $dbname doesn't exist; presumed successful\n";
}

print "$script_name: deleting permissions for $dbname from mysql:db \n";
system( qq[mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -D mysql -e 'delete from db where Db = "$dbname"'] ) == 0
	or die "$script_name: unable to delete permissions for $dbname: $!\n";

exit; 

##---------------------------------------------------------------
## END MAIN
##---------------------------------------------------------------


# A crude attempt to overcome data tainting in perl:
#-------------------
sub detaint_array {
#-------------------
    my @@unclean = @@_;
    my @@clean = ();

    foreach(@@unclean){
        # We don't really have rules for this, so at the moment
        # this acts as a passthrough:
        $_ =~ m/^(.*)$/;
        push(@@clean,$1);
    }

    return(@@clean);
}

@


1.12
log
@Issue number: 4544, 4242
Making the world a better place by removing the scripts the taskrunner
used to need to run to create IZ users.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.11 2001/06/05 22:36:18 kmaples Exp $
d140 1
a140 1
system( qq[mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} mysql -e 'delete from db where Db = "$dbname"'] ) == 0
@


1.11
log
@Issue number: 4242
Completely removing IZ's password and LDAP code.  This is in advance of
more signifigant changes to persuade IZ to obtain permission information
directly from Helm.

This is a large-scale cleanup of code which is useless to IZ, since it
obtains the information it uses for authentication from Helm in any event.
Password information was merely dummy strings that acted as placeholders
in the profiles table; as of now, it is sufficient to have an entry in
the profiles table (non-disabled, of course) for access.

Related changes can be found in issuezilla/
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.10 2001/04/20 00:02:50 kmaples Exp $
d71 1
a71 2
my $domain_name        = $ARGV[3] || '';
my $multiple_dbs       = $ARGV[4] || '';  
@


1.10
log
@Cleaned up some potential problems with the tigris user; modified how the
bridge redirects stdout and stderr to the logfile in advance of setting up
some proper debugging.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.9 2001/04/18 02:02:58 kmaples Exp $
a72 1
my $issues_password    = $ENV{ISSUZILLA_PASSWORD};
@


1.9
log
@Undoing yesterday's commit - my hastiness to implement some sort of logging
level notion into these scripts caused me great pain.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.7 2001/03/29 00:04:46 kmaples Exp $
d111 1
a111 1
my $CONN = DBI->connect($dbc,$dbuser,$dbpass);
@


1.8
log
@Scripts now use IN_PRODUCTION to determine logging level
@
text
@d111 1
a111 1
my $CONN = DBI->connect($dbc,$dbrootuser,$dbrootpass);
@


1.7
log
@Fixed the var names as per dlr.  Makes more sense.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.6 2001/03/28 21:05:59 kmaples Exp $
d111 1
a111 1
my $CONN = DBI->connect($dbc,$dbuser,$dbpass);
@


1.6
log
@PR: 3355
Check to see if the database already exists before trying to delete it.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.5 2001/01/13 02:04:52 kmaples Exp $
d118 4
a121 4
my $statement = qq{ SHOW DATABASES };
my $select = $CONN->prepare($statement);
my $ret    = $select->execute;
my $found  = 0;
d124 1
a124 1
while(my (@@record) = $select->fetchrow_array){
@


1.5
log
@First furtive attempts to support remote databases.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.4 2000/12/28 01:48:09 kmaples Exp $
d59 1
d109 31
a139 7
print "$script_name: dumping $dbname to /tmp/$project_name.$dbname.sql\n";
system("mysqldump -u$dbuser -p$dbpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} $dbname | gzip -c > /tmp/$project_name.$dbname.sql.gz") == 0
	or die "$script_name: unable to dump database $dbname: $!\n";

print "$script_name: dropping database $dbname\n";
system("mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -e 'drop database $dbname'") == 0
	or die "$script_name: unable to drop database $dbname: $!\n";
d142 1
a142 1
system( qq{mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} mysql -e 'delete from db where Db = "$dbname"'} ) == 0
@


1.5.2.1
log
@Merging to 092 fix for failure when trying to delete a project that had
previously been deleted.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.7 2001/03/29 00:04:46 kmaples Exp $
a58 1
use DBI;
d108 7
a114 31
print "$script_name: testing for $dbname\n";
my $dbc = join(':','DBI','mysql','mysql',$ENV{DATABASE_HOST}, $ENV{DATABASE_PORT} );
my $CONN = DBI->connect($dbc,$dbuser,$dbpass);

unless($CONN =~ m/HASH/){
    print "$script_name: no connection to database\n";
    exit(1);	
}

my $query     = qq{ SHOW DATABASES };
my $statement = $CONN->prepare($query);
my $ret       = $statement->execute;
my $found     = 0;

# Check for matching database
while(my (@@record) = $statement->fetchrow_array){
	$found = 1 if $record[0] =~ m/^$dbname$/;
}

if($found){
	print "$script_name: $dbname exists; beginning removal\n";
    print "$script_name: dumping $dbname to /tmp/$project_name.$dbname.sql\n";
    system("mysqldump -u$dbuser -p$dbpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} $dbname | gzip -c > /tmp/$project_name.$dbname.sql.gz") == 0
	    or die "$script_name: unable to dump database $dbname: $!\n";

    print "$script_name: dropping database $dbname\n";
    system("mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -e 'drop database $dbname'") == 0
	    or die "$script_name: unable to drop database $dbname: $!\n";
} else {
    print "$script_name: $dbname doesn't exist; presumed successful\n";
}
d117 1
a117 1
system( qq[mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} mysql -e 'delete from db where Db = "$dbname"'] ) == 0
@


1.5.4.1
log
@Merging from HEAD; script checks for database before trying to delete.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.7 2001/03/29 00:04:46 kmaples Exp $
a58 1
use DBI;
d108 7
a114 31
print "$script_name: testing for $dbname\n";
my $dbc = join(':','DBI','mysql','mysql',$ENV{DATABASE_HOST}, $ENV{DATABASE_PORT} );
my $CONN = DBI->connect($dbc,$dbuser,$dbpass);

unless($CONN =~ m/HASH/){
    print "$script_name: no connection to database\n";
    exit(1);	
}

my $query     = qq{ SHOW DATABASES };
my $statement = $CONN->prepare($query);
my $ret       = $statement->execute;
my $found     = 0;

# Check for matching database
while(my (@@record) = $statement->fetchrow_array){
	$found = 1 if $record[0] =~ m/^$dbname$/;
}

if($found){
	print "$script_name: $dbname exists; beginning removal\n";
    print "$script_name: dumping $dbname to /tmp/$project_name.$dbname.sql\n";
    system("mysqldump -u$dbuser -p$dbpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} $dbname | gzip -c > /tmp/$project_name.$dbname.sql.gz") == 0
	    or die "$script_name: unable to dump database $dbname: $!\n";

    print "$script_name: dropping database $dbname\n";
    system("mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -e 'drop database $dbname'") == 0
	    or die "$script_name: unable to drop database $dbname: $!\n";
} else {
    print "$script_name: $dbname doesn't exist; presumed successful\n";
}
d117 1
a117 1
system( qq[mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} mysql -e 'delete from db where Db = "$dbname"'] ) == 0
@


1.5.4.1.4.1
log
@Issue number: 4277
Reviewed by:  lucas@@collab.net

Makes sure that deletions use the root user (which has access to the mysql db)
rather than the tigris user, which doesn't.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.5.4.1 2001/03/29 00:10:03 kmaples Exp $
d111 1
a111 1
my $CONN = DBI->connect($dbc,$dbrootuser,$dbrootpass);
@


1.5.4.1.4.1.2.1
log
@Issue number: 5406
Reviewed by:  lucas@@collab.net
Added '-D' option when invoking mysql directly.  Fixes a bug on Solaris
using mysql 3.22.32
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.5.4.1.4.1 2001/05/25 23:43:20 kmaples Exp $
d142 1
a142 1
system( qq[mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -D mysql -e 'delete from db where Db = "$dbname"'] ) == 0
@


1.4
log
@Implemented the following changes to support single-db installations of
IZ based on conversations with CC - these changes only apply to elements
in issuezilla.  When IZ is in single-db mode:

* Users are added if the do not exist
* User roles are flattened to either 'observer' or 'admin'
* User accounts are NOT updated with new permissions if they already exist
* User accounts are NOT deleted
* Projects are NOT deleted

The presumption in most/all of these cases is that the admin will be
responsible for manually performing these functions through IZs interface.
All of these changes are to prevent helm updates from inadvertently trashing
users' priviliges in one project when they are changed in another project,
since in single-db mode there's no provision for differentiation.  I
expect to refine this in the near-future.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.3 2000/12/27 22:57:44 kmaples Exp $
d109 1
a109 1
system("mysqldump -u$dbuser -p$dbpass $dbname | gzip -c > /tmp/$project_name.$dbname.sql.gz") == 0
d113 1
a113 1
system("mysql -u$dbrootuser -p$dbrootpass -e 'drop database $dbname'") == 0
d117 1
a117 1
system( qq{mysql -u$dbrootuser -p$dbrootpass mysql -e 'delete from db where Db = "$dbname"'} ) == 0
@


1.3
log
@Framework changes to recognize whether database type is set to single or
multiple.  This implements no changes in the behavior of the scripts, only
changes in the framework.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.2 2000/11/21 19:07:09 kmaples Exp $
d91 9
@


1.2
log
@Updated issuezillal-project-delete to do mysql dump of db, drop the db, and
then delete relevant records in the mysql:db table.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.1.1.1 2000/11/12 21:17:36 dlr Exp $
d71 1
@


1.1
log
@Initial revision
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.7 2000/11/07 20:58:04 kmaples Exp $
d79 3
d90 19
a109 7
# This is now no op.; since each project gets its own database,
# and since we're not prepared to drop the database on demand,
# there's not much we can do here: 

print "$script_name: no operation\n";
# It's possible that we'd want to remove the records from the 
# mysql:db table for this user, but not for the time being.
a111 54


# The remainder is left for posterity; we should remove this when
# we're sure that this is useless. 

## Fail if we don't have what we need to talk to the database:
#unless($dbname && $dbuser && $dbpass){
#    print "$script_name: envrionmentals for DB access not set\n";
#    exit(1);
#}
#
## Ultimately, this command is going to be wrapped in double-quotes
## as it's passed on the command line, so we need to escape both
## types of quotes - the first to appease mysql, the second to
## prevent premature termination of the command:
#
#foreach($project_name, $domain_name, $issues_password){
#    $_ =~ s/'/\\'/g;
#    $_ =~ s/"/\\"/g;
#}
#
## Build the sql statment - do NOT use double-quotes here:
#my $command = qq[
#    DELETE FROM components WHERE 
#    component='$project_name' AND
#    description='$project_name';
#
#    DELETE FROM profiles WHERE
#    login_name='$project_name-issues\@@$domain_name'; 
#
#    DELETE FROM versions WHERE 
#    value='current' AND
#    program='$project_name';
#];
#
## compress whitespace:
#$command =~ s/\s+/ /g;
#
## This approach is abandoned in favor of the safer use of 'system':
##
## my $string = qq[mysql -u$dbuser -p$dbpass $dbname -e "$command"];
##
## system($string) == 0
##   or die "$script_name: Unable to execute mysql command: $!\n";
#
#my $mysql_bin = `which mysql`; chomp $mysql_bin;
#
#print "$script_name: doing mysql delete\n";
##print qq[executing system($mysql_bin,"-u$dbuser","-p$dbpass","$dbname",'-e',$command)];
##exit;
#
#system($mysql_bin,"-u$dbuser","-p$dbpass","$dbname",'-e',$command) == 0
#    or die "$script_name: Unable to execute mysql command: $!\n";
#
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d51 1
a51 1
# $Id: issuezilla-project-delete,v 1.5 2001/01/13 02:04:52 kmaples Exp $
a70 1
my $multiple_dbs       = $ARGV[4] || '';  
a78 3
my $dbrootuser     = $ENV{DATABASE_ROOTUSER} || '';
my $dbrootpass     = $ENV{DATABASE_ROOTPASS} || '';

a86 2
# If issuezilla is in single-db mode, then deletion needs to 
# occur through the interface, not here:
d88 9
a96 25
unless($multiple_dbs){
    print "$script_name: Database flag set to SINGLE; no action.\n";
    print "$script_name: Projects must be removed manually\n";
    exit(0);
} 

# This should be pretty straightforward - deletion of a project
# is equivalent to deleting the issues database for that project
# as far as issuezilla is concerned.  For the time being, we do
# a mysql dump of the issues database and move it off to /tmp 
# before destroying everything.  This isn't meant to provide easy
# access to the record before trashing it; only to allow for the 
# possility for recovery.  

print "$script_name: dumping $dbname to /tmp/$project_name.$dbname.sql\n";
system("mysqldump -u$dbuser -p$dbpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} $dbname | gzip -c > /tmp/$project_name.$dbname.sql.gz") == 0
	or die "$script_name: unable to dump database $dbname: $!\n";

print "$script_name: dropping database $dbname\n";
system("mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} -e 'drop database $dbname'") == 0
	or die "$script_name: unable to drop database $dbname: $!\n";

print "$script_name: deleting permissions for $dbname from mysql:db \n";
system( qq{mysql -u$dbrootuser -p$dbrootpass --host=$ENV{DATABASE_HOST} --port=$ENV{DATABASE_PORT} mysql -e 'delete from db where Db = "$dbname"'} ) == 0
	or die "$script_name: unable to delete permissions for $dbname: $!\n";
a97 1
exit; 
d99 52
@

