Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
a6d4a363
Commit
a6d4a363
authored
Aug 14, 2015
by
Marina Glancy
Browse files
MDL-41042 coursecat: better handle changes in coursecontact
parent
35d3e8b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/adminlib.php
View file @
a6d4a363
...
...
@@ -4922,6 +4922,8 @@ class admin_setting_special_coursecontact extends admin_setting_pickroles {
parent
::
__construct
(
'coursecontact'
,
get_string
(
'coursecontact'
,
'admin'
),
get_string
(
'coursecontact_desc'
,
'admin'
),
array
(
'editingteacher'
));
$this
->
set_updatedcallback
(
create_function
(
''
,
"cache::make('core', 'coursecontacts')->purge();"
));
}
}
...
...
lib/coursecatlib.php
View file @
a6d4a363
...
...
@@ -708,16 +708,7 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
}
$managerroles
=
explode
(
','
,
$CFG
->
coursecontact
);
$cache
=
cache
::
make
(
'core'
,
'coursecontacts'
);
$cacheddata
=
$cache
->
get_many
(
array_merge
(
array
(
'basic'
),
array_keys
(
$courses
)));
// Check if cache was set for the current course contacts and it is not yet expired.
if
(
empty
(
$cacheddata
[
'basic'
])
||
$cacheddata
[
'basic'
][
'roles'
]
!==
$CFG
->
coursecontact
||
$cacheddata
[
'basic'
][
'lastreset'
]
<
time
()
-
self
::
CACHE_COURSE_CONTACTS_TTL
)
{
// Reset cache.
$keys
=
$DB
->
get_fieldset_select
(
'course'
,
'id'
,
''
);
$cache
->
delete_many
(
$keys
);
$cache
->
set
(
'basic'
,
array
(
'roles'
=>
$CFG
->
coursecontact
,
'lastreset'
=>
time
()));
$cacheddata
=
$cache
->
get_many
(
array_merge
(
array
(
'basic'
),
array_keys
(
$courses
)));
}
$cacheddata
=
$cache
->
get_many
(
array_keys
(
$courses
));
$courseids
=
array
();
foreach
(
array_keys
(
$courses
)
as
$id
)
{
if
(
$cacheddata
[
$id
]
!==
false
)
{
...
...
lib/db/caches.php
View file @
a6d4a363
...
...
@@ -189,6 +189,7 @@ $definitions = array(
'mode'
=>
cache_store
::
MODE_APPLICATION
,
'staticacceleration'
=>
true
,
'simplekeys'
=>
true
,
'ttl'
=>
3600
,
),
// Used to store data for repositories to avoid repetitive DB queries within one request.
'repositories'
=>
array
(
...
...
Write
Preview
Supports
Markdown
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