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
bc14d441
Commit
bc14d441
authored
Aug 17, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 341933: Make bug object creation much lighter
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
parent
b0f0bf66
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
23 deletions
+54
-23
Bug.pm
Bugzilla/Bug.pm
+50
-19
enter_bug.cgi
enter_bug.cgi
+3
-3
votes.cgi
votes.cgi
+1
-1
No files found.
Bugzilla/Bug.pm
View file @
bc14d441
...
...
@@ -100,10 +100,9 @@ sub _init {
my
$query
=
"
SELECT
bugs.bug_id, alias, products.classification_id, classifications.name,
bugs.product_id, products.name, version,
bugs.bug_id, alias, bugs.product_id, version,
rep_platform, op_sys, bug_status, resolution, priority,
bug_severity, bugs.component_id,
components.name,
bug_severity, bugs.component_id,
assigned_to AS assigned_to_id, reporter AS reporter_id,
bug_file_loc, short_desc, target_milestone,
qa_contact AS qa_contact_id, status_whiteboard, "
.
...
...
@@ -112,14 +111,7 @@ sub _init {
estimated_time, remaining_time, "
.
$dbh
->
sql_date_format
(
'deadline'
,
'%Y-%m-%d'
)
.
$custom_fields
.
"
FROM bugs
INNER JOIN components
ON components.id = bugs.component_id
INNER JOIN products
ON products.id = bugs.product_id
INNER JOIN classifications
ON classifications.id = products.classification_id
WHERE bugs.bug_id = ?"
;
FROM bugs WHERE bugs.bug_id = ?"
;
my
$bug_sth
=
$dbh
->
prepare
(
$query
);
$bug_sth
->
execute
(
$bug_id
);
...
...
@@ -128,10 +120,9 @@ sub _init {
if
(
@row
=
$bug_sth
->
fetchrow_array
)
{
my
$count
=
0
;
my
%
fields
;
foreach
my
$field
(
"bug_id"
,
"alias"
,
"classification_id"
,
"classification"
,
"product_id"
,
"product"
,
"version"
,
foreach
my
$field
(
"bug_id"
,
"alias"
,
"product_id"
,
"version"
,
"rep_platform"
,
"op_sys"
,
"bug_status"
,
"resolution"
,
"priority"
,
"bug_severity"
,
"component_id"
,
"component"
,
"priority"
,
"bug_severity"
,
"component_id"
,
"assigned_to_id"
,
"reporter_id"
,
"bug_file_loc"
,
"short_desc"
,
"target_milestone"
,
"qa_contact_id"
,
"status_whiteboard"
,
...
...
@@ -368,6 +359,36 @@ sub cc {
return
$self
->
{
'cc'
};
}
sub
component
{
my
(
$self
)
=
@_
;
return
$self
->
{
component
}
if
exists
$self
->
{
component
};
return
''
if
$self
->
{
error
};
(
$self
->
{
component
})
=
Bugzilla
->
dbh
->
selectrow_array
(
'SELECT name FROM components WHERE id = ?'
,
undef
,
$self
->
{
component_id
});
return
$self
->
{
component
};
}
sub
classification_id
{
my
(
$self
)
=
@_
;
return
$self
->
{
classification_id
}
if
exists
$self
->
{
classification_id
};
return
0
if
$self
->
{
error
};
(
$self
->
{
classification_id
})
=
Bugzilla
->
dbh
->
selectrow_array
(
'SELECT classification_id FROM products WHERE id = ?'
,
undef
,
$self
->
{
product_id
});
return
$self
->
{
classification_id
};
}
sub
classification
{
my
(
$self
)
=
@_
;
return
$self
->
{
classification
}
if
exists
$self
->
{
classification
};
return
''
if
$self
->
{
error
};
(
$self
->
{
classification
})
=
Bugzilla
->
dbh
->
selectrow_array
(
'SELECT name FROM classifications WHERE id = ?'
,
undef
,
$self
->
classification_id
);
return
$self
->
{
classification
};
}
sub
dependson
{
my
(
$self
)
=
@_
;
return
$self
->
{
'dependson'
}
if
exists
$self
->
{
'dependson'
};
...
...
@@ -432,11 +453,21 @@ sub milestoneurl {
return
$self
->
{
'milestoneurl'
}
if
exists
$self
->
{
'milestoneurl'
};
return
''
if
$self
->
{
'error'
};
$self
->
{
'prod_obj'
}
||=
new
Bugzilla::
Product
({
name
=>
$self
->
{
'product'
}
});
$self
->
{
'prod_obj'
}
||=
new
Bugzilla::
Product
({
name
=>
$self
->
product
});
$self
->
{
'milestoneurl'
}
=
$self
->
{
'prod_obj'
}
->
milestone_url
;
return
$self
->
{
'milestoneurl'
};
}
sub
product
{
my
(
$self
)
=
@_
;
return
$self
->
{
product
}
if
exists
$self
->
{
product
};
return
''
if
$self
->
{
error
};
(
$self
->
{
product
})
=
Bugzilla
->
dbh
->
selectrow_array
(
'SELECT name FROM products WHERE id = ?'
,
undef
,
$self
->
{
product_id
});
return
$self
->
{
product
};
}
sub
qa_contact
{
my
(
$self
)
=
@_
;
return
$self
->
{
'qa_contact'
}
if
exists
$self
->
{
'qa_contact'
};
...
...
@@ -490,7 +521,7 @@ sub use_votes {
my
(
$self
)
=
@_
;
return
0
if
$self
->
{
'error'
};
$self
->
{
'prod_obj'
}
||=
new
Bugzilla::
Product
({
name
=>
$self
->
{
'product'
}
});
$self
->
{
'prod_obj'
}
||=
new
Bugzilla::
Product
({
name
=>
$self
->
product
});
return
Bugzilla
->
params
->
{
'usevotes'
}
&&
$self
->
{
'prod_obj'
}
->
votes_per_user
>
0
;
...
...
@@ -601,13 +632,13 @@ sub choices {
return
{}
if
$self
->
{
'error'
};
$self
->
{
'choices'
}
=
{};
$self
->
{
prod_obj
}
||=
new
Bugzilla::
Product
({
name
=>
$self
->
{
product
}
});
$self
->
{
prod_obj
}
||=
new
Bugzilla::
Product
({
name
=>
$self
->
product
});
my
@prodlist
=
map
{
$_
->
name
}
@
{
Bugzilla
->
user
->
get_enterable_products
};
# The current product is part of the popup, even if new bugs are no longer
# allowed for that product
if
(
lsearch
(
\
@prodlist
,
$self
->
{
'product'
}
)
<
0
)
{
push
(
@prodlist
,
$self
->
{
'product'
}
);
if
(
lsearch
(
\
@prodlist
,
$self
->
product
)
<
0
)
{
push
(
@prodlist
,
$self
->
product
);
@prodlist
=
sort
@prodlist
;
}
...
...
enter_bug.cgi
View file @
bc14d441
...
...
@@ -346,7 +346,7 @@ foreach my $field (@enter_bug_fields) {
if
(
$cloned_bug_id
)
{
$default
{
'component_'
}
=
$cloned_bug
->
{
'component'
}
;
$default
{
'component_'
}
=
$cloned_bug
->
component
;
$default
{
'priority'
}
=
$cloned_bug
->
{
'priority'
};
$default
{
'bug_severity'
}
=
$cloned_bug
->
{
'bug_severity'
};
$default
{
'rep_platform'
}
=
$cloned_bug
->
{
'rep_platform'
};
...
...
@@ -431,7 +431,7 @@ else {
$vars
->
{
'version'
}
=
[
map
(
$_
->
name
,
@
{
$product
->
versions
})];
if
(
(
$cloned_bug_id
)
&&
(
$product
->
name
eq
$cloned_bug
->
{
'product'
}
)
)
{
(
$product
->
name
eq
$cloned_bug
->
product
)
)
{
$default
{
'version'
}
=
$cloned_bug
->
{
'version'
};
}
elsif
(
formvalue
(
'version'
))
{
$default
{
'version'
}
=
formvalue
(
'version'
);
...
...
@@ -518,7 +518,7 @@ foreach my $row (@$grouplist) {
# set a groups's checkbox based on the group control map
#
if
(
(
$cloned_bug_id
)
&&
(
$product
->
name
eq
$cloned_bug
->
{
'product'
}
)
)
{
(
$product
->
name
eq
$cloned_bug
->
product
)
)
{
foreach
my
$i
(
0
..
(
@
{
$cloned_bug
->
{
'groups'
}}
-
1
)
)
{
if
(
$cloned_bug
->
{
'groups'
}
->
[
$i
]
->
{
'bit'
}
==
$id
)
{
$check
=
$cloned_bug
->
{
'groups'
}
->
[
$i
]
->
{
'ison'
};
...
...
votes.cgi
View file @
bc14d441
...
...
@@ -267,7 +267,7 @@ sub record_votes {
# XXX - We really need a $bug->product() method.
foreach
my
$bug_id
(
@buglist
)
{
my
$bug
=
new
Bugzilla::
Bug
(
$bug_id
);
my
$prod
=
$bug
->
{
'product'
}
;
my
$prod
=
$bug
->
product
;
$products
{
$prod
}
||=
new
Bugzilla::
Product
({
name
=>
$prod
});
$prodcount
{
$prod
}
||=
0
;
$prodcount
{
$prod
}
+=
$votes
{
$bug_id
};
...
...
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