upgrades core to 8.4.2
This commit is contained in:
+47
-5
@@ -47,8 +47,22 @@ function _batch_page(Request $request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Register database update for the end of processing.
|
||||
// We need to store the updated batch information in the batch storage after
|
||||
// processing the batch. In order for the error page to work correctly this
|
||||
// needs to be done even in case of a PHP fatal error in which case the end of
|
||||
// this function is never reached. Therefore we register a shutdown function
|
||||
// to handle this case. Because with FastCGI and fastcgi_finish_request()
|
||||
// shutdown functions are called after the HTTP connection is closed, updating
|
||||
// the batch information in a shutdown function would lead to race conditions
|
||||
// between consecutive requests if the batch processing continues. In case of
|
||||
// a fatal error the processing stops anyway, so it works even with FastCGI.
|
||||
// However, we must ensure to only update in the shutdown phase in this
|
||||
// particular case we track whether the batch information still needs to be
|
||||
// updated.
|
||||
// @see _batch_shutdown()
|
||||
// @see \Symfony\Component\HttpFoundation\Response::send()
|
||||
drupal_register_shutdown_function('_batch_shutdown');
|
||||
_batch_needs_update(TRUE);
|
||||
|
||||
$build = [];
|
||||
|
||||
@@ -70,18 +84,46 @@ function _batch_page(Request $request) {
|
||||
$current_set = _batch_current_set();
|
||||
$build['#title'] = $current_set['title'];
|
||||
$build['content'] = _batch_progress_page();
|
||||
|
||||
$response = $build;
|
||||
break;
|
||||
|
||||
case 'do':
|
||||
// JavaScript-based progress page callback.
|
||||
return _batch_do();
|
||||
$response = _batch_do();
|
||||
break;
|
||||
|
||||
case 'finished':
|
||||
// _batch_finished() returns a RedirectResponse.
|
||||
return _batch_finished();
|
||||
$response = _batch_finished();
|
||||
break;
|
||||
}
|
||||
|
||||
return $build;
|
||||
if ($batch) {
|
||||
\Drupal::service('batch.storage')->update($batch);
|
||||
}
|
||||
_batch_needs_update(FALSE);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the batch information needs to be updated in the storage.
|
||||
*
|
||||
* @param bool $new_value
|
||||
* (optional) A new value to set.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the batch information needs to be updated; FALSE otherwise.
|
||||
*/
|
||||
function _batch_needs_update($new_value = NULL) {
|
||||
$needs_update = &drupal_static(__FUNCTION__, FALSE);
|
||||
|
||||
if (isset($new_value)) {
|
||||
$needs_update = $new_value;
|
||||
}
|
||||
|
||||
return $needs_update;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,7 +551,7 @@ function _batch_finished() {
|
||||
* @see drupal_register_shutdown_function()
|
||||
*/
|
||||
function _batch_shutdown() {
|
||||
if ($batch = batch_get()) {
|
||||
if (($batch = batch_get()) && _batch_needs_update()) {
|
||||
\Drupal::service('batch.storage')->update($batch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,8 @@ function format_size($size, $langcode = NULL) {
|
||||
return \Drupal::translation()->formatPlural($size, '1 byte', '@count bytes', [], ['langcode' => $langcode]);
|
||||
}
|
||||
else {
|
||||
$size = $size / Bytes::KILOBYTE; // Convert bytes to kilobytes.
|
||||
// Convert bytes to kilobytes.
|
||||
$size = $size / Bytes::KILOBYTE;
|
||||
$units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
foreach ($units as $unit) {
|
||||
if (round($size, 2) >= Bytes::KILOBYTE) {
|
||||
@@ -896,7 +897,7 @@ function drupal_render_children(&$element, $children_keys = NULL) {
|
||||
$output = '';
|
||||
foreach ($children_keys as $key) {
|
||||
if (!empty($element[$key])) {
|
||||
$output .= drupal_render($element[$key]);
|
||||
$output .= \Drupal::service('renderer')->render($element[$key]);
|
||||
}
|
||||
}
|
||||
return Markup::create($output);
|
||||
|
||||
@@ -716,8 +716,10 @@ function file_munge_filename($filename, $extensions, $alerts = TRUE) {
|
||||
// Split the filename up by periods. The first part becomes the basename
|
||||
// the last part the final extension.
|
||||
$filename_parts = explode('.', $filename);
|
||||
$new_filename = array_shift($filename_parts); // Remove file basename.
|
||||
$final_extension = array_pop($filename_parts); // Remove final extension.
|
||||
// Remove file basename.
|
||||
$new_filename = array_shift($filename_parts);
|
||||
// Remove final extension.
|
||||
$final_extension = array_pop($filename_parts);
|
||||
|
||||
// Loop through the middle parts of the name and add an underscore to the
|
||||
// end of each section that could be a file extension but isn't in the list
|
||||
@@ -923,7 +925,6 @@ function file_unmanaged_delete_recursive($path, $callback = NULL) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Moves an uploaded file to a new location.
|
||||
*
|
||||
@@ -1031,7 +1032,7 @@ function file_scan_directory($dir, $mask, $options = [], $depth = 0) {
|
||||
// performance boost.
|
||||
if (!isset($options['nomask'])) {
|
||||
$ignore_directories = Settings::get('file_scan_ignore_directories', []);
|
||||
array_walk($ignore_directories, function(&$value) {
|
||||
array_walk($ignore_directories, function (&$value) {
|
||||
$value = preg_quote($value, '/');
|
||||
});
|
||||
$default_nomask = '/^' . implode('|', $ignore_directories) . '$/';
|
||||
|
||||
@@ -370,12 +370,13 @@ function template_preprocess_form(&$variables) {
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - element: An associative array containing the properties of the element.
|
||||
* Properties used: #title, #value, #description, #rows, #cols,
|
||||
* #placeholder, #required, #attributes, #resizable
|
||||
* Properties used: #title, #value, #description, #rows, #cols, #maxlength,
|
||||
* #placeholder, #required, #attributes, #resizable.
|
||||
*/
|
||||
function template_preprocess_textarea(&$variables) {
|
||||
$element = $variables['element'];
|
||||
Element::setAttributes($element, ['id', 'name', 'rows', 'cols', 'placeholder']);
|
||||
$attributes = ['id', 'name', 'rows', 'cols', 'maxlength', 'placeholder'];
|
||||
Element::setAttributes($element, $attributes);
|
||||
RenderElement::setAttributes($element, ['form-textarea']);
|
||||
$variables['wrapper_attributes'] = new Attribute();
|
||||
$variables['attributes'] = new Attribute($element['#attributes']);
|
||||
@@ -786,8 +787,8 @@ function batch_set($batch_definition) {
|
||||
* is omitted and no redirect response was returned by the 'finished'
|
||||
* callback. Any query arguments will be automatically persisted.
|
||||
* @param \Drupal\Core\Url $url
|
||||
* (optional - should only be used for separate scripts like update.php)
|
||||
* URL of the batch processing page.
|
||||
* (optional) URL of the batch processing page. Should only be used for
|
||||
* separate scripts like update.php.
|
||||
* @param $redirect_callback
|
||||
* (optional) Specify a function to be called to redirect to the progressive
|
||||
* processing page.
|
||||
|
||||
@@ -318,6 +318,14 @@ function install_begin_request($class_loader, &$install_state) {
|
||||
header($request->server->get('SERVER_PROTOCOL') . ' 403 Forbidden');
|
||||
exit;
|
||||
}
|
||||
if ($install_state['interactive'] && drupal_valid_test_ua()) {
|
||||
// Set the default timezone. While this doesn't cause any tests to fail, PHP
|
||||
// complains if 'date.timezone' is not set in php.ini. The Australia/Sydney
|
||||
// timezone is chosen so all tests are run using an edge case scenario
|
||||
// (UTC+10 and DST). This choice is made to prevent timezone related
|
||||
// regressions and reduce the fragility of the testing system in general.
|
||||
date_default_timezone_set('Australia/Sydney');
|
||||
}
|
||||
|
||||
$site_path = DrupalKernel::findSitePath($request, FALSE);
|
||||
Settings::initialize(dirname(dirname(__DIR__)), $site_path, $class_loader);
|
||||
@@ -754,8 +762,7 @@ function install_tasks($install_state) {
|
||||
'run' => $install_state['settings_verified'] ? INSTALL_TASK_SKIP : INSTALL_TASK_RUN_IF_NOT_COMPLETED,
|
||||
'function' => 'Drupal\Core\Installer\Form\SiteSettingsForm',
|
||||
],
|
||||
'install_write_profile' => [
|
||||
],
|
||||
'install_write_profile' => [],
|
||||
'install_verify_database_ready' => [
|
||||
'run' => $install_state['database_ready'] ? INSTALL_TASK_SKIP : INSTALL_TASK_RUN_IF_NOT_COMPLETED,
|
||||
],
|
||||
@@ -770,10 +777,8 @@ function install_tasks($install_state) {
|
||||
'display_name' => t('Install site'),
|
||||
'type' => 'batch',
|
||||
],
|
||||
'install_profile_themes' => [
|
||||
],
|
||||
'install_install_profile' => [
|
||||
],
|
||||
'install_profile_themes' => [],
|
||||
'install_install_profile' => [],
|
||||
'install_import_translations' => [
|
||||
'display_name' => t('Set up translations'),
|
||||
'display' => $needs_translations,
|
||||
@@ -813,8 +818,7 @@ function install_tasks($install_state) {
|
||||
'type' => 'batch',
|
||||
'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
|
||||
],
|
||||
'install_finished' => [
|
||||
],
|
||||
'install_finished' => [],
|
||||
];
|
||||
|
||||
// Allow the installation profile to modify the full list of tasks.
|
||||
@@ -1810,10 +1814,11 @@ function _install_module_batch($module, $module_name, &$context) {
|
||||
* @param string $server_pattern
|
||||
* Server access pattern (to replace language code, version number, etc. in).
|
||||
*
|
||||
* @return array
|
||||
* @return array|null
|
||||
* Requirements compliance array. If the translation was downloaded
|
||||
* successfully then an empty array is returned. Otherwise the requirements
|
||||
* error with detailed information.
|
||||
* error with detailed information. NULL if the file already exists for this
|
||||
* language code.
|
||||
*/
|
||||
function install_check_translations($langcode, $server_pattern) {
|
||||
$requirements = [];
|
||||
|
||||
@@ -114,9 +114,10 @@ function drupal_install_profile_distribution_name() {
|
||||
/**
|
||||
* Loads the installation profile, extracting its defined version.
|
||||
*
|
||||
* @return string Distribution version defined in the profile's .info.yml file.
|
||||
* Defaults to \Drupal::VERSION if no version is explicitly provided
|
||||
* by the installation profile.
|
||||
* @return string
|
||||
* Distribution version defined in the profile's .info.yml file.
|
||||
* Defaults to \Drupal::VERSION if no version is explicitly provided by the
|
||||
* installation profile.
|
||||
*
|
||||
* @see install_profile_info()
|
||||
*/
|
||||
@@ -530,8 +531,11 @@ function drupal_install_config_directories() {
|
||||
*
|
||||
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use
|
||||
* config_get_config_directory() and file_prepare_directory() instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2501187
|
||||
*/
|
||||
function install_ensure_config_directory($type) {
|
||||
@trigger_error('install_ensure_config_directory() is deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. Use config_get_config_directory() and file_prepare_directory() instead. See https://www.drupal.org/node/2501187.', E_USER_DEPRECATED);
|
||||
// The config directory must be defined in settings.php.
|
||||
global $config_directories;
|
||||
if (!isset($config_directories[$type])) {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Render\Element;
|
||||
|
||||
|
||||
/**
|
||||
* Prepares variables for single local task link templates.
|
||||
*
|
||||
@@ -105,6 +104,7 @@ function menu_list_system_menus() {
|
||||
* tasks.
|
||||
*
|
||||
* @see hook_menu_local_tasks_alter()
|
||||
* @see https://www.drupal.org/node/2544940
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
@@ -117,6 +117,8 @@ function menu_local_tasks($level = 0) {
|
||||
/**
|
||||
* Returns the rendered local tasks at the top level.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2874695
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
function menu_primary_local_tasks() {
|
||||
@@ -130,6 +132,8 @@ function menu_primary_local_tasks() {
|
||||
/**
|
||||
* Returns the rendered local tasks at the second level.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2874695
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
|
||||
*/
|
||||
function menu_secondary_local_tasks() {
|
||||
|
||||
@@ -119,7 +119,7 @@ function drupal_install_schema($module) {
|
||||
_drupal_schema_initialize($schema, $module, FALSE);
|
||||
|
||||
foreach ($schema as $name => $table) {
|
||||
db_create_table($name, $table);
|
||||
\Drupal::database()->schema()->createTable($name, $table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function tablesort_header(&$cell_content, array &$cell_attributes, array $header
|
||||
'#theme' => 'tablesort_indicator',
|
||||
'#style' => $ts['sort'],
|
||||
];
|
||||
$image = drupal_render($tablesort_indicator);
|
||||
$image = \Drupal::service('renderer')->render($tablesort_indicator);
|
||||
}
|
||||
else {
|
||||
// If the user clicks a different header, we want to sort ascending initially.
|
||||
|
||||
@@ -240,8 +240,7 @@ function drupal_find_theme_templates($cache, $extension, $path) {
|
||||
// Match templates based on the 'template' filename.
|
||||
foreach ($cache as $hook => $info) {
|
||||
if (isset($info['template'])) {
|
||||
$template_candidates = [$info['template'], str_replace($info['theme path'] . '/templates/', '', $info['template'])];
|
||||
if (in_array($template, $template_candidates)) {
|
||||
if ($template === $info['template']) {
|
||||
$implementations[$hook] = [
|
||||
'template' => $template,
|
||||
'path' => dirname($file->uri),
|
||||
|
||||
@@ -10,7 +10,16 @@ use Drupal\Component\Utility\Unicode;
|
||||
/**
|
||||
* Returns Unicode library status and errors.
|
||||
*/
|
||||
/**
|
||||
* Moves unicode_requirements() logic to system_requirements().
|
||||
*
|
||||
* @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2884698
|
||||
*/
|
||||
function unicode_requirements() {
|
||||
@trigger_error('unicode_requirements() is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. There is no replacement; system_requirements() now includes the logic instead. See https://www.drupal.org/node/2884698', E_USER_DEPRECATED);
|
||||
|
||||
$libraries = [
|
||||
Unicode::STATUS_SINGLEBYTE => t('Standard PHP'),
|
||||
Unicode::STATUS_MULTIBYTE => t('PHP Mbstring Extension'),
|
||||
|
||||
Reference in New Issue
Block a user