Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
b0d0cb15
Commit
b0d0cb15
authored
Jul 20, 2005
by
lpsolit%gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 301440: Move LogActivityEntry out of CGI.pl - Patch by Frédéric Buclin…
Bug 301440: Move LogActivityEntry out of CGI.pl - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave
parent
f0a9bdd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
37 deletions
+49
-37
Bug.pm
Bugzilla/Bug.pm
+48
-0
CGI.pl
CGI.pl
+0
-37
editmilestones.cgi
editmilestones.cgi
+1
-0
No files found.
Bugzilla/Bug.pm
View file @
b0d0cb15
...
@@ -52,10 +52,22 @@ use base qw(Exporter);
...
@@ -52,10 +52,22 @@ use base qw(Exporter);
AppendComment ValidateComment
AppendComment ValidateComment
bug_alias_to_id ValidateBugAlias ValidateBugID
bug_alias_to_id ValidateBugAlias ValidateBugID
RemoveVotes CheckIfVotedConfirmed
RemoveVotes CheckIfVotedConfirmed
LogActivityEntry
)
;
)
;
#####################################################################
# Constants
#####################################################################
# Used in LogActivityEntry(). Gives the max length of lines in the
# activity table.
use
constant
MAX_LINE_LENGTH
=>
254
;
# Used in ValidateComment(). Gives the max length allowed for a comment.
use
constant
MAX_COMMENT_LENGTH
=>
65535
;
use
constant
MAX_COMMENT_LENGTH
=>
65535
;
#####################################################################
sub
fields
{
sub
fields
{
# Keep this ordering in sync with bugzilla.dtd
# Keep this ordering in sync with bugzilla.dtd
my
@fields
=
qw(bug_id alias creation_ts short_desc delta_ts
my
@fields
=
qw(bug_id alias creation_ts short_desc delta_ts
...
@@ -918,6 +930,42 @@ sub GetBugActivity {
...
@@ -918,6 +930,42 @@ sub GetBugActivity {
return
(
\
@operations
,
$incomplete_data
);
return
(
\
@operations
,
$incomplete_data
);
}
}
# Update the bugs_activity table to reflect changes made in bugs.
sub
LogActivityEntry
{
my
(
$i
,
$col
,
$removed
,
$added
,
$whoid
,
$timestamp
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
# in the case of CCs, deps, and keywords, there's a possibility that someone
# might try to add or remove a lot of them at once, which might take more
# space than the activity table allows. We'll solve this by splitting it
# into multiple entries if it's too long.
while
(
$removed
||
$added
)
{
my
(
$removestr
,
$addstr
)
=
(
$removed
,
$added
);
if
(
length
(
$removestr
)
>
MAX_LINE_LENGTH
)
{
my
$commaposition
=
find_wrap_point
(
$removed
,
MAX_LINE_LENGTH
);
$removestr
=
substr
(
$removed
,
0
,
$commaposition
);
$removed
=
substr
(
$removed
,
$commaposition
);
$removed
=~
s/^[,\s]+//
;
# remove any comma or space
}
else
{
$removed
=
""
;
# no more entries
}
if
(
length
(
$addstr
)
>
MAX_LINE_LENGTH
)
{
my
$commaposition
=
find_wrap_point
(
$added
,
MAX_LINE_LENGTH
);
$addstr
=
substr
(
$added
,
0
,
$commaposition
);
$added
=
substr
(
$added
,
$commaposition
);
$added
=~
s/^[,\s]+//
;
# remove any comma or space
}
else
{
$added
=
""
;
# no more entries
}
trick_taint
(
$addstr
);
trick_taint
(
$removestr
);
my
$fieldid
=
&::
GetFieldID
(
$col
);
$dbh
->
do
(
"INSERT INTO bugs_activity
(bug_id, who, bug_when, fieldid, removed, added)
VALUES (?, ?, ?, ?, ?, ?)"
,
undef
,
(
$i
,
$whoid
,
$timestamp
,
$fieldid
,
$removestr
,
$addstr
));
}
}
# CountOpenDependencies counts the number of open dependent bugs for a
# CountOpenDependencies counts the number of open dependent bugs for a
# list of bugs and returns a list of bug_id's and their dependency count
# list of bugs and returns a list of bug_id's and their dependency count
# It takes one parameter:
# It takes one parameter:
...
...
CGI.pl
View file @
b0d0cb15
...
@@ -40,10 +40,6 @@ use Bugzilla::BugMail;
...
@@ -40,10 +40,6 @@ use Bugzilla::BugMail;
use
Bugzilla::
Bug
;
use
Bugzilla::
Bug
;
use
Bugzilla::
User
;
use
Bugzilla::
User
;
# Used in LogActivityEntry(). Gives the max length of lines in the
# activity table.
use
constant
MAX_LINE_LENGTH
=>
254
;
# Shut up misguided -w warnings about "used only once". For some reason,
# Shut up misguided -w warnings about "used only once". For some reason,
# "use vars" chokes on me when I try it here.
# "use vars" chokes on me when I try it here.
...
@@ -128,39 +124,6 @@ sub PutFooter {
...
@@ -128,39 +124,6 @@ sub PutFooter {
||
ThrowTemplateError
(
$::template
->
error
());
||
ThrowTemplateError
(
$::template
->
error
());
}
}
sub
LogActivityEntry
{
my
(
$i
,
$col
,
$removed
,
$added
,
$whoid
,
$timestamp
)
=
@_
;
# in the case of CCs, deps, and keywords, there's a possibility that someone
# might try to add or remove a lot of them at once, which might take more
# space than the activity table allows. We'll solve this by splitting it
# into multiple entries if it's too long.
while
(
$removed
||
$added
)
{
my
(
$removestr
,
$addstr
)
=
(
$removed
,
$added
);
if
(
length
(
$removestr
)
>
MAX_LINE_LENGTH
)
{
my
$commaposition
=
find_wrap_point
(
$removed
,
MAX_LINE_LENGTH
);
$removestr
=
substr
(
$removed
,
0
,
$commaposition
);
$removed
=
substr
(
$removed
,
$commaposition
);
$removed
=~
s/^[,\s]+//
;
# remove any comma or space
}
else
{
$removed
=
""
;
# no more entries
}
if
(
length
(
$addstr
)
>
MAX_LINE_LENGTH
)
{
my
$commaposition
=
find_wrap_point
(
$added
,
MAX_LINE_LENGTH
);
$addstr
=
substr
(
$added
,
0
,
$commaposition
);
$added
=
substr
(
$added
,
$commaposition
);
$added
=~
s/^[,\s]+//
;
# remove any comma or space
}
else
{
$added
=
""
;
# no more entries
}
$addstr
=
SqlQuote
(
$addstr
);
$removestr
=
SqlQuote
(
$removestr
);
my
$fieldid
=
GetFieldID
(
$col
);
SendSQL
(
"INSERT INTO bugs_activity "
.
"(bug_id,who,bug_when,fieldid,removed,added) VALUES "
.
"($i,$whoid,"
.
SqlQuote
(
$timestamp
)
.
",$fieldid,$removestr,$addstr)"
);
}
}
############# Live code below here (that is, not subroutine defs) #############
############# Live code below here (that is, not subroutine defs) #############
use
Bugzilla
;
use
Bugzilla
;
...
...
editmilestones.cgi
View file @
b0d0cb15
...
@@ -25,6 +25,7 @@ require "globals.pl";
...
@@ -25,6 +25,7 @@ require "globals.pl";
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Config
qw(:DEFAULT $datadir)
;
use
Bugzilla::
Config
qw(:DEFAULT $datadir)
;
use
Bugzilla::
User
;
use
Bugzilla::
User
;
use
Bugzilla::
Bug
;
use
vars
qw($template $vars)
;
use
vars
qw($template $vars)
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment