Skip to content

Commit 6d8a779

Browse files
1611347671: Proposed release for 7.x-1.18.15 (#115)
1 parent 79e2d4a commit 6d8a779

File tree

85 files changed

+1386
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1386
-98
lines changed

CHANGELOG.txt

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
Drupal 7.78, 2021-01-19
2+
-----------------------
3+
- Fixed security issues:
4+
- SA-CORE-2021-001
5+
6+
Drupal 7.77, 2020-12-03
7+
-----------------------
8+
- Hotfix for schema.prefixed tables
9+
10+
Drupal 7.76, 2020-12-02
11+
-----------------------
12+
- Support for MySQL 8
13+
- Core tests pass in SQLite
14+
- Better user flood control logging
15+
116
Drupal 7.75, 2020-11-26
217
-----------------------
318
- Fixed security issues:

MAINTAINERS.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The branch maintainers for Drupal 7 are:
1212

1313
- Dries Buytaert 'dries' https://www.drupal.org/u/dries
1414
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
15-
- (provisional) Drew Webber 'mcdruid' https://www.drupal.org/u/mcdruid
15+
- Drew Webber 'mcdruid' https://www.drupal.org/u/mcdruid
1616

1717

1818
Component maintainers

includes/bootstrap.inc

+10-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* The current system version.
1010
*/
11-
define('VERSION', '7.75');
11+
define('VERSION', '7.78');
1212

1313
/**
1414
* Core API compatibility.
@@ -1214,19 +1214,21 @@ function variable_initialize($conf = array()) {
12141214
$variables = $cached->data;
12151215
}
12161216
else {
1217-
// Cache miss. Avoid a stampede.
1217+
// Cache miss. Avoid a stampede by acquiring a lock. If the lock fails to
1218+
// acquire, optionally just continue with uncached processing.
12181219
$name = 'variable_init';
1219-
if (!lock_acquire($name, 1)) {
1220-
// Another request is building the variable cache.
1221-
// Wait, then re-run this function.
1220+
$lock_acquired = lock_acquire($name, 1);
1221+
if (!$lock_acquired && variable_get('variable_initialize_wait_for_lock', FALSE)) {
12221222
lock_wait($name);
12231223
return variable_initialize($conf);
12241224
}
12251225
else {
1226-
// Proceed with variable rebuild.
1226+
// Load the variables from the table.
12271227
$variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed());
1228-
cache_set('variables', $variables, 'cache_bootstrap');
1229-
lock_release($name);
1228+
if ($lock_acquired) {
1229+
cache_set('variables', $variables, 'cache_bootstrap');
1230+
lock_release($name);
1231+
}
12301232
}
12311233
}
12321234

includes/common.inc

+17-6
Original file line numberDiff line numberDiff line change
@@ -6670,30 +6670,41 @@ function element_children(&$elements, $sort = FALSE) {
66706670
$sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;
66716671

66726672
// Filter out properties from the element, leaving only children.
6673-
$children = array();
6673+
$count = count($elements);
6674+
$child_weights = array();
6675+
$i = 0;
66746676
$sortable = FALSE;
66756677
foreach ($elements as $key => $value) {
66766678
if (is_int($key) || $key === '' || $key[0] !== '#') {
6677-
$children[$key] = $value;
66786679
if (is_array($value) && isset($value['#weight'])) {
6680+
$weight = $value['#weight'];
66796681
$sortable = TRUE;
66806682
}
6683+
else {
6684+
$weight = 0;
6685+
}
6686+
// Support weights with up to three digit precision and conserve the
6687+
// insertion order.
6688+
$child_weights[$key] = floor($weight * 1000) + $i / $count;
66816689
}
6690+
$i++;
66826691
}
6692+
66836693
// Sort the children if necessary.
66846694
if ($sort && $sortable) {
6685-
uasort($children, 'element_sort');
6695+
asort($child_weights);
66866696
// Put the sorted children back into $elements in the correct order, to
66876697
// preserve sorting if the same element is passed through
66886698
// element_children() twice.
6689-
foreach ($children as $key => $child) {
6699+
foreach ($child_weights as $key => $weight) {
6700+
$value = $elements[$key];
66906701
unset($elements[$key]);
6691-
$elements[$key] = $child;
6702+
$elements[$key] = $value;
66926703
}
66936704
$elements['#sorted'] = TRUE;
66946705
}
66956706

6696-
return array_keys($children);
6707+
return array_keys($child_weights);
66976708
}
66986709

66996710
/**

includes/database/database.inc

+45-2
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,13 @@ abstract class DatabaseConnection extends PDO {
310310
*/
311311
protected $escapedAliases = array();
312312

313+
/**
314+
* List of un-prefixed table names, keyed by prefixed table names.
315+
*
316+
* @var array
317+
*/
318+
protected $unprefixedTablesMap = array();
319+
313320
function __construct($dsn, $username, $password, $driver_options = array()) {
314321
// Initialize and prepare the connection prefix.
315322
$this->setPrefix(isset($this->connectionOptions['prefix']) ? $this->connectionOptions['prefix'] : '');
@@ -338,7 +345,9 @@ abstract class DatabaseConnection extends PDO {
338345
// Destroy all references to this connection by setting them to NULL.
339346
// The Statement class attribute only accepts a new value that presents a
340347
// proper callable, so we reset it to PDOStatement.
341-
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array()));
348+
if (!empty($this->statementClass)) {
349+
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array()));
350+
}
342351
$this->schema = NULL;
343352
}
344353

