Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c3970294
Commit
c3970294
authored
Oct 14, 2012
by
webchick
Browse files
Issue
#1804346
by 8thom, aspilicious: Convert authorize variables to config system.
parent
fc5a0dbe
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/authorize.php
View file @
c3970294
...
...
@@ -12,7 +12,7 @@
* a multistep process. This script actually performs the selected operations
* without loading all of Drupal, to be able to more gracefully recover from
* errors. Access to the script is controlled by a global killswitch in
* settings.php ('allow_
authorize_
operations') and via the 'administer software
* settings.php ('allow_operations') and via the 'administer software
* updates' permission.
*
* There are helper functions for setting up an operation to run via this
...
...
@@ -58,7 +58,7 @@ function authorize_access_denied_page() {
* TRUE if the current user can run authorize.php, and FALSE if not.
*/
function
authorize_access_allowed
()
{
return
variable_
get
(
'allow_
authorize_
operations'
,
TRUE
)
&&
user_access
(
'administer software updates'
);
return
config
(
'system.authorize'
)
->
get
(
'allow_operations'
)
&&
user_access
(
'administer software updates'
);
}
// *** Real work of the script begins here. ***
...
...
core/includes/authorize.inc
View file @
c3970294
...
...
@@ -40,7 +40,7 @@ function authorize_filetransfer_form($form, &$form_state) {
if
(
isset
(
$form_state
[
'values'
][
'connection_settings'
][
'authorize_filetransfer_default'
]))
{
$authorize_filetransfer_default
=
$form_state
[
'values'
][
'connection_settings'
][
'authorize_filetransfer_default'
];
}
elseif
(
$authorize_filetransfer_default
=
variable_get
(
'authorize_
filetransfer_default'
,
NULL
));
elseif
(
$authorize_filetransfer_default
=
config
(
'system.authorize'
)
->
get
(
'
filetransfer_default'
));
else
{
$authorize_filetransfer_default
=
key
(
$available_backends
);
}
...
...
@@ -139,7 +139,8 @@ function authorize_filetransfer_form($form, &$form_state) {
* @see hook_filetransfer_backends()
*/
function
_authorize_filetransfer_connection_settings
(
$backend
)
{
$defaults
=
variable_get
(
'authorize_filetransfer_connection_settings_'
.
$backend
,
array
());
$auth_connection_config
=
config
(
'system.authorize'
)
->
get
(
'filetransfer_connection_settings_'
.
$backend
);
$defaults
=
$auth_connection_config
?
$auth_connection_config
:
array
();
$form
=
array
();
// Create an instance of the file transfer class to get its settings form.
...
...
@@ -254,9 +255,9 @@ function authorize_filetransfer_form_submit($form, &$form_state) {
}
}
// Set this one as the default authorize method.
variable_set
(
'authorize_
filetransfer_default'
,
$filetransfer_backend
);
config
(
'system.authorize'
)
->
set
(
'
filetransfer_default'
,
$filetransfer_backend
);
// Save the connection settings minus the password.
variable_set
(
'authorize_
filetransfer_connection_settings_'
.
$filetransfer_backend
,
$connection_settings
);
config
(
'system.authorize'
)
->
set
(
'
filetransfer_connection_settings_'
.
$filetransfer_backend
,
$connection_settings
);
$filetransfer
=
authorize_get_filetransfer
(
$filetransfer_backend
,
$form_state
[
'values'
][
'connection_settings'
][
$filetransfer_backend
]);
...
...
core/modules/system/config/system.authorize.yml
0 → 100644
View file @
c3970294
allow_operations
:
'
1'
filetransfer_default
:
core/modules/system/system.install
View file @
c3970294
...
...
@@ -2175,6 +2175,18 @@ function system_update_8029() {
update_variable_del
(
'path_alias_whitelist'
);
}
/**
* Moves authorize system settings from variable to config.
*
* @ingroup config_upgrade
*/
function
system_update_8030
()
{
update_variables_to_config
(
'system.authorize'
,
array
(
'allow_authorize_operations'
=>
'allow_operations'
,
'authorize_filetransfer_default'
=>
'filetransfer_default'
,
));
}
/**
* @} End of "defgroup updates-7.x-to-8.x".
* The next series of updates should start at 9000.
...
...
core/modules/update/update.module
View file @
c3970294
...
...
@@ -251,7 +251,7 @@ function update_menu() {
* @see update_menu()
*/
function
update_manager_access
()
{
return
variable_
get
(
'allow_
authorize_
operations'
,
TRUE
)
&&
user_access
(
'administer software updates'
);
return
config
(
'system.authorize'
)
->
get
(
'allow_operations'
)
&&
user_access
(
'administer software updates'
);
}
/**
...
...
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