updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
+47
-31
@@ -11,8 +11,6 @@ use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Config\BootstrapConfigStorageFactory;
|
||||
use Drupal\Core\Logger\RfcLogLevel;
|
||||
use Drupal\Core\Render\Markup;
|
||||
use Drupal\Component\Render\MarkupInterface;
|
||||
use Drupal\Core\Test\TestDatabase;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Site\Settings;
|
||||
@@ -21,15 +19,35 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
|
||||
/**
|
||||
* Minimum supported version of PHP.
|
||||
*
|
||||
* Drupal cannot be installed on versions of PHP older than this version.
|
||||
*
|
||||
* @todo Move this to an appropriate autoloadable class. See
|
||||
* https://www.drupal.org/project/drupal/issues/2908079
|
||||
*/
|
||||
const DRUPAL_MINIMUM_PHP = '5.5.9';
|
||||
|
||||
/**
|
||||
* Minimum recommended version of PHP.
|
||||
*
|
||||
* Sites installing Drupal on PHP versions lower than this will see a warning
|
||||
* message, but Drupal can still be installed. Used for (e.g.) PHP versions
|
||||
* that have reached their EOL or will in the near future.
|
||||
*
|
||||
* @todo Move this to an appropriate autoloadable class. See
|
||||
* https://www.drupal.org/project/drupal/issues/2908079
|
||||
*/
|
||||
const DRUPAL_RECOMMENDED_PHP = '7.1';
|
||||
|
||||
/**
|
||||
* Minimum recommended value of PHP memory_limit.
|
||||
*
|
||||
* 64M was chosen as a minimum requirement in order to allow for additional
|
||||
* contributed modules to be installed prior to hitting the limit. However,
|
||||
* 40M is the target for the Standard installation profile.
|
||||
*
|
||||
* @todo Move this to an appropriate autoloadable class. See
|
||||
* https://www.drupal.org/project/drupal/issues/2908079
|
||||
*/
|
||||
const DRUPAL_MINIMUM_PHP_MEMORY_LIMIT = '64M';
|
||||
|
||||
@@ -201,7 +219,7 @@ function config_get_config_directory($type) {
|
||||
* The filename of the item if it is to be set explicitly rather
|
||||
* than by consulting the database.
|
||||
*
|
||||
* @return
|
||||
* @return string
|
||||
* The filename of the requested item or NULL if the item is not found.
|
||||
*/
|
||||
function drupal_get_filename($type, $name, $filename = NULL) {
|
||||
@@ -266,7 +284,7 @@ function drupal_get_filename($type, $name, $filename = NULL) {
|
||||
* The name of the item for which the path is requested. Ignored for
|
||||
* $type 'core'.
|
||||
*
|
||||
* @return
|
||||
* @return string
|
||||
* The path to the requested item or an empty string if the item is not found.
|
||||
*/
|
||||
function drupal_get_path($type, $name) {
|
||||
@@ -457,30 +475,18 @@ function watchdog_exception($type, Exception $exception, $message = NULL, $varia
|
||||
*
|
||||
* @see drupal_get_messages()
|
||||
* @see status-messages.html.twig
|
||||
* @see https://www.drupal.org/node/2774931
|
||||
*
|
||||
* @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
|
||||
*/
|
||||
function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE) {
|
||||
@trigger_error('drupal_set_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead. See https://www.drupal.org/node/2774931', E_USER_DEPRECATED);
|
||||
$messenger = \Drupal::messenger();
|
||||
if (isset($message)) {
|
||||
if (!isset($_SESSION['messages'][$type])) {
|
||||
$_SESSION['messages'][$type] = [];
|
||||
}
|
||||
|
||||
// Convert strings which are safe to the simplest Markup objects.
|
||||
if (!($message instanceof Markup) && $message instanceof MarkupInterface) {
|
||||
$message = Markup::create((string) $message);
|
||||
}
|
||||
|
||||
// Do not use strict type checking so that equivalent string and
|
||||
// MarkupInterface objects are detected.
|
||||
if ($repeat || !in_array($message, $_SESSION['messages'][$type])) {
|
||||
$_SESSION['messages'][$type][] = $message;
|
||||
}
|
||||
|
||||
// Mark this page as being uncacheable.
|
||||
\Drupal::service('page_cache_kill_switch')->trigger();
|
||||
$messenger->addMessage($message, $type, $repeat);
|
||||
}
|
||||
|
||||
// Messages not set when DB connection fails.
|
||||
return isset($_SESSION['messages']) ? $_SESSION['messages'] : NULL;
|
||||
return $messenger->all();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -507,12 +513,19 @@ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE)
|
||||
*
|
||||
* @see drupal_set_message()
|
||||
* @see status-messages.html.twig
|
||||
* @see https://www.drupal.org/node/2774931
|
||||
*
|
||||
* @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Messenger\MessengerInterface::all() or
|
||||
* \Drupal\Core\Messenger\MessengerInterface::messagesByType() instead.
|
||||
*/
|
||||
function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
|
||||
if ($messages = drupal_set_message()) {
|
||||
@trigger_error('drupal_get_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface::all() or \Drupal\Core\Messenger\MessengerInterface::messagesByType() instead. See https://www.drupal.org/node/2774931', E_USER_DEPRECATED);
|
||||
$messenger = \Drupal::messenger();
|
||||
if ($messages = $messenger->all()) {
|
||||
if ($type) {
|
||||
if ($clear_queue) {
|
||||
unset($_SESSION['messages'][$type]);
|
||||
$messenger->deleteByType($type);
|
||||
}
|
||||
if (isset($messages[$type])) {
|
||||
return [$type => $messages[$type]];
|
||||
@@ -520,7 +533,7 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
|
||||
}
|
||||
else {
|
||||
if ($clear_queue) {
|
||||
unset($_SESSION['messages']);
|
||||
$messenger->deleteAll();
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
@@ -530,6 +543,9 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
|
||||
|
||||
/**
|
||||
* Returns the time zone of the current user.
|
||||
*
|
||||
* @return string
|
||||
* The name of the current user's timezone or the name of the default timezone.
|
||||
*/
|
||||
function drupal_get_user_timezone() {
|
||||
$user = \Drupal::currentUser();
|
||||
@@ -909,7 +925,7 @@ function drupal_classloader_register($name, $path) {
|
||||
* internally and should not be passed in; use drupal_static_reset() instead.
|
||||
* (This function's return value should not be used when TRUE is passed in.)
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* Returns a variable by reference.
|
||||
*
|
||||
* @see drupal_static_reset()
|
||||
@@ -980,12 +996,12 @@ function drupal_placeholder($text) {
|
||||
* Wrapper for register_shutdown_function() that catches thrown exceptions to
|
||||
* avoid "Exception thrown without a stack frame in Unknown".
|
||||
*
|
||||
* @param $callback
|
||||
* @param callable $callback
|
||||
* The shutdown function to register.
|
||||
* @param ...
|
||||
* Additional arguments to pass to the shutdown function.
|
||||
*
|
||||
* @return
|
||||
* @return array
|
||||
* Array of shutdown functions to be executed.
|
||||
*
|
||||
* @see register_shutdown_function()
|
||||
@@ -1021,7 +1037,7 @@ function _drupal_shutdown_function() {
|
||||
chdir(DRUPAL_ROOT);
|
||||
|
||||
try {
|
||||
while (list($key, $callback) = each($callbacks)) {
|
||||
foreach ($callbacks as &$callback) {
|
||||
call_user_func_array($callback['callback'], $callback['arguments']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1260,7 +1260,7 @@ function archiver_get_extensions() {
|
||||
*/
|
||||
function archiver_get_archiver($file) {
|
||||
// Archivers can only work on local paths
|
||||
$filepath = drupal_realpath($file);
|
||||
$filepath = \Drupal::service('file_system')->realpath($file);
|
||||
if (!is_file($filepath)) {
|
||||
throw new Exception(t('Archivers can only operate on local files: %file not supported', ['%file' => $file]));
|
||||
}
|
||||
|
||||
+52
-20
@@ -83,6 +83,19 @@ function _drupal_error_handler_real($error_level, $message, $filename, $line, $c
|
||||
'@backtrace_string' => (new \Exception())->getTraceAsString(),
|
||||
], $recoverable || $to_string);
|
||||
}
|
||||
// If the site is a test site then fail for user deprecations so they can be
|
||||
// caught by the deprecation error handler.
|
||||
elseif (DRUPAL_TEST_IN_CHILD_SITE && $error_level === E_USER_DEPRECATED) {
|
||||
$backtrace = debug_backtrace();
|
||||
$caller = Error::getLastCaller($backtrace);
|
||||
_drupal_error_header(
|
||||
Markup::create(Xss::filterAdmin($message)),
|
||||
'User deprecated function',
|
||||
$caller['function'],
|
||||
$caller['file'],
|
||||
$caller['line']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,25 +149,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
|
||||
// When running inside the testing framework, we relay the errors
|
||||
// to the tested site by the way of HTTP headers.
|
||||
if (DRUPAL_TEST_IN_CHILD_SITE && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// as it uniquely identifies each PHP error.
|
||||
static $number = 0;
|
||||
$assertion = [
|
||||
$error['@message'],
|
||||
$error['%type'],
|
||||
[
|
||||
'function' => $error['%function'],
|
||||
'file' => $error['%file'],
|
||||
'line' => $error['%line'],
|
||||
],
|
||||
];
|
||||
// For non-fatal errors (e.g. PHP notices) _drupal_log_error can be called
|
||||
// multiple times per request. In that case the response is typically
|
||||
// generated outside of the error handler, e.g., in a controller. As a
|
||||
// result it is not possible to use a Response object here but instead the
|
||||
// headers need to be emitted directly.
|
||||
header('X-Drupal-Assertion-' . $number . ': ' . rawurlencode(serialize($assertion)));
|
||||
$number++;
|
||||
_drupal_error_header($error['@message'], $error['%type'], $error['%function'], $error['%file'], $error['%line']);
|
||||
}
|
||||
|
||||
$response = new Response();
|
||||
@@ -164,7 +159,8 @@ function _drupal_log_error($error, $fatal = FALSE) {
|
||||
// installer.
|
||||
if (\Drupal::hasService('logger.factory')) {
|
||||
try {
|
||||
\Drupal::logger('php')->log($error['severity_level'], '%type: @message in %function (line %line of %file) @backtrace_string.', $error);
|
||||
// Provide the PHP backtrace to logger implementations.
|
||||
\Drupal::logger('php')->log($error['severity_level'], '%type: @message in %function (line %line of %file) @backtrace_string.', $error + ['backtrace' => $backtrace]);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
// We can't log, for example because the database connection is not
|
||||
@@ -324,3 +320,39 @@ function _drupal_get_error_level() {
|
||||
// request on a public site, so use the non-verbose default value.
|
||||
return $error_level ?: ERROR_REPORTING_DISPLAY_ALL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds error information to headers so that tests can access it.
|
||||
*
|
||||
* @param $message
|
||||
* The error message.
|
||||
* @param $type
|
||||
* The type of error.
|
||||
* @param $function
|
||||
* The function that emitted the error.
|
||||
* @param $file
|
||||
* The file that emitted the error.
|
||||
* @param $line
|
||||
* The line number in file that emitted the error.
|
||||
*/
|
||||
function _drupal_error_header($message, $type, $function, $file, $line) {
|
||||
// $number does not use drupal_static as it should not be reset
|
||||
// as it uniquely identifies each PHP error.
|
||||
static $number = 0;
|
||||
$assertion = [
|
||||
$message,
|
||||
$type,
|
||||
[
|
||||
'function' => $function,
|
||||
'file' => $file,
|
||||
'line' => $line,
|
||||
],
|
||||
];
|
||||
// For non-fatal errors (e.g. PHP notices) _drupal_log_error can be called
|
||||
// multiple times per request. In that case the response is typically
|
||||
// generated outside of the error handler, e.g., in a controller. As a
|
||||
// result it is not possible to use a Response object here but instead the
|
||||
// headers need to be emitted directly.
|
||||
header('X-Drupal-Assertion-' . $number . ': ' . rawurlencode(serialize($assertion)));
|
||||
$number++;
|
||||
}
|
||||
|
||||
+11
-8
@@ -462,8 +462,9 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST
|
||||
}
|
||||
// Attempt to resolve the URIs. This is necessary in certain configurations
|
||||
// (see above).
|
||||
$real_source = drupal_realpath($source) ?: $source;
|
||||
$real_destination = drupal_realpath($destination) ?: $destination;
|
||||
$file_system = \Drupal::service('file_system');
|
||||
$real_source = $file_system->realpath($source) ?: $source;
|
||||
$real_destination = $file_system->realpath($destination) ?: $destination;
|
||||
// Perform the copy operation.
|
||||
if (!@copy($real_source, $real_destination)) {
|
||||
\Drupal::logger('file')->error('The specified file %file could not be copied to %destination.', ['%file' => $source, '%destination' => $destination]);
|
||||
@@ -507,12 +508,13 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST
|
||||
function file_unmanaged_prepare($source, &$destination = NULL, $replace = FILE_EXISTS_RENAME) {
|
||||
$original_source = $source;
|
||||
$logger = \Drupal::logger('file');
|
||||
$file_system = \Drupal::service('file_system');
|
||||
|
||||
// Assert that the source file actually exists.
|
||||
if (!file_exists($source)) {
|
||||
// @todo Replace drupal_set_message() calls with exceptions instead.
|
||||
drupal_set_message(t('The specified file %file could not be moved/copied because no file by that name exists. Please check that you supplied the correct filename.', ['%file' => $original_source]), 'error');
|
||||
if (($realpath = drupal_realpath($original_source)) !== FALSE) {
|
||||
if (($realpath = $file_system->realpath($original_source)) !== FALSE) {
|
||||
$logger->notice('File %file (%realpath) could not be moved/copied because it does not exist.', ['%file' => $original_source, '%realpath' => $realpath]);
|
||||
}
|
||||
else {
|
||||
@@ -551,8 +553,8 @@ function file_unmanaged_prepare($source, &$destination = NULL, $replace = FILE_E
|
||||
}
|
||||
|
||||
// Assert that the source and destination filenames are not the same.
|
||||
$real_source = drupal_realpath($source);
|
||||
$real_destination = drupal_realpath($destination);
|
||||
$real_source = $file_system->realpath($source);
|
||||
$real_destination = $file_system->realpath($destination);
|
||||
if ($source == $destination || ($real_source !== FALSE) && ($real_source == $real_destination)) {
|
||||
drupal_set_message(t('The specified file %file was not moved/copied because it would overwrite itself.', ['%file' => $source]), 'error');
|
||||
$logger->notice('File %file could not be moved/copied because it would overwrite itself.', ['%file' => $source]);
|
||||
@@ -652,8 +654,9 @@ function file_unmanaged_move($source, $destination = NULL, $replace = FILE_EXIST
|
||||
}
|
||||
// Attempt to resolve the URIs. This is necessary in certain configurations
|
||||
// (see above) and can also permit fast moves across local schemes.
|
||||
$real_source = drupal_realpath($source) ?: $source;
|
||||
$real_destination = drupal_realpath($destination) ?: $destination;
|
||||
$file_system = \Drupal::service('file_system');
|
||||
$real_source = $file_system->realpath($source) ?: $source;
|
||||
$real_destination = $file_system->realpath($destination) ?: $destination;
|
||||
// Perform the move operation.
|
||||
if (!@rename($real_source, $real_destination)) {
|
||||
// Fall back to slow copy and unlink procedure. This is necessary for
|
||||
@@ -892,7 +895,7 @@ function file_unmanaged_delete($path) {
|
||||
*
|
||||
* @param $path
|
||||
* A string containing either an URI or a file or directory path.
|
||||
* @param $callback
|
||||
* @param callable $callback
|
||||
* (optional) Callback function to run on each file prior to deleting it and
|
||||
* on each directory prior to traversing it. For example, can be used to
|
||||
* modify permissions.
|
||||
|
||||
@@ -1380,7 +1380,7 @@ function install_download_translation(&$install_state) {
|
||||
*/
|
||||
function install_retrieve_file($uri, $destination) {
|
||||
$parsed_url = parse_url($uri);
|
||||
if (is_dir(drupal_realpath($destination))) {
|
||||
if (is_dir(\Drupal::service('file_system')->realpath($destination))) {
|
||||
// Prevent URIs with triple slashes when gluing parts together.
|
||||
$path = str_replace('///', '//', "$destination/") . drupal_basename($parsed_url['path']);
|
||||
}
|
||||
|
||||
@@ -1190,10 +1190,9 @@ function template_preprocess_maintenance_task_list(&$variables) {
|
||||
/**
|
||||
* Adds a default set of helper variables for preprocessors and templates.
|
||||
*
|
||||
* This function is called for theme hooks implemented as templates only, not
|
||||
* for theme hooks implemented as functions. This preprocess function is the
|
||||
* first in the sequence of preprocessing functions that are called when
|
||||
* preparing variables for a template.
|
||||
* This function is called for every theme hook. It is the first in the
|
||||
* sequence of preprocessing functions called when preparing variables for a
|
||||
* template.
|
||||
*
|
||||
* See the @link themeable Default theme implementations topic @endlink for
|
||||
* details.
|
||||
|
||||
@@ -323,8 +323,7 @@ function update_get_update_list() {
|
||||
continue;
|
||||
}
|
||||
|
||||
$updates = array_combine($updates, $updates);
|
||||
foreach (array_keys($updates) as $update) {
|
||||
foreach ($updates as $update) {
|
||||
if ($update == \Drupal::CORE_MINIMUM_SCHEMA_VERSION) {
|
||||
$ret[$module]['warning'] = '<em>' . $module . '</em> module cannot be updated. It contains an update numbered as ' . \Drupal::CORE_MINIMUM_SCHEMA_VERSION . ' which is reserved for the earliest installation of a module in Drupal ' . \Drupal::CORE_COMPATIBILITY . ', before any updates. In order to update <em>' . $module . '</em> module, you will need to install a version of the module with valid updates.';
|
||||
continue 2;
|
||||
|
||||
Reference in New Issue
Block a user