Skip to content

Commit

Permalink
Merge branch 'release/4.5.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Aug 23, 2023
2 parents 3395410 + b1191c7 commit 19c51a9
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 121 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Release Notes for Craft CMS 4

## 4.5.1 - 2023-08-23

- Control panel notifications no longer block page keyboard shortcuts. ([#13591](https://github.com/craftcms/cms/issues/13591))
- `Garnish.uiLayerManager.addLayer()` now supports a `bubble` option, which allows non-matching keyboard shortcuts to bubble up to the parent layer.
- Fixed an error that could occur when Craft was performing a Composer operation, if no `HOME` environment variable was set for PHP. ([#13590](https://github.com/craftcms/cms/issues/13590))
- Fixed a bug where `craft\fields\Matrix::serializeValue()` was setting `fields` keys to a closure. ([#13592](https://github.com/craftcms/cms/issues/13592))
- Fixed a bug where time values weren’t saving properly for Greek locales. ([#9942](https://github.com/craftcms/cms/issues/9942))
- Fixed a bug where the “Status” lightswitch would always be enabled on edit pages for single-site elements. ([#13595](https://github.com/craftcms/cms/issues/13595))

## 4.5.0 - 2023-08-22

### Content Management
Expand Down
66 changes: 33 additions & 33 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return [
'id' => 'CraftCMS',
'name' => 'Craft CMS',
'version' => '4.5.0',
'version' => '4.5.1',
'schemaVersion' => '4.5.0.3',
'minVersionRequired' => '3.7.11',
'basePath' => dirname(__DIR__), // Defines the @app alias
Expand Down
66 changes: 0 additions & 66 deletions src/config/build-composer-classes.php

This file was deleted.

13 changes: 9 additions & 4 deletions src/controllers/ElementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function beforeAction($action): bool
$this->_draftId = $this->_param('draftId');
$this->_revisionId = $this->_param('revisionId');
$this->_siteId = $this->_param('siteId');
$this->_enabled = $this->_param('enabled') ?? true;
$this->_enabled = $this->_param('enabled', true);
$this->_enabledForSite = $this->_param('enabledForSite');
$this->_slug = $this->_param('slug');
$this->_fresh = (bool)$this->_param('fresh');
Expand All @@ -135,11 +135,16 @@ public function beforeAction($action): bool

/**
* @param string $name
* @param mixed $default
* @return mixed
*/
private function _param(string $name): mixed
private function _param(string $name, mixed $default = null): mixed
{
return ArrayHelper::remove($this->_attributes, $name) ?? $this->request->getQueryParam($name);
$value = ArrayHelper::remove($this->_attributes, $name) ?? $this->request->getQueryParam($name);
if ($value === null && $default !== null && $this->request->getIsPost()) {
return $default;
}
return $value;
}

/**
Expand Down Expand Up @@ -1848,7 +1853,7 @@ private function _applyParamsToElement(ElementInterface $element): void
}

$element->setEnabledForSite($this->_enabledForSite);
} else {
} elseif (isset($this->_enabled)) {
$element->enabled = $this->_enabled;
}

Expand Down
2 changes: 1 addition & 1 deletion src/fields/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function serializeValue(mixed $value, ?ElementInterface $element = null):
'type' => $block->getType()->handle,
'enabled' => $block->enabled,
'collapsed' => $block->collapsed,
'fields' => fn() => $block->getSerializedFieldValues(),
'fields' => $block->getSerializedFieldValues(),
];
}

Expand Down
18 changes: 16 additions & 2 deletions src/helpers/DateTimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,25 @@ private static function _parseTime(string $value): array
// Replace the localized "AM" and "PM"
$am = $formattingLocale->getAMName();
$pm = $formattingLocale->getPMName();
$m = [$am, $pm];

if (preg_match('/(.*)(' . preg_quote($am, '/') . '|' . preg_quote($pm, '/') . ')(.*)/iu', $value, $matches)) {
// account for AM/PM names that might be normalized for jQuery Timepicker
$amAlt = preg_replace('/[\s.]/', '', $am);
$pmAlt = preg_replace('/[\s.]/', '', $pm);

if ($amAlt !== $am) {
$m[] = $amAlt;
}
if ($pmAlt !== $pm) {
$m[] = $pmAlt;
}

$quoted = implode('|', array_map(fn($v) => preg_quote($v, '/'), $m));

if (preg_match("/(.*)($quoted)(.*)/iu", $value, $matches)) {
$value = $matches[1] . $matches[3];

if (mb_strtolower($matches[2]) === mb_strtolower($am)) {
if (in_array(mb_strtolower($matches[2]), [mb_strtolower($am), mb_strtolower($amAlt)])) {
$value .= 'AM';
} else {
$value .= 'PM';
Expand Down
7 changes: 6 additions & 1 deletion src/services/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ private function runComposerCommand(IOInterface $io, string $jsonPath, array $co
'--no-interaction',
]);

$process = new Process($command);
$homePath = Craft::$app->getPath()->getRuntimePath() . DIRECTORY_SEPARATOR . 'composer';
FileHelper::createDirectory($homePath);

$process = new Process($command, null, [
'COMPOSER_HOME' => $homePath,
]);
$process->setTimeout(null);

try {
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/web/assets/cp/src/js/CP.js
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,9 @@ Craft.CP.Notification = Garnish.Base.extend({

this._hasUiElements = !!$detailsContainer.find('button,input');
if (this._hasUiElements) {
Garnish.uiLayerManager.addLayer(this.$container);
Garnish.uiLayerManager.addLayer(this.$container, {
bubble: true,
});
Garnish.uiLayerManager.registerShortcut(Garnish.ESC_KEY, () => {
this.close();
});
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/garnish/dist/garnish.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/garnish/dist/garnish.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 19c51a9

Please sign in to comment.