Commit 38c7d076 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 305941: Remove profiles.refreshed_when and groups.last_changed - Patch by…

Bug 305941: Remove profiles.refreshed_when and groups.last_changed - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
parent ed12ad18
...@@ -618,7 +618,6 @@ use constant ABSTRACT_SCHEMA => { ...@@ -618,7 +618,6 @@ use constant ABSTRACT_SCHEMA => {
DEFAULT => 'FALSE'}, DEFAULT => 'FALSE'},
mybugslink => {TYPE => 'BOOLEAN', NOTNULL => 1, mybugslink => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'TRUE'}, DEFAULT => 'TRUE'},
refreshed_when => {TYPE => 'DATETIME', NOTNULL => 1},
extern_id => {TYPE => 'varchar(64)'}, extern_id => {TYPE => 'varchar(64)'},
], ],
INDEXES => [ INDEXES => [
...@@ -738,7 +737,6 @@ use constant ABSTRACT_SCHEMA => { ...@@ -738,7 +737,6 @@ use constant ABSTRACT_SCHEMA => {
name => {TYPE => 'varchar(255)', NOTNULL => 1}, name => {TYPE => 'varchar(255)', NOTNULL => 1},
description => {TYPE => 'TEXT', NOTNULL => 1}, description => {TYPE => 'TEXT', NOTNULL => 1},
isbuggroup => {TYPE => 'BOOLEAN', NOTNULL => 1}, isbuggroup => {TYPE => 'BOOLEAN', NOTNULL => 1},
last_changed => {TYPE => 'DATETIME', NOTNULL => 1},
userregexp => {TYPE => 'TINYTEXT', NOTNULL => 1, userregexp => {TYPE => 'TINYTEXT', NOTNULL => 1,
DEFAULT => "''"}, DEFAULT => "''"},
isactive => {TYPE => 'BOOLEAN', NOTNULL => 1, isactive => {TYPE => 'BOOLEAN', NOTNULL => 1,
......
...@@ -37,7 +37,6 @@ use constant DB_COLUMNS => qw( ...@@ -37,7 +37,6 @@ use constant DB_COLUMNS => qw(
groups.name groups.name
groups.description groups.description
groups.isbuggroup groups.isbuggroup
groups.last_changed
groups.userregexp groups.userregexp
groups.isactive groups.isactive
); );
...@@ -99,7 +98,6 @@ sub id { return $_[0]->{'id'}; } ...@@ -99,7 +98,6 @@ sub id { return $_[0]->{'id'}; }
sub name { return $_[0]->{'name'}; } sub name { return $_[0]->{'name'}; }
sub description { return $_[0]->{'description'}; } sub description { return $_[0]->{'description'}; }
sub is_bug_group { return $_[0]->{'isbuggroup'}; } sub is_bug_group { return $_[0]->{'isbuggroup'}; }
sub last_changed { return $_[0]->{'last_changed'}; }
sub user_regexp { return $_[0]->{'userregexp'}; } sub user_regexp { return $_[0]->{'userregexp'}; }
sub is_active { return $_[0]->{'isactive'}; } sub is_active { return $_[0]->{'isactive'}; }
...@@ -157,7 +155,6 @@ Bugzilla::Group - Bugzilla group class. ...@@ -157,7 +155,6 @@ Bugzilla::Group - Bugzilla group class.
my $id = $group->id; my $id = $group->id;
my $name = $group->name; my $name = $group->name;
my $description = $group->description; my $description = $group->description;
my $last_changed = $group->last_changed;
my $user_reg_exp = $group->user_reg_exp; my $user_reg_exp = $group->user_reg_exp;
my $is_active = $group->is_active; my $is_active = $group->is_active;
......
...@@ -459,7 +459,11 @@ sub update_table_definitions { ...@@ -459,7 +459,11 @@ sub update_table_definitions {
{TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0}); {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});
$dbh->bz_alter_column('products', 'votestoconfirm', $dbh->bz_alter_column('products', 'votestoconfirm',
{TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0}); {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});
# 2006-08-04 LpSolit@gmail.com - Bug 305941
$dbh->bz_drop_column('profiles', 'refreshed_when');
$dbh->bz_drop_column('groups', 'last_changed');
################################################################ ################################################################
# New --TABLE-- changes should go *** A B O V E *** this point # # New --TABLE-- changes should go *** A B O V E *** this point #
################################################################ ################################################################
...@@ -1315,9 +1319,6 @@ sub _convert_groups_system_from_groupset { ...@@ -1315,9 +1319,6 @@ sub _convert_groups_system_from_groupset {
# The groups system needs to be converted if groupset exists # The groups system needs to be converted if groupset exists
if ($dbh->bz_column_info("profiles", "groupset")) { if ($dbh->bz_column_info("profiles", "groupset")) {
$dbh->bz_add_column('groups', 'last_changed',
{TYPE => 'DATETIME', NOTNULL => 1}, '0000-00-00 00:00:00');
# Some mysql versions will promote any unique key to primary key # Some mysql versions will promote any unique key to primary key
# so all unique keys are removed first and then added back in # so all unique keys are removed first and then added back in
$dbh->bz_drop_index('groups', 'groups_bit_idx'); $dbh->bz_drop_index('groups', 'groups_bit_idx');
...@@ -1331,8 +1332,6 @@ sub _convert_groups_system_from_groupset { ...@@ -1331,8 +1332,6 @@ sub _convert_groups_system_from_groupset {
$dbh->bz_add_index('groups', 'groups_name_idx', $dbh->bz_add_index('groups', 'groups_name_idx',
{TYPE => 'UNIQUE', FIELDS => [qw(name)]}); {TYPE => 'UNIQUE', FIELDS => [qw(name)]});
$dbh->bz_add_column('profiles', 'refreshed_when',
{TYPE => 'DATETIME', NOTNULL => 1}, '0000-00-00 00:00:00');
# Convert all existing groupset records to map entries before removing # Convert all existing groupset records to map entries before removing
# groupset fields or removing "bit" from groups. # groupset fields or removing "bit" from groups.
...@@ -1979,9 +1978,6 @@ sub _add_user_group_map_grant_type { ...@@ -1979,9 +1978,6 @@ sub _add_user_group_map_grant_type {
$dbh->bz_add_index('user_group_map', 'user_group_map_user_id_idx', $dbh->bz_add_index('user_group_map', 'user_group_map_user_id_idx',
{TYPE => 'UNIQUE', {TYPE => 'UNIQUE',
FIELDS => [qw(user_id group_id grant_type isbless)]}); FIELDS => [qw(user_id group_id grant_type isbless)]});
# Make sure groups get rederived
$dbh->do("UPDATE groups SET last_changed = NOW() WHERE name = 'admin'");
} }
} }
...@@ -2065,12 +2061,6 @@ sub _rename_votes_count_and_force_group_refresh { ...@@ -2065,12 +2061,6 @@ sub _rename_votes_count_and_force_group_refresh {
# Renaming the 'count' column in the votes table because Sybase doesn't # Renaming the 'count' column in the votes table because Sybase doesn't
# like it # like it
if ($dbh->bz_column_info('votes', 'count')) { if ($dbh->bz_column_info('votes', 'count')) {
# 2003-04-24 - myk@mozilla.org/bbaetz@acm.org, bug 201018
# Force all cached groups to be updated at login, due to security bug
# Do this here, inside the next schema change block, so that it doesn't
# get invalidated on every checksetup run.
$dbh->do("UPDATE profiles SET refreshed_when='1900-01-01 00:00:00'");
$dbh->bz_rename_column('votes', 'count', 'vote_count'); $dbh->bz_rename_column('votes', 'count', 'vote_count');
} }
} }
......
...@@ -707,9 +707,6 @@ sub derive_regexp_groups { ...@@ -707,9 +707,6 @@ sub derive_regexp_groups {
my $sth; my $sth;
# avoid races, we are only up to date as of the BEGINNING of this process
my $time = $dbh->selectrow_array("SELECT NOW()");
# add derived records for any matching regexps # add derived records for any matching regexps
$sth = $dbh->prepare("SELECT id, userregexp, user_group_map.group_id $sth = $dbh->prepare("SELECT id, userregexp, user_group_map.group_id
...@@ -735,9 +732,6 @@ sub derive_regexp_groups { ...@@ -735,9 +732,6 @@ sub derive_regexp_groups {
$group_delete->execute($id, $group, GRANT_REGEXP) if $present; $group_delete->execute($id, $group, GRANT_REGEXP) if $present;
} }
} }
$dbh->do(q{UPDATE profiles SET refreshed_when = ? WHERE userid = ?},
undef, ($time, $id));
} }
sub product_responsibilities { sub product_responsibilities {
...@@ -1363,8 +1357,8 @@ sub insert_new_user { ...@@ -1363,8 +1357,8 @@ sub insert_new_user {
# Insert the new user record into the database. # Insert the new user record into the database.
$dbh->do("INSERT INTO profiles $dbh->do("INSERT INTO profiles
(login_name, realname, cryptpassword, disabledtext, (login_name, realname, cryptpassword, disabledtext,
refreshed_when, disable_mail) disable_mail)
VALUES (?, ?, ?, ?, '1901-01-01 00:00:00', ?)", VALUES (?, ?, ?, ?, ?)",
undef, undef,
($username, $realname, $cryptpassword, $disabledtext, ($username, $realname, $cryptpassword, $disabledtext,
$disable_mail)); $disable_mail));
......
...@@ -446,9 +446,8 @@ sub AddGroup { ...@@ -446,9 +446,8 @@ sub AddGroup {
print "Adding group $name ...\n"; print "Adding group $name ...\n";
my $sth = $dbh->prepare('INSERT INTO groups my $sth = $dbh->prepare('INSERT INTO groups
(name, description, userregexp, isbuggroup, (name, description, userregexp, isbuggroup)
last_changed) VALUES (?, ?, ?, ?)');
VALUES (?, ?, ?, ?, NOW())');
$sth->execute($name, $desc, $userregexp, 0); $sth->execute($name, $desc, $userregexp, 0);
my $last = $dbh->bz_last_key('groups', 'id'); my $last = $dbh->bz_last_key('groups', 'id');
......
...@@ -289,9 +289,8 @@ if ($action eq 'new') { ...@@ -289,9 +289,8 @@ if ($action eq 'new') {
# Add the new group # Add the new group
$dbh->do('INSERT INTO groups $dbh->do('INSERT INTO groups
(name, description, isbuggroup, (name, description, isbuggroup, userregexp, isactive)
userregexp, isactive, last_changed) VALUES (?, ?, 1, ?, ?)',
VALUES (?, ?, 1, ?, ?, NOW())',
undef, ($name, $desc, $regexp, $isactive)); undef, ($name, $desc, $regexp, $isactive));
my $gid = $dbh->bz_last_key('groups', 'id'); my $gid = $dbh->bz_last_key('groups', 'id');
...@@ -566,9 +565,6 @@ if (($action eq 'remove_all_regexp') || ($action eq 'remove_all')) { ...@@ -566,9 +565,6 @@ if (($action eq 'remove_all_regexp') || ($action eq 'remove_all')) {
push(@users, $user); push(@users, $user);
} }
} }
$dbh->do('UPDATE groups SET last_changed = NOW()
WHERE id = ?', undef, $gid);
$dbh->bz_unlock_tables(); $dbh->bz_unlock_tables();
$vars->{'users'} = \@users; $vars->{'users'} = \@users;
...@@ -711,12 +707,6 @@ sub doGroupChanges { ...@@ -711,12 +707,6 @@ sub doGroupChanges {
} }
} }
if ($chgs) {
# mark the changes
$dbh->do('UPDATE groups SET last_changed = NOW()
WHERE id = ?', undef, $gid);
}
$dbh->bz_unlock_tables(); $dbh->bz_unlock_tables();
return $gid, $chgs, $name, $regexp; return $gid, $chgs, $name, $regexp;
} }
...@@ -240,9 +240,8 @@ if ($action eq 'new') { ...@@ -240,9 +240,8 @@ if ($action eq 'new') {
my $group_description = "Access to bugs in the " . my $group_description = "Access to bugs in the " .
$product->name . " product"; $product->name . " product";
$dbh->do('INSERT INTO groups $dbh->do('INSERT INTO groups (name, description, isbuggroup)
(name, description, isbuggroup, last_changed) VALUES (?, ?, ?)',
VALUES (?, ?, ?, NOW())',
undef, ($productgroup, $group_description, 1)); undef, ($productgroup, $group_description, 1));
my $gid = $dbh->bz_last_key('groups', 'id'); my $gid = $dbh->bz_last_key('groups', 'id');
......
...@@ -410,8 +410,6 @@ if ($action eq 'search') { ...@@ -410,8 +410,6 @@ if ($action eq 'search') {
($otherUserID, $userid, ($otherUserID, $userid,
get_field_id('bug_group'), get_field_id('bug_group'),
join(', ', @groupsRemovedFrom), join(', ', @groupsAddedTo))); join(', ', @groupsRemovedFrom), join(', ', @groupsAddedTo)));
$dbh->do('UPDATE profiles SET refreshed_when=? WHERE userid = ?',
undef, ('1900-01-01 00:00:00', $otherUserID));
} }
# XXX: should create profiles_activity entries for blesser changes. # XXX: should create profiles_activity entries for blesser changes.
......
...@@ -822,28 +822,6 @@ BugCheck("bugs INNER JOIN products ON bugs.product_id = products.id " . ...@@ -822,28 +822,6 @@ BugCheck("bugs INNER JOIN products ON bugs.product_id = products.id " .
"Bugs that have enough votes to be confirmed but haven't been"); "Bugs that have enough votes to be confirmed but haven't been");
########################################################################### ###########################################################################
# Date checks
###########################################################################
sub DateCheck {
my $table = shift @_;
my $field = shift @_;
my $dbh = Bugzilla->dbh;
Status("Checking dates in $table.$field");
my $c = $dbh->selectrow_array(qq{SELECT COUNT($field)
FROM $table
WHERE $field > NOW()});
if ($c) {
Alert("Found $c dates in future");
}
}
DateCheck("groups", "last_changed");
DateCheck("profiles", "refreshed_when");
###########################################################################
# Control Values # Control Values
########################################################################### ###########################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment