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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
dcb07b50
Commit
dcb07b50
authored
Aug 14, 2002
by
bbaetz%student.usyd.edu.au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 153578 - Attachment modified date is meant to be attachment creation
date r=preed, joel
parent
0c535b34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
12 deletions
+49
-12
attachment.cgi
attachment.cgi
+3
-9
checksetup.pl
checksetup.pl
+45
-2
list.html.tmpl
template/en/default/attachment/list.html.tmpl
+1
-1
No files found.
attachment.cgi
View file @
dcb07b50
...
...
@@ -382,11 +382,6 @@ sub viewall
(
$a
{
'attachid'
},
$a
{
'date'
},
$a
{
'contenttype'
},
$a
{
'description'
},
$a
{
'ispatch'
},
$a
{
'isobsolete'
})
=
FetchSQLData
();
# Format the attachment's creation/modification date into something readable.
if
(
$a
{
'date'
}
=~
/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/
)
{
$a
{
'date'
}
=
"$3/$4/$2 $5:$6"
;
}
# Flag attachments as to whether or not they can be viewed (as opposed to
# being downloaded). Currently I decide they are viewable if their MIME type
# is either text/*, image/*, or application/vnd.mozilla.*.
...
...
@@ -480,8 +475,8 @@ sub insert
my
$thedata
=
SqlQuote
(
$::FORM
{
'data'
});
# Insert the attachment into the database.
SendSQL
(
"INSERT INTO attachments (bug_id, filename, description, mimetype, ispatch, submitter_id, thedata)
VALUES ($::FORM{'bugid'}, $filename, $description, $contenttype, $::FORM{'ispatch'}, $::userid, $thedata)"
);
SendSQL
(
"INSERT INTO attachments (bug_id,
creation_ts,
filename, description, mimetype, ispatch, submitter_id, thedata)
VALUES ($::FORM{'bugid'},
now(),
$filename, $description, $contenttype, $::FORM{'ispatch'}, $::userid, $thedata)"
);
# Retrieve the ID of the newly created attachment record.
SendSQL
(
"SELECT LAST_INSERT_ID()"
);
...
...
@@ -676,8 +671,7 @@ sub update
SET description = $quoteddescription ,
mimetype = $quotedcontenttype ,
ispatch = $::FORM{'ispatch'} ,
isobsolete = $::FORM{'isobsolete'} ,
creation_ts = creation_ts
isobsolete = $::FORM{'isobsolete'}
WHERE attach_id = $::FORM{'id'}
"
);
...
...
checksetup.pl
View file @
dcb07b50
...
...
@@ -1310,7 +1310,7 @@ $table{bugs_activity} =
$table
{
attachments
}
=
'attach_id mediumint not null auto_increment primary key,
bug_id mediumint not null,
creation_ts
timestamp
,
creation_ts
datetime not null
,
description mediumtext not null,
mimetype mediumtext not null,
ispatch tinyint,
...
...
@@ -3159,7 +3159,50 @@ if (GetFieldDef("products", "product")) {
$dbh
->
do
(
"ALTER TABLE components ADD UNIQUE (product_id, name)"
);
$dbh
->
do
(
"ALTER TABLE components ADD INDEX (name)"
);
}
# 2002-08-XX - bbaetz@student.usyd.edu.au - bug 153578
# attachments creation time needs to be a datetime, not a timestamp
my
$fielddef
;
if
((
$fielddef
=
GetFieldDef
(
"attachments"
,
"creation_ts"
))
&&
$fielddef
->
[
1
]
=~
/^timestamp/
)
{
print
"Fixing creation time on attachments...\n"
;
my
$sth
=
$dbh
->
prepare
(
"SELECT COUNT(attach_id) FROM attachments"
);
$sth
->
execute
();
my
(
$attach_count
)
=
$sth
->
fetchrow_array
();
if
(
$attach_count
>
1000
)
{
print
"This may take a while...\n"
;
}
my
$i
=
0
;
# This isn't just as simple as changing the field type, because
# the creation_ts was previously updated when an attachment was made
# obsolete from the attachment creation screen. So we have to go
# and recreate these times from the comments..
$sth
=
$dbh
->
prepare
(
"SELECT bug_id, attach_id, submitter_id "
.
"FROM attachments"
);
$sth
->
execute
();
# Restrict this as much as possible in order to avoid false positives, and
# keep the db search time down
my
$sth2
=
$dbh
->
prepare
(
"SELECT bug_when FROM longdescs WHERE bug_id=? AND who=? AND thetext LIKE ? ORDER BY bug_when LIMIT 1"
);
while
(
my
(
$bug_id
,
$attach_id
,
$submitter_id
)
=
$sth
->
fetchrow_array
())
{
$sth2
->
execute
(
$bug_id
,
$submitter_id
,
"Created an attachment (id=$attach_id)%"
);
my
(
$when
)
=
$sth2
->
fetchrow_array
();
if
(
$when
)
{
$dbh
->
do
(
"UPDATE attachments SET creation_ts='$when' WHERE attach_id=$attach_id"
);
}
else
{
print
"Warning - could not determine correct creation time for attachment $attach_id on bug $bug_id\n"
;
}
++
$i
;
print
"Converted $i of $attach_count attachments\n"
if
!
(
$i
%
1000
);
}
print
"Done - converted $i attachments\n"
;
ChangeFieldType
(
"attachments"
,
"creation_ts"
,
"datetime NOT NULL"
);
}
# If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment.
#
...
...
template/en/default/attachment/list.html.tmpl
View file @
dcb07b50
...
...
@@ -24,7 +24,7 @@
<tr>
<th bgcolor="#cccccc" align="left">Attachment</th>
<th bgcolor="#cccccc" align="left">Type</th>
<th bgcolor="#cccccc" align="left">
Modifi
ed</th>
<th bgcolor="#cccccc" align="left">
Creat
ed</th>
<th bgcolor="#cccccc" align="left">Status</th>
<th bgcolor="#cccccc" align="left">Actions</th>
</tr>
...
...
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