Skip to content

Commit

Permalink
Backdrop 1.29.2 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
shelane authored Nov 25, 2024
1 parent 7d24ba2 commit d86a945
Show file tree
Hide file tree
Showing 243 changed files with 807 additions and 690 deletions.
3 changes: 2 additions & 1 deletion docroot/core/includes/bootstrap.classes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ function backdrop_class_list() {
'DatabaseStatementEmpty' => $path . 'database/database.inc',
'DatabaseStatementInterface' => $path . 'database/database.inc',
'DatabaseLog' => $path . 'database/log.inc',
'DatabaseStatementPrefetch' => $path . 'database/prefetch.inc',
// @todo Remove DatabaseStatementPrefetch entirely, only used by SQLite.
// 'DatabaseStatementPrefetch' => $path . 'database/prefetch.inc',
'Query' => $path . 'database/query.inc',
'InsertQuery' => $path . 'database/query.inc',
'DeleteQuery' => $path . 'database/query.inc',
Expand Down
5 changes: 4 additions & 1 deletion docroot/core/includes/bootstrap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* The current system version.
*/
define('BACKDROP_VERSION', '1.29.0');
define('BACKDROP_VERSION', '1.29.2');

/**
* Core API compatibility.
Expand Down Expand Up @@ -469,6 +469,9 @@ abstract class BackdropCacheArray implements ArrayAccess {
* Destructs the BackdropCacheArray object.
*/
public function __destruct() {
if (!is_array($this->keysToPersist)) {
throw new UnexpectedValueException();
}
$data = array();
foreach ($this->keysToPersist as $offset => $persist) {
if ($persist) {
Expand Down
9 changes: 9 additions & 0 deletions docroot/core/includes/database/mysql/query.inc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ class InsertQuery_mysql extends InsertQuery {

$max_placeholder = 0;
$values = array();
if (!is_array($this->insertValues)) {
// Older PHP versions cannot throw an exception within __toString().
if (version_compare(PHP_VERSION, '7.4', '>=')) {
throw new UnexpectedValueException();
}
else {
trigger_error('Unexpected Value');
}
}
if (count($this->insertValues)) {
foreach ($this->insertValues as $insert_values) {
$placeholders = array();
Expand Down
7 changes: 7 additions & 0 deletions docroot/core/includes/database/prefetch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ class DatabaseStatementPrefetch implements Iterator, DatabaseStatementInterface
$class_name = $this->fetchOptions['class'];
}
if (count($this->fetchOptions['constructor_args'])) {
// Verify the current db connection to avoid this code being called
// in an inappropriate context.
$db_connection_options = Database::getConnection()->getConnectionOptions();
$valid_db_drivers = array('sqlite', 'oracle');
if (!in_array($db_connection_options['driver'], $valid_db_drivers)) {
throw new BadMethodCallException();
}
$reflector = new ReflectionClass($class_name);
$result = $reflector->newInstanceArgs($this->fetchOptions['constructor_args']);
}
Expand Down
10 changes: 10 additions & 0 deletions docroot/core/includes/database/query.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,16 @@ class UpdateQuery extends Query implements QueryConditionInterface {
* The prepared statement.
*/
public function __toString() {
// Older PHP versions cannot throw an exception in __toString().
if (!is_array($this->expressionFields) || !is_array($this->fields)) {
if (version_compare(PHP_VERSION, '7.4', '>=')) {
throw new UnexpectedValueException();
}
else {
trigger_error('Unexpected Value');
}
}

// Create a sanitized comment string to prepend to the query.
$comments = $this->connection->makeComment($this->comments);

Expand Down
13 changes: 8 additions & 5 deletions docroot/core/includes/file.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,9 @@ function file_validate_svg(File $file) {

if ($file->filemime == 'image/svg+xml') {
$file_contents = file_get_contents($file->uri);
$file_contents = preg_replace('/<!DOCTYPE[^>]*>/i', '', $file_contents);
$file_contents = html_entity_decode($file_contents);
$file_contents = strtolower($file_contents);
libxml_use_internal_errors(TRUE);
$xml = simplexml_load_string($file_contents);
$errors = libxml_get_errors();
Expand All @@ -2054,15 +2057,15 @@ function file_validate_svg(File $file) {

$search_patterns = array(
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element
'//svg:foreignObject',
'//svg:foreignobject',
'//svg:script',
'//html:iframe',
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
'//@*[starts-with(name(), "on")]',
'//svg:a[starts-with(@href, "javascript:")]',
'//svg:a[starts-with(@xlink:href, "javascript:")]',
'//svg:a[starts-with(@href, "data:")]',
'//svg:a[starts-with(@xlink:href, "data:")]',
'//svg:a[starts-with(normalize-space(@href), "javascript:")]',
'//svg:a[starts-with(normalize-space(@xlink:href), "javascript:")]',
'//svg:a[starts-with(normalize-space(@href), "data:")]',
'//svg:a[starts-with(normalize-space(@xlink:href), "data:")]',
);

$xml->registerXPathNamespace('svg', 'http://www.w3.org/2000/svg');
Expand Down
3 changes: 2 additions & 1 deletion docroot/core/includes/icon.inc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function icon_get_info($icon_name = NULL) {
* - attributes: Attributes to be added to the icon itself.
*
* @return string
* The HTML output.
* The HTML output. An empty string if the icon file is not svg.
*
* @since 1.28.0 Function added.
* @since 1.28.1 The <ellipse>, <line>, <polygon> and <polyline> SVG elements
Expand Down Expand Up @@ -340,4 +340,5 @@ function theme_icon(array $variables) {
return image_add_svg_attributes($svg_contents, $variables['attributes']);
}
}
return '';
}
37 changes: 23 additions & 14 deletions docroot/core/includes/image.inc
Original file line number Diff line number Diff line change
Expand Up @@ -577,30 +577,39 @@ function image_is_svg($uri) {
* which is the accessible mechanism for alternative text within SVGs.
*
* @return string
* The SVG image contents with the attributes added.
* The SVG image contents with the attributes added. An empty string in case
* of errors.
*
* @since 1.28.0 Function added.
*/
function image_add_svg_attributes($svg_content, array $attributes) {
$doc = new DOMDocument();
libxml_use_internal_errors(TRUE);
$doc->loadXML($svg_content);
$svg_tag = $doc->getElementsByTagName('svg')->item(0);
$last_error = libxml_get_last_error();
libxml_use_internal_errors(FALSE);
if (empty($svg_tag)) {
$message = $last_error ? trim($last_error->message) : '';
watchdog('image', 'Failed to parse SVG content. %message', array(
'%message' => $message,
), WATCHDOG_ERROR);
return '';
}

// Convert the alt attribute to a <title> element.
if (isset($attributes['alt'])) {
try {
if (strlen($attributes['alt'])) {
$title = $doc->createElement('title');
$title->textContent = $attributes['alt'];
// Since DOMDocument::prepend() is not available in PHP versions prior
// to v8, we are using DOMNode::insertBefore().
$svg_tag->insertBefore($title, $svg_tag->firstChild);
}
// Remove any given <title> element if alt is an empty string.
elseif ($svg_tag->firstChild && $svg_tag->firstChild->nodeName === 'title') {
$svg_tag->removeChild($svg_tag->firstChild);
}
} catch (DOMException $e) {}
if (strlen($attributes['alt'])) {
$title = $doc->createElement('title');
$title->textContent = $attributes['alt'];
// Since DOMDocument::prepend() is not available in PHP versions prior
// to v8, we are using DOMNode::insertBefore().
$svg_tag->insertBefore($title, $svg_tag->firstChild);
}
// Remove any given <title> element if alt is an empty string.
elseif ($svg_tag->firstChild && $svg_tag->firstChild->nodeName === 'title') {
$svg_tag->removeChild($svg_tag->firstChild);
}
unset($attributes['alt']);
}

Expand Down
26 changes: 19 additions & 7 deletions docroot/core/includes/install.core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1616,13 +1616,12 @@ function install_check_translation_download($langcode) {
}

$version = BACKDROP_VERSION;
$fallback_version = BACKDROP_CORE_COMPATIBILITY;

// For dev releases, remove the '-dev' part and trust the translation server
// to fall back to the latest stable release for that branch.
// @see locale_translation_build_projects()
if (preg_match("/^(\d+\.).*-(dev|preview)$/", $version, $matches)) {
// Example match: 1.28-dev => 1.x (Backdrop core).
$version = $matches[1] . 'x';
// Get major and minor version, ignore any irrelevant dev or preview addition.
if (preg_match("/^(\d+)\.(\d+)/", $version, $matches)) {
$version = $matches[0];
$fallback_version = $matches[1] . '.x';
}

// Build URL for the translation file and the translation server.
Expand All @@ -1633,6 +1632,9 @@ function install_check_translation_download($langcode) {
'%language' => $langcode,
);
$translation_url = strtr(INSTALL_LOCALIZATION_SERVER_PATTERN, $variables);
// Also build a generic fallback URL.
$variables['%version'] = $fallback_version;
$fallback_url = strtr(INSTALL_LOCALIZATION_SERVER_PATTERN, $variables);

$elements = parse_url($translation_url);
$server_url = $elements['scheme'] . '://' . $elements['host'];
Expand All @@ -1650,7 +1652,17 @@ function install_check_translation_download($langcode) {
$online = TRUE;
}
if ($online) {
$translation_available = install_check_localization_server($translation_url);
// We have to start with the fallback URL, otherwise the static cache
// already returns FALSE.
$translation_available = install_check_localization_server($fallback_url);
if ($translation_available) {
// Look up the version specific translation file. We can not rely on its
// existence, as generation happens manually after release.
// If it does not exist, yet, we stick with the generic fallback.
if (!install_check_localization_server($translation_url)) {
$translation_url = $fallback_url;
}
}
}

// If the translations directory does not exist, throw an error.
Expand Down
6 changes: 3 additions & 3 deletions docroot/core/layouts/boxton/boxton.info
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ preview = boxton.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/geary/geary.info
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ preview = geary.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/harris/harris.info
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ preview = harris.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/legacy/one_column/one_column.info
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ regions[footer] = Footer
; Modify this line if you would like to change the default in this layout.
default region = content

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ regions[footer] = Footer bottom
; Modify this line if you would like to change the default in this layout.
default region = content

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/legacy/two_column/two_column.info
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ regions[footer] = Footer
; Modify this line if you would like to change the default in this layout.
default region = content

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ regions[footer] = Footer
; Modify this line if you would like to change the default in this layout.
default region = content

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/moscone/moscone.info
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ preview = moscone.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/moscone_flipped/moscone_flipped.info
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ preview = moscone-flipped.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/rolph/rolph.info
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ preview = rolph.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/simmons/simmons.info
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ file = simmons.php
; Default stylesheets for this layout
; stylesheets[all][] = simmons.css

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/sutro/sutro.info
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ preview = sutro.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/taylor/taylor.info
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ preview = taylor.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/layouts/taylor_flipped/taylor_flipped.info
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ preview = taylor-flipped.png
; Include the Bootstrap4 Grid System
libraries[] = bootstrap4-gs

; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
6 changes: 3 additions & 3 deletions docroot/core/modules/admin_bar/admin_bar.info
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ backdrop = 1.x
configure = admin/config/administration/admin-bar


; Added by Backdrop CMS packaging script on 2024-09-15
; Added by Backdrop CMS packaging script on 2024-11-20
project = backdrop
version = 1.29.0
timestamp = 1726467067
version = 1.29.2
timestamp = 1732142640
2 changes: 1 addition & 1 deletion docroot/core/modules/admin_bar/js/admin_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Backdrop.adminBar.behaviors.resizeCollapse = function (context, settings, $admin
extraWidth = $extra.width() || 0;

// Available width is anything except the menus that may be collapsed.
availableWidth = $adminBar.width();
availableWidth = $(window).width();
$adminBar.children().children().not($menu).not($extra).each(function() {
availableWidth -= $(this).width();
});
Expand Down
Loading

0 comments on commit d86a945

Please sign in to comment.