Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -14,7 +14,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
function rest_requirements($phase) {
$requirements = [];
if (version_compare(PHP_VERSION, '5.6.0', '>=') && version_compare(PHP_VERSION, '7', '<') && ini_get('always_populate_raw_post_data') != -1) {
if ($phase == 'runtime' && PHP_SAPI !== 'cli' && version_compare(PHP_VERSION, '5.6.0', '>=') && version_compare(PHP_VERSION, '7', '<') && ini_get('always_populate_raw_post_data') != -1) {
$requirements['always_populate_raw_post_data'] = [
'title' => t('always_populate_raw_post_data PHP setting'),
'value' => t('Not set to -1.'),
@ -84,3 +84,39 @@ function rest_update_8203() {
$rest_settings->set('bc_entity_resource_permissions', TRUE)
->save(TRUE);
}
/**
* Ensure the right REST authentication method is used.
*
* This fixes the bug in https://www.drupal.org/node/2825204.
*/
function rest_update_8401() {
$config_factory = \Drupal::configFactory();
$auth_providers = \Drupal::service('authentication_collector')->getSortedProviders();
$process_auth = function ($auth_option) use ($auth_providers) {
foreach ($auth_providers as $provider_id => $provider_data) {
// The provider belongs to the module that declares it as a service.
if (strtok($provider_data->_serviceId, '.') === $auth_option) {
return $provider_id;
}
}
return $auth_option;
};
foreach ($config_factory->listAll('views.view.') as $view_config_name) {
$save = FALSE;
$view = $config_factory->getEditable($view_config_name);
$displays = $view->get('display');
foreach ($displays as $display_name => $display) {
if ('rest_export' === $display['display_plugin'] && !empty($display['display_options']['auth'])) {
$displays[$display_name]['display_options']['auth'] = array_map($process_auth, $display['display_options']['auth']);
$save = TRUE;
}
}
if ($save) {
$view->set('display', $displays);
$view->save(TRUE);
}
}
}