updated core to 7.73
This commit is contained in:
+213
-13
@@ -6,12 +6,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test and report Drupal installation requirements.
|
||||
*
|
||||
* @param $phase
|
||||
* The current system installation phase.
|
||||
* @return
|
||||
* An array of system requirements.
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
function system_requirements($phase) {
|
||||
global $base_url;
|
||||
@@ -165,7 +160,7 @@ function system_requirements($phase) {
|
||||
if (empty($drivers)) {
|
||||
$database_ok = FALSE;
|
||||
$pdo_message = $t('Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that <a href="@drupal-databases">Drupal supports</a>.', array(
|
||||
'@drupal-databases' => 'http://drupal.org/node/270#database',
|
||||
'@drupal-databases' => 'https://www.drupal.org/requirements/database',
|
||||
));
|
||||
}
|
||||
// Make sure the native PDO extension is available, not the older PEAR
|
||||
@@ -201,6 +196,12 @@ function system_requirements($phase) {
|
||||
);
|
||||
}
|
||||
|
||||
// Test database-specific multi-byte UTF-8 related requirements.
|
||||
$charset_requirements = _system_check_db_utf8mb4_requirements($phase);
|
||||
if (!empty($charset_requirements)) {
|
||||
$requirements['database_charset'] = $charset_requirements;
|
||||
}
|
||||
|
||||
// Test PHP memory_limit
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
$requirements['php_memory_limit'] = array(
|
||||
@@ -208,7 +209,7 @@ function system_requirements($phase) {
|
||||
'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
|
||||
);
|
||||
|
||||
if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
|
||||
if (!drupal_check_memory_limit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
|
||||
$description = '';
|
||||
if ($phase == 'install') {
|
||||
$description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
|
||||
@@ -258,6 +259,39 @@ function system_requirements($phase) {
|
||||
$requirements['settings.php']['title'] = $t('Configuration file');
|
||||
}
|
||||
|
||||
// Test the contents of the .htaccess files.
|
||||
if ($phase == 'runtime') {
|
||||
// Try to write the .htaccess files first, to prevent false alarms in case
|
||||
// (for example) the /tmp directory was wiped.
|
||||
file_ensure_htaccess();
|
||||
$htaccess_files['public://.htaccess'] = array(
|
||||
'title' => $t('Public files directory'),
|
||||
'directory' => variable_get('file_public_path', conf_path() . '/files'),
|
||||
);
|
||||
if ($private_files_directory = variable_get('file_private_path')) {
|
||||
$htaccess_files['private://.htaccess'] = array(
|
||||
'title' => $t('Private files directory'),
|
||||
'directory' => $private_files_directory,
|
||||
);
|
||||
}
|
||||
$htaccess_files['temporary://.htaccess'] = array(
|
||||
'title' => $t('Temporary files directory'),
|
||||
'directory' => variable_get('file_temporary_path', file_directory_temp()),
|
||||
);
|
||||
foreach ($htaccess_files as $htaccess_file => $info) {
|
||||
// Check for the string which was added to the recommended .htaccess file
|
||||
// in the latest security update.
|
||||
if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
|
||||
$requirements[$htaccess_file] = array(
|
||||
'title' => $info['title'],
|
||||
'value' => $t('Not fully protected'),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => $t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array('@url' => 'http://drupal.org/SA-CORE-2013-003', '%directory' => $info['directory'])),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Report cron status.
|
||||
if ($phase == 'runtime') {
|
||||
// Cron warning threshold defaults to two days.
|
||||
@@ -489,6 +523,75 @@ function system_requirements($phase) {
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the requirements for multi-byte UTF-8 support are met.
|
||||
*
|
||||
* @param string $phase
|
||||
* The hook_requirements() stage.
|
||||
*
|
||||
* @return array
|
||||
* A requirements array with the result of the charset check.
|
||||
*/
|
||||
function _system_check_db_utf8mb4_requirements($phase) {
|
||||
global $install_state;
|
||||
// In the requirements check of the installer, skip the utf8mb4 check unless
|
||||
// the database connection info has been preconfigured by hand with valid
|
||||
// information before running the installer, as otherwise we cannot get a
|
||||
// valid database connection object.
|
||||
if (isset($install_state['settings_verified']) && !$install_state['settings_verified']) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$connection = Database::getConnection();
|
||||
$t = get_t();
|
||||
$requirements['title'] = $t('Database 4 byte UTF-8 support');
|
||||
|
||||
$utf8mb4_configurable = $connection->utf8mb4IsConfigurable();
|
||||
$utf8mb4_active = $connection->utf8mb4IsActive();
|
||||
$utf8mb4_supported = $connection->utf8mb4IsSupported();
|
||||
$driver = $connection->driver();
|
||||
$documentation_url = 'https://www.drupal.org/node/2754539';
|
||||
|
||||
if ($utf8mb4_active) {
|
||||
if ($utf8mb4_supported) {
|
||||
if ($phase != 'install' && $utf8mb4_configurable && !variable_get('drupal_all_databases_are_utf8mb4', FALSE)) {
|
||||
// Supported, active, and configurable, but not all database tables
|
||||
// have been converted yet.
|
||||
$requirements['value'] = $t('Enabled, but database tables need conversion');
|
||||
$requirements['description'] = $t('Please convert all database tables to utf8mb4 prior to enabling it in settings.php. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@url' => $documentation_url));
|
||||
$requirements['severity'] = REQUIREMENT_ERROR;
|
||||
}
|
||||
else {
|
||||
// Supported, active.
|
||||
$requirements['value'] = $t('Enabled');
|
||||
$requirements['description'] = $t('4 byte UTF-8 for @driver is enabled.', array('@driver' => $driver));
|
||||
$requirements['severity'] = REQUIREMENT_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Not supported, active.
|
||||
$requirements['value'] = $t('Not supported');
|
||||
$requirements['description'] = $t('4 byte UTF-8 for @driver is activated, but not supported on your system. Please turn this off in settings.php, or ensure that all database-related requirements are met. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@driver' => $driver, '@url' => $documentation_url));
|
||||
$requirements['severity'] = REQUIREMENT_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($utf8mb4_supported) {
|
||||
// Supported, not active.
|
||||
$requirements['value'] = $t('Not enabled');
|
||||
$requirements['description'] = $t('4 byte UTF-8 for @driver is not activated, but it is supported on your system. It is recommended that you enable this to allow 4-byte UTF-8 input such as emojis, Asian symbols and mathematical symbols to be stored correctly. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@driver' => $driver, '@url' => $documentation_url));
|
||||
$requirements['severity'] = REQUIREMENT_INFO;
|
||||
}
|
||||
else {
|
||||
// Not supported, not active.
|
||||
$requirements['value'] = $t('Disabled');
|
||||
$requirements['description'] = $t('4 byte UTF-8 for @driver is disabled. See the <a href="@url">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@driver' => $driver, '@url' => $documentation_url));
|
||||
$requirements['severity'] = REQUIREMENT_INFO;
|
||||
}
|
||||
}
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
@@ -504,6 +607,9 @@ function system_install() {
|
||||
module_list(TRUE);
|
||||
module_implements('', FALSE, TRUE);
|
||||
|
||||
// Ensure the schema versions are not based on a previous module list.
|
||||
drupal_static_reset('drupal_get_schema_versions');
|
||||
|
||||
// Load system theme data appropriately.
|
||||
system_rebuild_theme_data();
|
||||
|
||||
@@ -516,7 +622,7 @@ function system_install() {
|
||||
->execute();
|
||||
|
||||
// Populate the cron key variable.
|
||||
$cron_key = drupal_hash_base64(drupal_random_bytes(55));
|
||||
$cron_key = drupal_random_key();
|
||||
variable_set('cron_key', $cron_key);
|
||||
}
|
||||
|
||||
@@ -772,6 +878,7 @@ function system_schema() {
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'not null' => TRUE,
|
||||
'binary' => TRUE,
|
||||
),
|
||||
'type' => array(
|
||||
'description' => 'The date format type, e.g. medium.',
|
||||
@@ -830,6 +937,7 @@ function system_schema() {
|
||||
'filesize' => array(
|
||||
'description' => 'The size of the file in bytes.',
|
||||
'type' => 'int',
|
||||
'size' => 'big',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
@@ -1743,7 +1851,7 @@ function system_update_7000() {
|
||||
* Generate a cron key and save it in the variables table.
|
||||
*/
|
||||
function system_update_7001() {
|
||||
variable_set('cron_key', drupal_hash_base64(drupal_random_bytes(55)));
|
||||
variable_set('cron_key', drupal_random_key());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1983,7 +2091,7 @@ function system_update_7013() {
|
||||
$timezone = 'UTC';
|
||||
}
|
||||
variable_set('date_default_timezone', $timezone);
|
||||
drupal_set_message('The default time zone has been set to <em>' . check_plain($timezone) . '</em>. Check the ' . l('date and time configuration page', 'admin/config/regional/settings') . ' to configure it correctly.', 'warning');
|
||||
drupal_set_message(format_string('The default time zone has been set to %timezone. Check the <a href="@config-url">date and time configuration page</a> to configure it correctly.', array('%timezone' => $timezone, '@config-url' => url('admin/config/regional/settings'))), 'warning');
|
||||
// Remove temporary override.
|
||||
variable_del('date_temporary_timezone');
|
||||
}
|
||||
@@ -2762,7 +2870,7 @@ function system_update_7061(&$sandbox) {
|
||||
if (!db_table_exists('system_update_7061')) {
|
||||
$table = array(
|
||||
'description' => t('Stores temporary data for system_update_7061.'),
|
||||
'fields' => array('vid' => array('type' => 'int')),
|
||||
'fields' => array('vid' => array('type' => 'int', 'not null' => TRUE)),
|
||||
'primary key' => array('vid'),
|
||||
);
|
||||
db_create_table('system_update_7061', $table);
|
||||
@@ -2774,6 +2882,16 @@ function system_update_7061(&$sandbox) {
|
||||
->from($query)
|
||||
->execute();
|
||||
|
||||
// Retrieve a list of duplicate files with the same filepath. Only the
|
||||
// most-recently uploaded of these will be moved to the new {file_managed}
|
||||
// table (and all references will be updated to point to it), since
|
||||
// duplicate file URIs are not allowed in Drupal 7.
|
||||
// Since the Drupal 6 to 7 upgrade path leaves the {files} table behind
|
||||
// after it's done, custom or contributed modules which need to migrate
|
||||
// file references of their own can use a similar query to determine the
|
||||
// file IDs that duplicate filepaths were mapped to.
|
||||
$sandbox['duplicate_filepath_fids_to_use'] = db_query("SELECT filepath, MAX(fid) FROM {files} GROUP BY filepath HAVING COUNT(*) > 1")->fetchAllKeyed();
|
||||
|
||||
// Initialize batch update information.
|
||||
$sandbox['progress'] = 0;
|
||||
$sandbox['last_vid_processed'] = -1;
|
||||
@@ -2803,6 +2921,16 @@ function system_update_7061(&$sandbox) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this file has a duplicate filepath, replace it with the
|
||||
// most-recently uploaded file that has the same filepath.
|
||||
if (isset($sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) && $record->fid != $sandbox['duplicate_filepath_fids_to_use'][$file['filepath']]) {
|
||||
$file = db_select('files', 'f')
|
||||
->fields('f', array('fid', 'uid', 'filename', 'filepath', 'filemime', 'filesize', 'status', 'timestamp'))
|
||||
->condition('f.fid', $sandbox['duplicate_filepath_fids_to_use'][$file['filepath']])
|
||||
->execute()
|
||||
->fetchAssoc();
|
||||
}
|
||||
|
||||
// Add in the file information from the upload table.
|
||||
$file['description'] = $record->description;
|
||||
$file['display'] = $record->list;
|
||||
@@ -2825,7 +2953,14 @@ function system_update_7061(&$sandbox) {
|
||||
// We will convert filepaths to URI using the default scheme
|
||||
// and stripping off the existing file directory path.
|
||||
$file['uri'] = $scheme . preg_replace('!^' . preg_quote($basename) . '!', '', $file['filepath']);
|
||||
$file['uri'] = file_stream_wrapper_uri_normalize($file['uri']);
|
||||
// Normalize the URI but don't call file_stream_wrapper_uri_normalize()
|
||||
// directly, since that is a higher-level API function which invokes
|
||||
// hooks while validating the scheme, and those will not work during
|
||||
// the upgrade. Instead, use a simpler version that just assumes the
|
||||
// scheme from above is already valid.
|
||||
if (($file_uri_scheme = file_uri_scheme($file['uri'])) && ($file_uri_target = file_uri_target($file['uri']))) {
|
||||
$file['uri'] = $file_uri_scheme . '://' . $file_uri_target;
|
||||
}
|
||||
unset($file['filepath']);
|
||||
// Insert into the file_managed table.
|
||||
// Each fid should only be stored once in file_managed.
|
||||
@@ -3106,6 +3241,71 @@ function system_update_7078() {
|
||||
), array('unique keys' => array('formats' => array('format', 'type'))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the 'filesize' column in {file_managed} to a bigint.
|
||||
*/
|
||||
function system_update_7079() {
|
||||
$spec = array(
|
||||
'description' => 'The size of the file in bytes.',
|
||||
'type' => 'int',
|
||||
'size' => 'big',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
);
|
||||
db_change_field('file_managed', 'filesize', 'filesize', $spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the 'format' column in {date_format_locale} to case sensitive varchar.
|
||||
*/
|
||||
function system_update_7080() {
|
||||
$spec = array(
|
||||
'description' => 'The date format string.',
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'not null' => TRUE,
|
||||
'binary' => TRUE,
|
||||
);
|
||||
db_change_field('date_format_locale', 'format', 'format', $spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the Drupal 6 default install profile if it is still in the database.
|
||||
*/
|
||||
function system_update_7081() {
|
||||
// Sites which used the default install profile in Drupal 6 and then updated
|
||||
// to Drupal 7.44 or earlier will still have a record of this install profile
|
||||
// in the database that needs to be deleted.
|
||||
db_delete('system')
|
||||
->condition('filename', 'profiles/default/default.profile')
|
||||
->condition('type', 'module')
|
||||
->condition('status', 0)
|
||||
->condition('schema_version', 0)
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add 'jquery-extend-3.4.0.js' to the 'jquery' library.
|
||||
*/
|
||||
function system_update_7082() {
|
||||
// Empty update to force a rebuild of hook_library() and JS aggregates.
|
||||
}
|
||||
|
||||
/**
|
||||
* Add 'jquery-html-prefilter-3.5.0-backport.js' to the 'jquery' library.
|
||||
*/
|
||||
function system_update_7083() {
|
||||
// Empty update to force a rebuild of hook_library() and JS aggregates.
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild JavaScript aggregates to include 'ajax.js' fix for Chrome 83.
|
||||
*/
|
||||
function system_update_7084() {
|
||||
// Empty update to force a rebuild of JS aggregates.
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "defgroup updates-7.x-extra".
|
||||
* The next series of updates should start at 8000.
|
||||
|
||||
Reference in New Issue
Block a user