@@ -442,6 +451,13 @@ abstract class DatabaseConnection extends PDO {
442451
$this->prefixReplace[] = $this->prefixes['default'];
443452
$this->prefixSearch[] = '}';
444453
$this->prefixReplace[] = '';
454+
455+
// Set up a map of prefixed => un-prefixed tables.
456+
foreach ($this->prefixes as $table_name => $prefix) {
457+
if ($table_name !== 'default') {
458+
$this->unprefixedTablesMap[$prefix . $table_name] = $table_name;
459+
}
460+
}
445461
}
446462

447463
/**
@@ -477,6 +493,17 @@ abstract class DatabaseConnection extends PDO {
477493
}
478494
}
479495

496+
/**
497+
* Gets a list of individually prefixed table names.
498+
*
499+
* @return array
500+
* An array of un-prefixed table names, keyed by their fully qualified table
501+
* names (i.e. prefix + table_name).
502+
*/
503+
public function getUnprefixedTablesMap() {
504+
return $this->unprefixedTablesMap;
505+
}
506+
480507
/**
481508
* Prepares a query string and returns the prepared statement.
482509
*
@@ -2840,7 +2867,6 @@ function db_field_exists($table, $field) {
28402867
*
28412868
* @param $table_expression
28422869
* An SQL expression, for example "simpletest%" (without the quotes).
2843-
* BEWARE: this is not prefixed, the caller should take care of that.
28442870
*
28452871
* @return
28462872
* Array, both the keys and the values are the matching tables.
@@ -2849,6 +2875,23 @@ function db_find_tables($table_expression) {
28492875
return Database::getConnection()->schema()->findTables($table_expression);
28502876
}
28512877

2878+
/**
2879+
* Finds all tables that are like the specified base table name. This is a
2880+
* backport of the change made to db_find_tables in Drupal 8 to work with
2881+
* virtual, un-prefixed table names. The original function is retained for
2882+
* Backwards Compatibility.
2883+
* @see https://www.drupal.org/node/2552435
2884+
*
2885+
* @param $table_expression
2886+
* An SQL expression, for example "simpletest%" (without the quotes).
2887+
*
2888+
* @return
2889+
* Array, both the keys and the values are the matching tables.
2890+
*/
2891+
function db_find_tables_d8($table_expression) {
2892+
return Database::getConnection()->schema()->findTablesD8($table_expression);
2893+
}
2894+
28522895
function _db_create_keys_sql($spec) {
28532896
return Database::getConnection()->schema()->createKeysSql($spec);
28542897
}

0 commit comments

Comments
 (0)