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
6d730fae
Commit
6d730fae
authored
May 28, 2014
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 993939: Bugzilla::User::Setting::groups() should use memcached
r=dkl, a=justdave
parent
ccff2482
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
11 deletions
+36
-11
Memcached.pm
Bugzilla/Memcached.pm
+14
-4
User.pm
Bugzilla/User.pm
+21
-7
editusers.cgi
editusers.cgi
+1
-0
No files found.
Bugzilla/Memcached.pm
View file @
6d730fae
...
...
@@ -104,7 +104,7 @@ sub set_config {
return
unless
$self
->
{
memcached
};
if
(
exists
$args
->
{
key
})
{
return
$self
->
_set
(
$self
->
_config_prefix
.
'
:
'
.
$args
->
{
key
},
$args
->
{
data
});
return
$self
->
_set
(
$self
->
_config_prefix
.
'
.
'
.
$args
->
{
key
},
$args
->
{
data
});
}
else
{
ThrowCodeError
(
'params_required'
,
{
function
=>
"Bugzilla::Memcached::set_config"
,
...
...
@@ -117,7 +117,7 @@ sub get_config {
return
unless
$self
->
{
memcached
};
if
(
exists
$args
->
{
key
})
{
return
$self
->
_get
(
$self
->
_config_prefix
.
'
:
'
.
$args
->
{
key
});
return
$self
->
_get
(
$self
->
_config_prefix
.
'
.
'
.
$args
->
{
key
});
}
else
{
ThrowCodeError
(
'params_required'
,
{
function
=>
"Bugzilla::Memcached::get_config"
,
...
...
@@ -165,9 +165,14 @@ sub clear_all {
}
sub
clear_config
{
my
(
$self
)
=
@_
;
my
(
$self
,
$args
)
=
@_
;
if
(
$args
&&
exists
$args
->
{
key
})
{
$self
->
_delete
(
$self
->
_config_prefix
.
'.'
.
$args
->
{
key
});
}
else
{
return
unless
$self
->
{
memcached
};
$self
->
_inc_prefix
(
"config"
);
}
}
# in order to clear all our keys, we add a prefix to all our keys. when we
...
...
@@ -214,7 +219,7 @@ sub _config_prefix {
sub
_encode_key
{
my
(
$self
,
$key
)
=
@_
;
$key
=
$self
->
_global_prefix
.
'
:
'
.
uri_escape_utf8
(
$key
);
$key
=
$self
->
_global_prefix
.
'
.
'
.
uri_escape_utf8
(
$key
);
return
length
(
$self
->
{
namespace
}
.
$key
)
>
MAX_KEY_LENGTH
?
undef
:
$key
;
...
...
@@ -419,6 +424,11 @@ corresponding C<table> and C<name> entry.
Removes C<value> with the specified C<table> and C<name>, as well as the
corresponding C<table> and C<id> entry.
=item C<clear_config({ key =E<gt> $key })>
Remove C<value> with the specified C<key> from the configuration cache. See
C<set_config> for more information.
=item C<clear_config>
Removes all configuration related values from the cache. See C<set_config> for
...
...
Bugzilla/User.pm
View file @
6d730fae
...
...
@@ -668,18 +668,24 @@ sub flush_queries_cache {
sub
groups
{
my
$self
=
shift
;
return
$self
->
{
groups
}
if
defined
$self
->
{
groups
};
return
[]
unless
$self
->
id
;
return
$self
->
{
groups
}
if
defined
$self
->
{
groups
};
my
$user_groups_key
=
"user_groups."
.
$self
->
id
;
my
$groups
=
Bugzilla
->
memcached
->
get_config
({
key
=>
$user_groups_key
});
if
(
!
$groups
)
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$groups_to_check
=
$dbh
->
selectcol_arrayref
(
q{
SELECT DISTINCT group_id
"
SELECT DISTINCT group_id
FROM user_group_map
WHERE user_id = ? AND isbless = 0}
,
undef
,
$self
->
id
);
WHERE user_id = ? AND isbless = 0"
,
undef
,
$self
->
id
);
my
$cach
e_key
=
'group_grant_type_'
.
GROUP_MEMBERSHIP
;
my
$grant_typ
e_key
=
'group_grant_type_'
.
GROUP_MEMBERSHIP
;
my
$membership_rows
=
Bugzilla
->
memcached
->
get_config
({
key
=>
$cach
e_key
,
key
=>
$grant_typ
e_key
,
});
if
(
!
$membership_rows
)
{
$membership_rows
=
$dbh
->
selectall_arrayref
(
...
...
@@ -687,7 +693,7 @@ sub groups {
FROM group_group_map
WHERE grant_type = "
.
GROUP_MEMBERSHIP
);
Bugzilla
->
memcached
->
set_config
({
key
=>
$cach
e_key
,
key
=>
$grant_typ
e_key
,
data
=>
$membership_rows
,
});
}
...
...
@@ -725,9 +731,15 @@ sub groups {
$groups
{
$member_id
}
=
1
;
}
}
$groups
=
[
keys
%
groups
];
$self
->
{
groups
}
=
Bugzilla::
Group
->
new_from_list
([
keys
%
groups
]);
Bugzilla
->
memcached
->
set_config
({
key
=>
$user_groups_key
,
data
=>
$groups
,
});
}
$self
->
{
groups
}
=
Bugzilla::
Group
->
new_from_list
(
$groups
);
return
$self
->
{
groups
};
}
...
...
@@ -1448,6 +1460,8 @@ sub derive_regexp_groups {
$group_delete
->
execute
(
$id
,
$group
,
GRANT_REGEXP
)
if
$present
;
}
}
Bugzilla
->
memcached
->
clear_config
({
key
=>
"user_groups.$id"
});
}
sub
product_responsibilities
{
...
...
editusers.cgi
View file @
6d730fae
...
...
@@ -346,6 +346,7 @@ if ($action eq 'search') {
(
$otherUserID
,
$userid
,
get_field_id
(
'bug_group'
),
join
(
', '
,
@groupsRemovedFrom
),
join
(
', '
,
@groupsAddedTo
)));
Bugzilla
->
memcached
->
clear_config
({
key
=>
"user_groups.$otherUserID"
})
}
# XXX: should create profiles_activity entries for blesser changes.
...
...
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