Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
strongarm
Commits
c74a333a
Commit
c74a333a
authored
Dec 17, 2009
by
young hahn
Browse files
#656600 by mrfelton: Allow hardcoded settings.php global conf variables to retain their values.
parent
a244d12f
Changes
2
Hide whitespace changes
Inline
Side-by-side
strongarm.admin.inc
View file @
c74a333a
...
...
@@ -19,6 +19,8 @@ function strongarm_get_culprits() {
* Variable management strongarm form.
*/
function
strongarm_admin_form
(
$form_state
)
{
global
$conf
;
ctools_include
(
'export'
);
$vars
=
ctools_export_load_object
(
'variable'
);
ksort
(
$vars
);
...
...
@@ -26,7 +28,22 @@ function strongarm_admin_form($form_state) {
foreach
(
$vars
as
$name
=>
$variable
)
{
if
(
$variable
->
export_type
&
EXPORT_IN_CODE
)
{
$default
=
ctools_get_default_object
(
'variable'
,
$name
);
if
((
$variable
->
export_type
&
EXPORT_IN_DATABASE
)
&&
(
$variable
->
value
!=
$default
->
value
))
{
// If variable value does not match global $conf, this value has been
// hardcoded (e.g. in settings.php) and has been allowed to pass
// through. It cannot be reverted.
if
(
$conf
[
$name
]
!==
$variable
->
value
)
{
$storage
=
t
(
'Hardcoded'
);
$hardcoded
=
TRUE
;
}
else
{
$storage
=
(
$variable
->
value
==
$default
->
value
)
?
t
(
'Default'
)
:
t
(
'Overridden'
);
$hardcoded
=
FALSE
;
}
// If the variable is in the database and differs from its code value,
// allow administrator to revert its value.
if
(
!
$hardcoded
&&
(
$variable
->
export_type
&
EXPORT_IN_DATABASE
)
&&
(
$variable
->
value
!=
$default
->
value
))
{
$form
[
'revert'
][
'#tree'
]
=
TRUE
;
$form
[
'revert'
][
$name
]
=
array
(
'#type'
=>
'checkbox'
);
}
...
...
@@ -36,7 +53,7 @@ function strongarm_admin_form($form_state) {
);
$form
[
'storage'
][
$name
]
=
array
(
'#type'
=>
'markup'
,
'#value'
=>
(
$variable
->
value
==
$default
->
value
)
?
t
(
'Default'
)
:
t
(
'Overridden'
)
,
'#value'
=>
$storage
,
);
$form
[
'value'
][
$name
]
=
array
(
'#type'
=>
'markup'
,
...
...
strongarm.module
View file @
c74a333a
...
...
@@ -46,7 +46,7 @@ function strongarm_set_conf($reset = FALSE) {
cache_set
(
'strongarm'
,
$var_conf
);
}
global
$conf
;
$conf
=
$var_conf
;
$conf
=
array_merge
(
$var_conf
,
$conf
)
;
}
/**
...
...
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