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
814b24fd
Commit
814b24fd
authored
Jul 07, 2010
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 519835: Remove Bugzilla::Product::check_product() in favor of Bugzilla::Product->check()
r=mkanat a=LpSolit
parent
ef414f2b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
58 deletions
+25
-58
Bug.pm
Bugzilla/Bug.pm
+2
-4
Product.pm
Bugzilla/Product.pm
+6
-24
User.pm
Bugzilla/User.pm
+1
-1
collectstats.pl
collectstats.pl
+11
-7
config.cgi
config.cgi
+1
-1
editflagtypes.cgi
editflagtypes.cgi
+2
-1
enter_bug.cgi
enter_bug.cgi
+1
-6
request.cgi
request.cgi
+1
-1
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+0
-13
No files found.
Bugzilla/Bug.pm
View file @
814b24fd
...
...
@@ -1649,10 +1649,8 @@ sub _check_product {
}
# Check that the product exists and that the user
# is allowed to enter bugs into this product.
Bugzilla
->
user
->
can_enter_product
(
$name
,
THROW_ERROR
);
# can_enter_product already does everything that check_product
# would do for us, so we don't need to use it.
return
new
Bugzilla::
Product
({
name
=>
$name
});
my
$product
=
Bugzilla
->
user
->
can_enter_product
(
$name
,
THROW_ERROR
);
return
$product
;
}
sub
_check_priority
{
...
...
Bugzilla/Product.pm
View file @
814b24fd
...
...
@@ -812,26 +812,17 @@ sub classification_id { return $_[0]->{'classification_id'}; }
#### Subroutines ######
###############################
sub
check_product
{
my
(
$product_name
)
=
@_
;
unless
(
$product_name
)
{
ThrowUserError
(
'product_not_specified'
);
}
my
$product
=
new
Bugzilla::
Product
({
name
=>
$product_name
});
unless
(
$product
)
{
ThrowUserError
(
'product_doesnt_exist'
,
{
'product'
=>
$product_name
});
}
return
$product
;
}
sub
check
{
my
(
$class
,
$params
)
=
@_
;
$params
=
{
name
=>
$params
}
if
!
ref
$params
;
if
(
!
$params
->
{
allow_inaccessible
})
{
$params
->
{
_error
}
=
'product_access_denied'
;
}
my
$product
=
$class
->
SUPER::
check
(
$params
);
if
(
!
Bugzilla
->
user
->
can_access_product
(
$product
))
{
if
(
!
$params
->
{
allow_inaccessible
}
&&
!
Bugzilla
->
user
->
can_access_product
(
$product
))
{
ThrowUserError
(
'product_access_denied'
,
$params
);
}
return
$product
;
...
...
@@ -1052,15 +1043,6 @@ than calling those accessors on every item in the array individually.
This function is not exported, so must be called like
C<Bugzilla::Product::preload($products)>.
=item C<check_product($product_name)>
Description: Checks if the product name was passed in and if is a valid
product.
Params: $product_name - String with a product name.
Returns: Bugzilla::Product object.
=back
=head1 SEE ALSO
...
...
Bugzilla/User.pm
View file @
814b24fd
...
...
@@ -985,7 +985,7 @@ sub check_can_admin_product {
my
(
$self
,
$product_name
)
=
@_
;
# First make sure the product name is valid.
my
$product
=
Bugzilla::Product
::
check_product
(
$product_name
);
my
$product
=
Bugzilla::
Product
->
check
(
$product_name
);
(
$self
->
in_group
(
'editcomponents'
,
$product
->
id
)
&&
$self
->
can_see_product
(
$product
->
name
))
...
...
collectstats.pl
View file @
814b24fd
...
...
@@ -70,9 +70,6 @@ if ($#ARGV >= 0 && $ARGV[0] eq "--regenerate") {
my
$datadir
=
bz_locations
()
->
{
'datadir'
};
my
@myproducts
=
map
{
$_
->
name
}
Bugzilla::
Product
->
get_all
;
unshift
(
@myproducts
,
"-All-"
);
# As we can now customize statuses and resolutions, looking at the current list
# of legal values only is not enough as some now removed statuses and resolutions
# may have existed in the past, or have been renamed. We want them all.
...
...
@@ -142,6 +139,10 @@ if ($regenerate) {
}
my
$tstart
=
time
;
my
@myproducts
=
Bugzilla::
Product
->
get_all
;
unshift
(
@myproducts
,
"-All-"
);
foreach
(
@myproducts
)
{
my
$dir
=
"$datadir/mining"
;
...
...
@@ -173,11 +174,11 @@ sub collect_stats {
my
$product
=
shift
;
my
$when
=
localtime
(
time
);
my
$dbh
=
Bugzilla
->
dbh
;
my
$product_id
;
if
(
$product
ne
'-All-'
)
{
my
$prod
=
Bugzilla::Product::
check_product
(
$product
);
$product_id
=
$prod
->
id
;
if
(
ref
$product
)
{
$product_id
=
$product
->
id
;
$product
=
$product
->
name
;
}
# NB: Need to mangle the product for the filename, but use the real
...
...
@@ -312,6 +313,9 @@ sub regenerate_stats {
# NB: Need to mangle the product for the filename, but use the real
# product name in the query
if
(
ref
$product
)
{
$product
=
$product
->
name
;
}
my
$file_product
=
$product
;
$file_product
=~
s/\//-/gs
;
my
$file
=
join
'/'
,
$dir
,
$file_product
;
...
...
config.cgi
View file @
814b24fd
...
...
@@ -69,7 +69,7 @@ $vars->{'custom_fields'} =
if
(
$cgi
->
param
(
'product'
))
{
my
@products
=
$cgi
->
param
(
'product'
);
foreach
my
$product_name
(
@products
)
{
# We don't use check
_product
because config.cgi outputs mostly
# We don't use check
()
because config.cgi outputs mostly
# in XML and JS and we don't want to display an HTML error
# instead of that.
my
$product
=
new
Bugzilla::
Product
({
name
=>
$product_name
});
...
...
editflagtypes.cgi
View file @
814b24fd
...
...
@@ -595,7 +595,8 @@ sub validateProduct {
my
$product_name
=
shift
;
return
unless
$product_name
;
my
$product
=
Bugzilla::Product::
check_product
(
$product_name
);
my
$product
=
Bugzilla::
Product
->
check
({
name
=>
$product_name
,
allow_inaccessible
=>
1
});
return
$product
;
}
...
...
enter_bug.cgi
View file @
814b24fd
...
...
@@ -153,15 +153,10 @@ if ($product_name eq '') {
$product
=
$enterable_products
[
0
];
}
}
else
{
# Do not use Bugzilla::Product::check_product() here, else the user
# could know whether the product doesn't exist or is not accessible.
$product
=
new
Bugzilla::
Product
({
'name'
=>
$product_name
});
}
# We need to check and make sure that the user has permission
# to enter a bug against this product.
$
user
->
can_enter_product
(
$product
?
$product
->
name
:
$product_name
,
THROW_ERROR
);
$
product
=
$user
->
can_enter_product
(
$product
||
$product_name
,
THROW_ERROR
);
##############################################################################
# Useful Subroutines
...
...
request.cgi
View file @
814b24fd
...
...
@@ -208,7 +208,7 @@ sub queue {
# Filter results by exact product or component.
if
(
defined
$cgi
->
param
(
'product'
)
&&
$cgi
->
param
(
'product'
)
ne
""
)
{
my
$product
=
Bugzilla::Product
::
check_product
(
scalar
$cgi
->
param
(
'product'
));
my
$product
=
Bugzilla::
Product
->
check
(
scalar
$cgi
->
param
(
'product'
));
push
(
@criteria
,
"bugs.product_id = "
.
$product
->
id
);
push
(
@excluded_columns
,
'product'
)
unless
$cgi
->
param
(
'do_union'
);
if
(
defined
$cgi
->
param
(
'component'
)
&&
$cgi
->
param
(
'component'
)
ne
""
)
{
...
...
template/en/default/global/user-error.html.tmpl
View file @
814b24fd
...
...
@@ -1328,10 +1328,6 @@
[% END %]
does not exist or you don't have access to it.
[% ELSIF error == "product_doesnt_exist" %]
[% title = "Specified Product Does Not Exist" %]
The product '[% product FILTER html %]' does not exist.
[% ELSIF error == "product_illegal_group" %]
[% title = "Illegal Group" %]
[% group.name FILTER html %] is not an active [% terms.bug %] group
...
...
@@ -1401,15 +1397,6 @@
'versions.html' => 'Administering versions'} %]
You must enter a valid version to create a new product.
[% ELSIF error == "product_not_specified" %]
[% title = "No Product Specified" %]
[% admindocslinks = {'products.html' => 'Administering products',
'components.html' => 'Administering components',
'milestones.html' => 'Administering milestones',
'versions.html' => 'Administering versions'} %]
No product specified when trying to edit components, milestones, versions
or product.
[% ELSIF error == "query_name_exists" %]
[% title = "Search Name Already In Use" %]
The name <em>[% name FILTER html %]</em> is already used by another
...
...
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