Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
37d9515b
Commit
37d9515b
authored
Aug 08, 2009
by
Angie Byron
Browse files
#528856
by catch: Optimize module_implements() by statically caching the maintenance mode variable.
parent
0d18cd68
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/module.inc
View file @
37d9515b
...
...
@@ -384,9 +384,15 @@ function module_hook($module, $hook) {
* the implementations are loaded as necessary.
*/
function
module_implements
(
$hook
,
$sort
=
FALSE
)
{
static
$implementations
=
array
(),
$sorted_implementations
=
array
(),
$loaded
=
array
(),
$cached_hooks
=
0
;
static
$implementations
=
array
(),
$sorted_implementations
=
array
(),
$loaded
=
array
(),
$cached_hooks
=
0
,
$maintenance
;
if
(
defined
(
'MAINTENANCE_MODE'
))
{
// Use a static variable for maintenance mode to avoid the overhead of
// calling defined() each time the function is called.
if
(
!
isset
(
$maintenance
))
{
$maintenance
=
defined
(
'MAINTENANCE_MODE'
);
}
if
(
$maintenance
)
{
return
_module_implements_maintenance
(
$hook
,
$sort
);
}
if
(
$hook
===
MODULE_IMPLEMENTS_CLEAR_CACHE
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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