Bug 192516: Moving the loose .pm files into the Bugzilla directory, where they belong. These files pre-date the Bugzilla directory, and would have gone there had it existed at the time. The four files in question were copied on the CVS server to preserve CVS history in the files. This checkin deletes them from the old location and modifies everything else to know where they are now.

r= myk, gerv
a= justdave
This commit is contained in:
justdave%syndicomm.com 2004-03-18 03:57:05 +00:00
Родитель c3038a68df
Коммит a1e18b181e
18 изменённых файлов: 45 добавлений и 312 удалений

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -26,7 +26,7 @@
use strict;
package Attachment;
package Bugzilla::Attachment;
# This module requires that its caller have said "require CGI.pl" to import
# relevant functions from that script and its companion globals.pl.

Просмотреть файл

@ -20,12 +20,14 @@
# Contributor(s): Dawn Endico <endico@mozilla.org>
# Terry Weissman <terry@mozilla.org>
# Chris Yeh <cyeh@bluemartini.com>
# Bradley Baetz <bbaetz@acm.org>
# Dave Miller <justdave@bugzilla.org>
package Bug;
package Bugzilla::Bug;
use strict;
use RelationSet;
use Bugzilla::RelationSet;
use vars qw($unconfirmedstate $legal_keywords @legal_platform
@legal_priority @legal_severity @legal_opsys @legal_bugs_status
@settable_resolution %components %versions %target_milestone
@ -33,7 +35,7 @@ use vars qw($unconfirmedstate $legal_keywords @legal_platform
use CGI::Carp qw(fatalsToBrowser);
use Attachment;
use Bugzilla::Attachment;
use Bugzilla::Config;
use Bugzilla::Constants;
use Bugzilla::Flag;
@ -190,7 +192,7 @@ sub initBug {
$self->{'qa_contact'} = undef;
}
my $ccSet = new RelationSet;
my $ccSet = new Bugzilla::RelationSet;
$ccSet->mergeFromDB("select who from cc where bug_id=$bug_id");
my @cc = $ccSet->toArrayOfStrings();
if (@cc) {
@ -212,7 +214,7 @@ sub initBug {
}
}
$self->{'attachments'} = Attachment::query($self->{bug_id});
$self->{'attachments'} = Bugzilla::Attachment::query($self->{bug_id});
# The types of flags that can be set on this bug.
# If none, no UI for setting flags will be displayed.

Просмотреть файл

@ -30,7 +30,7 @@ use strict;
package Bugzilla::BugMail;
use RelationSet;
use Bugzilla::RelationSet;
use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Util;
@ -166,7 +166,7 @@ sub ProcessOneBug($) {
trick_taint($start);
trick_taint($end);
my $ccSet = new RelationSet();
my $ccSet = new Bugzilla::RelationSet();
$ccSet->mergeFromDB("SELECT who FROM cc WHERE bug_id = $id");
$values{'cc'} = $ccSet->toString();

Просмотреть файл

@ -34,8 +34,7 @@ use Bugzilla::User;
use Bugzilla::Config;
use Bugzilla::Util;
use Bugzilla::Error;
use Attachment;
use Bugzilla::Attachment;
use constant TABLES_ALREADY_LOCKED => 1;
@ -529,7 +528,7 @@ sub GetTarget {
my $target = { 'exists' => 0 };
if ($attach_id) {
$target->{'attachment'} = new Attachment($attach_id);
$target->{'attachment'} = new Bugzilla::Attachment($attach_id);
if ($bug_id) {
# Make sure the bug and attachment IDs correspond to each other
# (i.e. this is the bug to which this attachment is attached).

Просмотреть файл

@ -1,266 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Dan Mosedale <dmose@mozilla.org>
# Terry Weissman <terry@mozilla.org>
# Dave Miller <justdave@syndicomm.com>
# This object models a set of relations between one item and a group
# of other items. An example is the set of relations between one bug
# and the users CCed on that bug. Currently, the relation objects are
# expected to be bugzilla userids. However, this could and perhaps
# should be generalized to work with non userid objects, such as
# keywords associated with a bug. That shouldn't be hard to do; it
# might involve turning this into a virtual base class, and having
# UserSet and KeywordSet types that inherit from it.
use strict;
# Everything that uses RelationSet should already have globals.pl loaded
# so we don't want to load it here. Doing so causes a loop in Perl because
# globals.pl turns around and does a 'use RelationSet'
# See http://bugzilla.mozilla.org/show_bug.cgi?id=72862
#require "globals.pl";
package RelationSet;
# create a new empty RelationSet
#
sub new {
my $type = shift();
# create a ref to an empty hash and bless it
#
my $self = {};
bless $self, $type;
# construct from a comma-delimited string
#
if ($#_ == 0) {
$self->mergeFromString($_[0]);
}
# unless this was a constructor for an empty list, somebody screwed up.
#
elsif ( $#_ != -1 ) {
confess("invalid number of arguments");
}
# bless as a RelationSet
#
return $self;
}
# Assumes that the set of relations "FROM $table WHERE $constantSql and
# $column = $value" is currently represented by $self, and this set should
# be updated to look like $other.
#
# Returns an array of two strings, one INSERT and one DELETE, which will
# make this change. Either or both strings may be the empty string,
# meaning that no INSERT or DELETE or both (respectively) need to be done.
#
# THE CALLER IS RESPONSIBLE FOR ANY DESIRED LOCKING AND/OR CONSISTENCY
# CHECKS (not to mention doing the SendSQL() calls).
#
sub generateSqlDeltas {
($#_ == 5) || confess("invalid number of arguments");
my ( $self, # instance ptr to set representing the existing state
$endState, # instance ptr to set representing the desired state
$table, # table where these relations are kept
$invariantName, # column held const for a RelationSet (often "bug_id")
$invariantValue, # what to hold the above column constant at
$columnName # the column which varies (often a userid)
) = @_;
# construct the insert list by finding relations which exist in the
# end state but not the current state.
#
my @endStateRelations = keys(%$endState);
my @insertList = ();
foreach ( @endStateRelations ) {
push ( @insertList, $_ ) if ( ! exists $$self{"$_"} );
}
# we've built the list. If it's non-null, add required sql chrome.
#
my $sqlInsert="";
if ( $#insertList > -1 ) {
$sqlInsert = "INSERT INTO $table ($invariantName, $columnName) VALUES " .
join (",",
map ( "($invariantValue, $_)" , @insertList )
);
}
# construct the delete list by seeing which relations exist in the
# current state but not the end state
#
my @selfRelations = keys(%$self);
my @deleteList = ();
foreach ( @selfRelations ) {
push (@deleteList, $_) if ( ! exists $$endState{"$_"} );
}
# we've built the list. if it's non-empty, add required sql chrome.
#
my $sqlDelete = "";
if ( $#deleteList > -1 ) {
$sqlDelete = "DELETE FROM $table WHERE $invariantName = $invariantValue " .
"AND $columnName IN ( " . join (",", @deleteList) . " )";
}
return ($sqlInsert, $sqlDelete);
}
# compare the current object with another.
#
sub isEqual {
($#_ == 1) || confess("invalid number of arguments");
my $self = shift();
my $other = shift();
# get arrays of the keys for faster processing
#
my @selfRelations = keys(%$self);
my @otherRelations = keys(%$other);
# make sure the arrays are the same size
#
return 0 if ( $#selfRelations != $#otherRelations );
# bail out if any of the elements are different
#
foreach my $relation ( @selfRelations ) {
return 0 if ( !exists $$other{$relation})
}
# we made it!
#
return 1;
}
# merge the results of a SQL command into this set
#
sub mergeFromDB {
( $#_ == 1 ) || confess("invalid number of arguments");
my $self = shift();
&::SendSQL(shift());
while (my @row = &::FetchSQLData()) {
$$self{$row[0]} = 1;
}
return;
}
# merge a set in string form into this set
#
sub mergeFromString {
($#_ == 1) || confess("invalid number of arguments");
my $self = shift();
# do the merge
#
foreach my $person (split(/[ ,]/, shift())) {
if ($person ne "") {
$$self{&::DBNameToIdAndCheck($person)} = 1;
}
}
}
# remove a set in string form from this set
#
sub removeItemsInString {
($#_ == 1) || confess("invalid number of arguments");
my $self = shift();
# do the merge
#
foreach my $person (split(/[ ,]/, shift())) {
if ($person ne "") {
my $dbid = &::DBNameToIdAndCheck($person);
if (exists $$self{$dbid}) {
delete $$self{$dbid};
}
}
}
}
# remove a set in array form from this set
#
sub removeItemsInArray {
($#_ > 0) || confess("invalid number of arguments");
my $self = shift();
# do the merge
#
while (my $person = shift()) {
if ($person ne "") {
my $dbid = &::DBNameToIdAndCheck($person);
if (exists $$self{$dbid}) {
delete $$self{$dbid};
}
}
}
}
# return the number of elements in this set
#
sub size {
my $self = shift();
my @k = keys(%$self);
return $#k++;
}
# return this set in array form
#
sub toArray {
my $self= shift();
return keys(%$self);
}
# return this set as an array of strings
#
sub toArrayOfStrings {
($#_ == 0) || confess("invalid number of arguments");
my $self = shift();
my @result = ();
foreach my $i ( keys %$self ) {
push @result, &::DBID_to_name($i);
}
return sort { lc($a) cmp lc($b) } @result;
}
# return this set in string form (comma-separated and sorted)
#
sub toString {
($#_ == 0) || confess("invalid number of arguments");
my $self = shift();
my @result = ();
foreach my $i ( keys %$self ) {
push @result, &::DBID_to_name($i);
}
return join(',', sort(@result));
}
1;

Просмотреть файл

@ -27,7 +27,7 @@
use strict;
# Bundle the functions in this file together into the "Token" package.
package Token;
package Bugzilla::Token;
use Bugzilla::Config;
use Bugzilla::Error;

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1348,7 +1348,6 @@ if ($^O !~ /MSWin32/i) {
fixPerms('css', $<, $webservergid, 027, 1);
fixPerms('js', $<, $webservergid, 027, 1);
chmod 0644, 'globals.pl';
chmod 0644, 'RelationSet.pm';
# Don't use fixPerms here, because it won't change perms on the directory
# unless its using recursion

Просмотреть файл

@ -74,7 +74,7 @@ use DBI;
use Date::Format; # For time2str().
use Date::Parse; # For str2time().
use RelationSet;
use Bugzilla::RelationSet;
# Use standard Perl libraries for cross-platform file/directory manipulation.
use File::Spec;
@ -354,8 +354,8 @@ sub GetVersionTable {
$mtime = 0;
}
if (time() - $mtime > 3600) {
use Token;
Token::CleanTokenTable() if Bugzilla->dbwritesallowed;
use Bugzilla::Token;
Bugzilla::Token::CleanTokenTable() if Bugzilla->dbwritesallowed;
GenerateVersionTable();
}
require "$datadir/versioncache";

Просмотреть файл

@ -30,8 +30,8 @@ require "CGI.pl";
use vars qw($template $userid %COOKIE);
use Bug;
use Bugzilla;
use Bugzilla::Bug;
use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::BugMail;
@ -106,7 +106,7 @@ my @bugs;
print "<P>\n";
foreach my $id (split(/:/, $::FORM{'buglist'})) {
my $bug = new Bug($id, $::userid);
my $bug = new Bugzilla::Bug($id, $::userid);
push @bugs, $bug;
if (!$bug->error) {
my $exporterid = DBNameToIdAndCheck($exporter);
@ -155,7 +155,7 @@ $from =~ s/@/\@/;
$msg .= "From: Bugzilla <" . $from . ">\n";
$msg .= "Subject: Moving bug(s) $buglist\n\n";
my @fieldlist = (Bug::fields(), 'group', 'long_desc', 'attachment');
my @fieldlist = (Bugzilla::Bug::fields(), 'group', 'long_desc', 'attachment');
my %displayfields;
foreach (@fieldlist) {
$displayfields{$_} = 1;

Просмотреть файл

@ -30,7 +30,7 @@ use Bugzilla;
use Bugzilla::Constants;
require "CGI.pl";
use Bug;
use Bugzilla::Bug;
use Bugzilla::User;
@ -478,7 +478,7 @@ if (defined $::FORM{'qa_contact'}) {
}
$vars->{'id'} = $id;
my $bug = new Bug($id, $::userid);
my $bug = new Bugzilla::Bug($id, $::userid);
$vars->{'bug'} = $bug;
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;

Просмотреть файл

@ -35,10 +35,9 @@ use Bugzilla;
use Bugzilla::Constants;
require "CGI.pl";
use Bug;
use Bugzilla::Bug;
use Bugzilla::User;
use RelationSet;
use Bugzilla::RelationSet;
# Use the Flag module to modify flag data if the user set flags.
use Bugzilla::Flag;
@ -330,8 +329,8 @@ my $qacontactid;
# CheckCanChangeField() defines what users are allowed to change what bugs. You
# can add code here for site-specific policy changes, according to the
# instructions given in the Bugzilla Guide and below. Note that you may also
# have to update the Bug::user() function to give people access to the options
# that they are permitted to change.
# have to update the Bugzilla::Bug::user() function to give people access to the
# options that they are permitted to change.
#
# CheckCanChangeField() should return true if the user is allowed to change this
# field, and false if they are not.
@ -1752,7 +1751,7 @@ foreach my $id (@idlist) {
# now show the next bug
if ($next_bug) {
if (detaint_natural($next_bug) && CanSeeBug($next_bug, $::userid)) {
my $bug = new Bug($next_bug, $::userid);
my $bug = new Bugzilla::Bug($next_bug, $::userid);
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
# next.html.tmpl includes edit.html.tmpl, and therefore we

Просмотреть файл

@ -32,7 +32,7 @@ ConnectToDatabase();
use vars qw($template $vars $userid);
use Bug;
use Bugzilla::Bug;
my $cgi = Bugzilla->cgi;
@ -65,10 +65,10 @@ if ($single) {
# Its a bit silly to do the validation twice - that functionality should
# probably move into Bug.pm at some point
ValidateBugID($id);
push @bugs, new Bug($id, $userid);
push @bugs, new Bugzilla::Bug($id, $userid);
} else {
foreach my $id ($cgi->param('id')) {
my $bug = new Bug($id, $userid);
my $bug = new Bugzilla::Bug($id, $userid);
push @bugs, $bug;
}
}
@ -93,7 +93,7 @@ $vars->{'bug_list'} = \@bug_list;
# If no explicit list is defined, we show all fields. We then exclude any
# on the exclusion list. This is so you can say e.g. "Everything except
# attachments" without listing almost all the fields.
my @fieldlist = (Bug::fields(), 'group', 'long_desc', 'attachment');
my @fieldlist = (Bugzilla::Bug::fields(), 'group', 'long_desc', 'attachment');
my %displayfields;
if ($cgi->param("field")) {

Просмотреть файл

@ -41,9 +41,9 @@ require "CGI.pl";
ConnectToDatabase();
quietly_check_login('permit_anonymous');
# Use the "Token" module that contains functions for doing various
# Use the "Bugzilla::Token" module that contains functions for doing various
# token-related tasks.
use Token;
use Bugzilla::Token;
use Bugzilla::User;
@ -72,7 +72,7 @@ if ($cgi->param('t')) {
}
Token::CleanTokenTable();
Bugzilla::Token::CleanTokenTable();
# Make sure the token exists in the database.
SendSQL( "SELECT tokentype FROM tokens WHERE token = $::quotedtoken" );
@ -80,17 +80,17 @@ if ($cgi->param('t')) {
# Make sure the token is the correct type for the action being taken.
if ( grep($::action eq $_ , qw(cfmpw cxlpw chgpw)) && $tokentype ne 'password' ) {
Token::Cancel($::token, "wrong_token_for_changing_passwd");
Bugzilla::Token::Cancel($::token, "wrong_token_for_changing_passwd");
ThrowUserError("wrong_token_for_changing_passwd");
}
if ( ($::action eq 'cxlem')
&& (($tokentype ne 'emailold') && ($tokentype ne 'emailnew')) ) {
Token::Cancel($::token, "wrong_token_for_cancelling_email_change");
Bugzilla::Token::Cancel($::token, "wrong_token_for_cancelling_email_change");
ThrowUserError("wrong_token_for_cancelling_email_change");
}
if ( grep($::action eq $_ , qw(cfmem chgem))
&& ($tokentype ne 'emailnew') ) {
Token::Cancel($::token, "wrong_token_for_confirming_email_change");
Bugzilla::Token::Cancel($::token, "wrong_token_for_confirming_email_change");
ThrowUserError("wrong_token_for_confirming_email_change");
}
}
@ -176,7 +176,7 @@ sub confirmChangePassword {
sub cancelChangePassword {
$vars->{'message'} = "password_change_canceled";
Token::Cancel($::token, $vars->{'message'});
Bugzilla::Token::Cancel($::token, $vars->{'message'});
print $cgi->header();
$template->process("global/message.html.tmpl", $vars)
@ -308,7 +308,7 @@ sub cancelChangeEmail {
$vars->{'old_email'} = $old_email;
$vars->{'new_email'} = $new_email;
Token::Cancel($::token, $vars->{'message'});
Bugzilla::Token::Cancel($::token, $vars->{'message'});
SendSQL("LOCK TABLES tokens WRITE");
SendSQL("DELETE FROM tokens

Просмотреть файл

@ -29,7 +29,7 @@ use Bugzilla;
require "CGI.pl";
use RelationSet;
use Bugzilla::RelationSet;
# Use global template variables.
use vars qw($template $vars $userid);
@ -121,9 +121,9 @@ sub SaveAccount {
$cgi->param('Bugzilla_password')
|| ThrowCodeError("old_password_required");
use Token;
use Bugzilla::Token;
# Block multiple email changes for the same user.
if (Token::HasEmailChangeToken($userid)) {
if (Bugzilla::Token::HasEmailChangeToken($userid)) {
ThrowUserError("email_change_in_progress");
}
@ -133,7 +133,7 @@ sub SaveAccount {
ValidateNewUser($new_login_name)
|| ThrowUserError("account_exists", {email => $new_login_name});
Token::IssueEmailChangeToken($userid,$old_login_name,
Bugzilla::Token::IssueEmailChangeToken($userid,$old_login_name,
$new_login_name);
$vars->{'email_changes_saved'} = 1;
@ -148,7 +148,7 @@ sub SaveAccount {
sub DoEmail {
if (Param("supportwatchers")) {
my $watcheduserSet = new RelationSet;
my $watcheduserSet = new Bugzilla::RelationSet;
$watcheduserSet->mergeFromDB("SELECT watched FROM watch WHERE" .
" watcher=$userid");
$vars->{'watchedusers'} = $watcheduserSet->toString();
@ -246,12 +246,12 @@ sub SaveEmail {
SendSQL("LOCK TABLES watch WRITE, profiles READ");
# what the db looks like now
my $origWatchedUsers = new RelationSet;
my $origWatchedUsers = new Bugzilla::RelationSet;
$origWatchedUsers->mergeFromDB("SELECT watched FROM watch WHERE" .
" watcher=$userid");
# Update the database to look like the form
my $newWatchedUsers = new RelationSet($cgi->param('watchedusers'));
my $newWatchedUsers = new Bugzilla::RelationSet($cgi->param('watchedusers'));
my @CCDELTAS = $origWatchedUsers->generateSqlDeltas(
$newWatchedUsers,
"watch",