summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-10 17:14:22 +0100
committermkanat%kerio.com <>2005-03-10 17:14:22 +0100
commit7bfeeb6381c49662a58d6e8fe679ad4e8dbda013 (patch)
treed6bf3b575bd742be3e5087ca9c5c6266f84a130b /checksetup.pl
parentb5e1b3f1e725062345edcacd9657da7b8f85874d (diff)
downloadbugzilla-7bfeeb6381c49662a58d6e8fe679ad4e8dbda013.tar.gz
bugzilla-7bfeeb6381c49662a58d6e8fe679ad4e8dbda013.tar.xz
Bug 285401: Checksetup fails to complete on PostgreSQL
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=glob, a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl39
1 files changed, 18 insertions, 21 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 1464e8516..0dbf86bab 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -1653,8 +1653,9 @@ sub AddGroup {
print "Adding group $name ...\n";
my $sth = $dbh->prepare('INSERT INTO groups
- (name, description, userregexp, isbuggroup)
- VALUES (?, ?, ?, ?)');
+ (name, description, userregexp, isbuggroup,
+ last_changed)
+ VALUES (?, ?, ?, ?, NOW())');
$sth->execute($name, $desc, $userregexp, 0);
my $last = $dbh->bz_last_key('groups', 'id');
@@ -3696,10 +3697,14 @@ if (!GroupDoesExist('bz_canusewhines')) {
my $whineatothers_group = AddGroup('bz_canusewhineatothers',
'Can configure whine reports for ' .
'other users');
- $dbh->do("INSERT IGNORE INTO group_group_map " .
+ my $group_exists = $dbh->selectrow_array(
+ q{SELECT 1 FROM group_group_map
+ WHERE member_id = ? AND grantor_id = ? AND grant_type = ?},
+ undef, $whineatothers_group, $whine_group, GROUP_MEMBERSHIP);
+ $dbh->do("INSERT INTO group_group_map " .
"(member_id, grantor_id, grant_type) " .
"VALUES (${whineatothers_group}, ${whine_group}, " .
- GROUP_MEMBERSHIP . ")");
+ GROUP_MEMBERSHIP . ")") unless $group_exists;
}
###########################################################################
@@ -3813,10 +3818,9 @@ if ($sth->rows == 0) {
$login = "";
}
}
- $login = $dbh->quote($login);
$sth = $dbh->prepare("SELECT login_name FROM profiles " .
- "WHERE login_name=$login");
- $sth->execute;
+ "WHERE login_name = ?");
+ $sth->execute($login);
if ($sth->rows > 0) {
print "$login already has an account.\n";
print "Make this user the administrator? [Y/n] ";
@@ -3909,24 +3913,17 @@ if ($sth->rows == 0) {
$SIG{QUIT} = 'DEFAULT';
$SIG{TERM} = 'DEFAULT';
- $realname = $dbh->quote($realname);
- $cryptedpassword = $dbh->quote($cryptedpassword);
-
- # Set default email flags for the Admin, same as for users
- my $defaultflagstring =
- $dbh->quote(Bugzilla::Constants::DEFAULT_EMAIL_SETTINGS);
-
$dbh->do(
- "INSERT " .
- " INTO profiles (login_name, realname, cryptpassword, emailflags) " .
- "VALUES ($login, $realname, $cryptedpassword, $defaultflagstring)");
+ q{INSERT INTO profiles (login_name, realname, cryptpassword,
+ emailflags, disabledtext, refreshed_when)
+ VALUES (?, ?, ?, ?, ?, ?)},
+ undef, $login, $realname, $cryptedpassword,
+ Bugzilla::Constants::DEFAULT_EMAIL_SETTINGS, '', '1900-01-01 00:00:00');
}
# Put the admin in each group if not already
- my $query = "select userid from profiles where login_name = $login";
- $sth = $dbh->prepare($query);
- $sth->execute();
- my ($userid) = $sth->fetchrow_array();
+ my $userid = $dbh->selectrow_array(
+ "SELECT userid FROM profiles WHERE login_name = ?", undef, $login);
# Admins get explicit membership and bless capability for the admin group
my ($admingroupid) = $dbh->selectrow_array("SELECT id FROM groups