3 # Debian-specific script to unregister a theme from the Gforge database
9 use vars qw/$dbh @reqlist $thdir/ ;
13 require ("/usr/share/gforge/lib/include.pl") ; # Include all the predefined functions
18 debug "Usage: unregister-theme <dirname>" ;
19 debug "The theme must be in /usr/share/gforge/www/themes/<dirname>/" ;
25 $dbh->{AutoCommit} = 0;
26 $dbh->{RaiseError} = 1;
28 my ($query, $sth, @array, $version, $action) ;
30 $thdir = $dbh->quote ($thdir) ;
32 $query = "SELECT count(*) FROM themes WHERE dirname=$thdir" ;
33 $sth = $dbh->prepare ($query) ;
35 @array = $sth->fetchrow_array () ;
38 if ($array [0] != 0) {
39 $query = "UPDATE themes SET enabled=false WHERE dirname=$thdir" ;
43 $sth = $dbh->prepare ($query) ;
48 # debug "Committing." ;
51 # There should be a commit at the end of every block above.
52 # If there is not, then it might be symptomatic of a problem.
53 # For safety, we roll back.
58 warn "Transaction aborted because $@" ;
59 debug "Transaction aborted because $@" ;
61 debug "Please report this bug on the Debian bug-tracking system." ;
62 debug "Please include the previous messages as well to help debugging." ;
63 debug "You should not worry too much about this," ;
64 debug "your DB is still in a consistent state and should be usable." ;