Unverified Commit 148fbf12 authored by Andrei Ivnitskii's avatar Andrei Ivnitskii Committed by GitHub

issue #1280: Обновить ядро до версии 7.64 (#1281)

parent d6ff6f79
......@@ -101,11 +101,8 @@ DirectoryIndex index.php index.html index.htm
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} ^(www\.drupal|(www\.)?drupalru)\.ru$ [NC]
RewriteRule ^ http://drupal.ru%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^(.+\.)drupalru\.ru$ [NC]
RewriteRule ^ http://%1drupal.ru%{REQUEST_URI} [L,R=301]
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
......
Drupal 7.xx, xxxx-xx-xx (development version)
-----------------------
Drupal 7.64, 2019-02-06
-----------------------
- [regression] Unset the 'host' header in drupal_http_request() during redirect
- Fixed: 7.x does not have Phar protection and Phar tests are failing on Drupal 7
- Fixed: Notice: Undefined index: display_field in file_field_widget_value() (line 582 of /module/file/file.field.inc)
- Performance improvement: Registry rebuild should not parse the same file twice in the same request
- Fixed _registry_update() to clear caches after transaction is committed
Drupal 7.63, 2019-01-16
-----------------------
- Fixed a fatal error for some Drush users introduced by SA-CORE-2019-002.
......
......@@ -8,7 +8,7 @@
/**
* The current system version.
*/
define('VERSION', '7.63');
define('VERSION', '7.64');
/**
* Core API compatibility.
......
......@@ -1094,6 +1094,11 @@ function drupal_http_request($url, array $options = array()) {
elseif ($options['max_redirects']) {
// Redirect to the new location.
$options['max_redirects']--;
// We need to unset the 'Host' header
// as we are redirecting to a new location.
unset($options['headers']['Host']);
$result = drupal_http_request($location, $options);
$result->redirect_code = $code;
}
......
......@@ -2130,9 +2130,33 @@ function file_download_access($uri) {
* 'filename', and 'name' members corresponding to the matching files.
*/
function file_scan_directory($dir, $mask, $options = array(), $depth = 0) {
// Default nomask option.
$nomask = '/(\.\.?|CVS)$/';
// Overrides the $nomask variable accordingly if $options['nomask'] is set.
//
// Allow directories specified in settings.php to be ignored. You can use this
// to not check for files in common special-purpose directories. For example,
// node_modules and bower_components. Ignoring irrelevant directories is a
// performance boost.
if (!isset($options['nomask'])) {
$ignore_directories = variable_get(
'file_scan_ignore_directories',
array()
);
foreach ($ignore_directories as $index => $ignore_directory) {
$ignore_directories[$index] = preg_quote($ignore_directory, '/');
}
if (!empty($ignore_directories)) {
$nomask = '/^(\.\.?)|CVS|' . implode('|', $ignore_directories) . '$/';
}
}
// Merge in defaults.
$options += array(
'nomask' => '/(\.\.?|CVS)$/',
'nomask' => $nomask,
'callback' => 0,
'recurse' => TRUE,
'key' => 'uri',
......
......@@ -19,7 +19,6 @@
* Does the work for registry_update().
*/
function _registry_update() {
// The registry serves as a central autoloader for all classes, including
// the database query builders. However, the registry rebuild process
// requires write ability to the database, which means having access to the
......@@ -33,6 +32,11 @@ function _registry_update() {
require_once DRUPAL_ROOT . '/includes/database/select.inc';
require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/query.inc';
// During the first registry rebuild in a request, we check all the files.
// During subsequent rebuilds, we only add new files. It makes the rebuilding
// process faster during installation of modules.
static $check_existing_files = TRUE;
// Get current list of modules and their files.
$modules = db_query("SELECT * FROM {system} WHERE type = 'module'")->fetchAll();
// Get the list of files we are going to parse.
......@@ -55,6 +59,9 @@ function _registry_update() {
$files["$filename"] = array('module' => '', 'weight' => 0);
}
// Initialize an empty array for the unchanged files.
$unchanged_files = array();
$transaction = db_transaction();
try {
// Allow modules to manually modify the list of files before the registry
......@@ -63,10 +70,19 @@ function _registry_update() {
// list can then be added to the list of files that the registry will parse,
// or modify attributes of a file.
drupal_alter('registry_files', $files, $modules);
foreach (registry_get_parsed_files() as $filename => $file) {
// Add the hash for those files we have already parsed.
if (isset($files[$filename])) {
$files[$filename]['hash'] = $file['hash'];
if ($check_existing_files === TRUE) {
$files[$filename]['hash'] = $file['hash'];
}
else {
// Ignore that file for this request, it has been parsed previously
// and it is unlikely it has changed.
unset($files[$filename]);
$unchanged_files[$filename] = $file;
}
}
else {
// Flush the registry of resources in files that are no longer on disc
......@@ -79,8 +95,12 @@ function _registry_update() {
->execute();
}
}
$parsed_files = _registry_parse_files($files);
// Add unchanged files to the files.
$files += $unchanged_files;
$unchanged_resources = array();
$lookup_cache = array();
if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) {
......@@ -89,12 +109,10 @@ function _registry_update() {
foreach ($lookup_cache as $key => $file) {
// If the file for this cached resource is carried over unchanged from
// the last registry build, then we can safely re-cache it.
if ($file && in_array($file, array_keys($files)) && !in_array($file, $parsed_files)) {
if ($file && isset($files[$file]) && !in_array($file, $parsed_files, TRUE)) {
$unchanged_resources[$key] = $file;
}
}
module_implements('', FALSE, TRUE);
_registry_check_code(REGISTRY_RESET_LOOKUP_CACHE);
}
catch (Exception $e) {
$transaction->rollback();
......@@ -102,6 +120,13 @@ function _registry_update() {
throw $e;
}
module_implements('', FALSE, TRUE);
_registry_check_code(REGISTRY_RESET_LOOKUP_CACHE);
// During the next run in this request, don't bother re-checking existing
// files.
$check_existing_files = FALSE;
// We have some unchanged resources, warm up the cache - no need to pay
// for looking them up again.
if (count($unchanged_resources) > 0) {
......
......@@ -7,7 +7,7 @@ files[] = aggregator.test
configure = admin/config/services/aggregator/settings
stylesheets[all][] = aggregator.css
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
files[] = block.test
configure = admin/structure/block
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -13,7 +13,7 @@ regions[footer] = Footer
regions[highlighted] = Highlighted
regions[help] = Help
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = blog.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ files[] = book.test
configure = admin/content/book/settings
stylesheets[all][] = book.css
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = color.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -9,7 +9,7 @@ files[] = comment.test
configure = admin/content/comment
stylesheets[all][] = comment.css
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
files[] = contact.test
configure = admin/structure/contact
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = contextual.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ files[] = dashboard.test
dependencies[] = block
configure = admin/dashboard/customize
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = dblog.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -11,7 +11,7 @@ dependencies[] = field_sql_storage
required = TRUE
stylesheets[all][] = theme/field.css
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ dependencies[] = field
files[] = field_sql_storage.test
required = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ dependencies[] = field
dependencies[] = options
files[] = tests/list.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = number.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -69,7 +69,7 @@ class NumberFieldTestCase extends DrupalWebTestCase {
preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match);
$id = $match[1];
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
$this->assertRaw(round($value, 2), 'Value is displayed.');
$this->assertRaw($value, 'Value is displayed.');
// Try to create entries with more than one decimal separator; assert fail.
$wrong_entries = array(
......
......@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = options.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ dependencies[] = field
files[] = text.test
required = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ files[] = field_test.entity.inc
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = field_ui.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -599,7 +599,7 @@ function file_field_widget_value($element, $input = FALSE, $form_state) {
// If the display field is present make sure its unchecked value is saved.
$field = field_widget_field($element, $form_state);
if (empty($input['display'])) {
$input['display'] = $field['settings']['display_field'] ? 0 : 1;
$input['display'] = !empty($field['settings']['display_field']) ? 0 : 1;
}
}
......
......@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = tests/file.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -1875,3 +1875,60 @@ class FileFieldAnonymousSubmission extends FileFieldTestCase {
}
}
/**
* Tests the file_scan_directory() function.
*/
class FileScanDirectory extends FileFieldTestCase {
/**
* @var string
*/
protected $path;
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'File ScanDirectory',
'description' => 'Tests the file_scan_directory() function.',
'group' => 'File',
);
}
/**
* {@inheritdoc}
*/
function setUp() {
parent::setUp();
$this->path = 'modules/file/tests/fixtures/file_scan_ignore';
}
/**
* Tests file_scan_directory() obeys 'file_scan_ignore_directories' setting.
* If nomask is not passed as argument, it should use the default settings.
* If nomask is passed as argument, it should obey this rule.
*/
public function testNoMask() {
$files = file_scan_directory($this->path, '/\.txt$/');
$this->assertEqual(3, count($files), '3 text files found when not ignoring directories.');
global $conf;
$conf['file_scan_ignore_directories'] = array('frontend_framework');
$files = file_scan_directory($this->path, '/\.txt$/');
$this->assertEqual(1, count($files), '1 text files found when ignoring directories called "frontend_framework".');
// Make that directories specified by default still work when a new nomask is provided.
$files = file_scan_directory($this->path, '/\.txt$/', array('nomask' => '/^c.txt/'));
$this->assertEqual(2, count($files), '2 text files found when an "nomask" option is passed in.');
// Ensure that the directories in file_scan_ignore_directories are escaped using preg_quote.
$conf['file_scan_ignore_directories'] = array('frontend.*');
$files = file_scan_directory($this->path, '/\.txt$/');
$this->assertEqual(3, count($files), '2 text files found when ignoring a directory that is not there.');
}
}
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ files[] = filter.test
required = TRUE
configure = admin/config/content/formats
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -9,7 +9,7 @@ files[] = forum.test
configure = admin/structure/forum
stylesheets[all][] = forum.css
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = help.test
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -7,7 +7,7 @@ dependencies[] = file
files[] = image.test
configure = admin/config/media/image-styles
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
files[] = image_module_test.module
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
files[] = locale.test
configure = admin/config/regional/language
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -6,7 +6,7 @@ core = 7.x
files[] = menu.test
configure = admin/structure/menu
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -9,7 +9,7 @@ required = TRUE
configure = admin/structure/types
stylesheets[all][] = node.css
; Information added by Drupal.org packaging script on 2019-01-16
version = "7.63"
; Information added by Drupal.org packaging script on 2019-02-06
version = "7.64"
project = "drupal"
datestamp = "1547681965"
datestamp = "1549481024"
......@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-01-16