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
fusiondirectory
fusiondirectory
Commits
9b11b2c8
Commit
9b11b2c8
authored
Jun 03, 2016
by
Côme Chilliet
Browse files
Fixes
#4840
Improving recursion dependency detection and behavior
parent
10f58b6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/class_plugin.inc
View file @
9b11b2c8
...
...
@@ -773,20 +773,30 @@ class plugin
return
$result
;
}
static
function
tpl_depends_of
(
&
$cache
,
$depends
,
$key
,
$forbidden
=
NULL
)
static
function
tpl_depends_of
(
&
$cache
,
$depends
,
$key
,
$forbidden
=
array
()
)
{
if
(
isset
(
$cache
[
$key
]))
{
return
$cache
[
$key
];
}
if
(
$forbidden
===
NULL
)
{
$forbidden
=
$key
;
}
elseif
(
$forbidden
==
$key
)
{
die
(
'Error : recursive dependency'
);
}
$array
=
$forbidden
[]
=
$key
;
$array
=
array_map
(
function
(
$a
)
use
(
&
$cache
,
$depends
,
$forbidden
)
{
if
(
in_array
(
$a
,
$forbidden
))
{
msg_dialog
::
display
(
_
(
'Error'
),
sprintf
(
_
(
'Recursive dependency in the template fields: "%1$s" cannot depend on "%2$s" as "%2$s" already depends on "%1$s"'
),
$key
,
$a
),
ERROR_DIALOG
);
return
array
();
}
$deps
=
plugin
::
tpl_depends_of
(
$cache
,
$depends
,
$a
,
$forbidden
);
if
((
$askmeKey
=
array_search
(
'askme'
,
$deps
))
!==
FALSE
)
{
/* Do not flat special askme dependency */
...
...
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