From 9a4c92c2e2ab1848f67951e875954bbed71c74d4 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 10 Aug 2023 00:18:31 -0700 Subject: [PATCH 01/13] Assets::getAllDescendantFolders() $asTree arg Backports cbe96b2209ce294ec84a23ce45c0871efbac1cfd for #13535 --- CHANGELOG-WIP.md | 1 + src/services/Assets.php | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md index 06489066cf2..8187aa7071c 100644 --- a/CHANGELOG-WIP.md +++ b/CHANGELOG-WIP.md @@ -9,6 +9,7 @@ ### Development ### Extensibility +- `craft\services\Assets::getAllDescendantFolders()` now has an `$asTree` argument. ([#13535](https://github.com/craftcms/cms/discussions/13535)) ### System - Updated Yii to 2.0.48.1. ([#13444](https://github.com/craftcms/cms/pull/13444)) diff --git a/src/services/Assets.php b/src/services/Assets.php index 8d41ab1f42e..72ea91b1273 100644 --- a/src/services/Assets.php +++ b/src/services/Assets.php @@ -517,10 +517,15 @@ public function findFolders($criteria = null): array * @param VolumeFolder $parentFolder * @param string $orderBy * @param bool $withParent Whether the parent folder should be included in the results - * @return array + * @param bool $asTree Whether the folders should be returned hierarchically + * @return VolumeFolder[] */ - public function getAllDescendantFolders(VolumeFolder $parentFolder, string $orderBy = 'path', bool $withParent = true): array - { + public function getAllDescendantFolders( + VolumeFolder $parentFolder, + string $orderBy = 'path', + bool $withParent = true, + bool $asTree = false, + ): array { $query = $this->createFolderQuery() ->where([ 'and', @@ -549,6 +554,10 @@ public function getAllDescendantFolders(VolumeFolder $parentFolder, string $orde $descendantFolders[$folder->id] = $folder; } + if ($asTree) { + return $this->_getFolderTreeByFolders($descendantFolders); + } + return $descendantFolders; } @@ -1238,11 +1247,12 @@ public function createFolderQuery(): Query * Return the folder tree form a list of folders. * * @param VolumeFolder[] $folders - * @return array + * @return VolumeFolder[] */ private function _getFolderTreeByFolders(array $folders): array { $tree = []; + /** @var VolumeFolder[] $referenceStore */ $referenceStore = []; foreach ($folders as $folder) { From ae02cf4bc46c3281ada2c26676cadf0d2a63c69c Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 10 Aug 2023 09:29:09 -0700 Subject: [PATCH 02/13] Fixed PHP 7 syntax error --- src/services/Assets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Assets.php b/src/services/Assets.php index 72ea91b1273..adaac6f6631 100644 --- a/src/services/Assets.php +++ b/src/services/Assets.php @@ -524,7 +524,7 @@ public function getAllDescendantFolders( VolumeFolder $parentFolder, string $orderBy = 'path', bool $withParent = true, - bool $asTree = false, + bool $asTree = false ): array { $query = $this->createFolderQuery() ->where([ From 960cb2f2adb127e586a609d2ad47e25e5d320e38 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 22 Aug 2023 08:53:28 -0700 Subject: [PATCH 03/13] Finish 3.9.0 --- CHANGELOG-WIP.md | 17 ----------------- CHANGELOG.md | 6 +++++- src/config/app.php | 2 +- 3 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 CHANGELOG-WIP.md diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md deleted file mode 100644 index 8187aa7071c..00000000000 --- a/CHANGELOG-WIP.md +++ /dev/null @@ -1,17 +0,0 @@ -# Release Notes for Craft CMS 3.9 (WIP) - -### Content Management - -### Accessibility - -### Administration - -### Development - -### Extensibility -- `craft\services\Assets::getAllDescendantFolders()` now has an `$asTree` argument. ([#13535](https://github.com/craftcms/cms/discussions/13535)) - -### System -- Updated Yii to 2.0.48.1. ([#13444](https://github.com/craftcms/cms/pull/13444)) -- Loosened the Composer constraint to `^2.2.19`. ([#13396](https://github.com/craftcms/cms/discussions/13396)) -- Internal Composer operations now use a bundled `composer.phar` file, rather than Composer’s PHP API. ([#13519](https://github.com/craftcms/cms/pull/13519)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9d109863c..30b42bf7553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Release Notes for Craft CMS 3.x -## Unreleased +## 3.9.0 - 2023-08-22 +- Updated Yii to 2.0.48.1. ([#13444](https://github.com/craftcms/cms/pull/13444)) +- Loosened the Composer constraint to `^2.2.19`. ([#13396](https://github.com/craftcms/cms/discussions/13396)) +- Internal Composer operations now use a bundled `composer.phar` file, rather than Composer’s PHP API. ([#13519](https://github.com/craftcms/cms/pull/13519)) +- `craft\services\Assets::getAllDescendantFolders()` now has an `$asTree` argument. ([#13535](https://github.com/craftcms/cms/discussions/13535)) - Fixed a bug where asset exports could be blank if only subfolders were selected. ## 3.8.17 - 2023-08-08 diff --git a/src/config/app.php b/src/config/app.php index 733dedf339e..505c6eed2a6 100644 --- a/src/config/app.php +++ b/src/config/app.php @@ -3,7 +3,7 @@ return [ 'id' => 'CraftCMS', 'name' => 'Craft CMS', - 'version' => '3.8.17', + 'version' => '3.9.0', 'schemaVersion' => '3.8.0.1', 'minVersionRequired' => '2.6.2788', 'basePath' => dirname(__DIR__), // Defines the @app alias From d0f0fe84f83b49715322e9d28714f5e2857f7289 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 22 Aug 2023 08:55:44 -0700 Subject: [PATCH 04/13] Drop 3.9 [ci skip] --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a917dd43ea8..d8e641b4ac1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,6 @@ on: push: branches: - v3 - - 3.9 pull_request: types: - opened From 687639f61b82ddf087a09772e6e84f7ef9406699 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 22 Aug 2023 16:38:28 -0700 Subject: [PATCH 05/13] Remove build-composer-classes.php --- src/config/build-composer-classes.php | 66 --------------------------- 1 file changed, 66 deletions(-) delete mode 100644 src/config/build-composer-classes.php diff --git a/src/config/build-composer-classes.php b/src/config/build-composer-classes.php deleted file mode 100644 index 8c893384798..00000000000 --- a/src/config/build-composer-classes.php +++ /dev/null @@ -1,66 +0,0 @@ -getClassMap() as $class => $file) { - if ( - strpos($class, 'Composer\\') === 0 && - strpos($class, 'Composer\\Command\\') !== 0 && - strpos($class, 'Composer\\Console\\') !== 0 && - strpos($class, 'Composer\\XdebugHandler\\') !== 0 - ) { - $classes[] = $class; - } -} - -sort($classes); - - -$content = << Date: Wed, 23 Aug 2023 10:46:52 -0700 Subject: [PATCH 06/13] Fixed #13590 --- CHANGELOG.md | 4 ++++ src/services/Composer.php | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b42bf7553..abfd6014017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Craft CMS 3.x +## Unreleased + +- 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)) + ## 3.9.0 - 2023-08-22 - Updated Yii to 2.0.48.1. ([#13444](https://github.com/craftcms/cms/pull/13444)) diff --git a/src/services/Composer.php b/src/services/Composer.php index d032dac89c9..d5d7164a5b8 100644 --- a/src/services/Composer.php +++ b/src/services/Composer.php @@ -213,7 +213,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 { From c22ac54ff5b70694d6c27983460708231b12e05c Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 23 Aug 2023 11:01:50 -0700 Subject: [PATCH 07/13] Fixed #13592 --- CHANGELOG.md | 4 ++++ src/fields/Matrix.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e7467704ff..a2cc6a715d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Craft CMS 4 +## Unreleased + +- Fixed a bug where `craft\fields\Matrix::serializeValue()` was setting `fields` keys to a closure. ([#13592](https://github.com/craftcms/cms/issues/13592)) + ## 4.5.0 - 2023-08-22 ### Content Management diff --git a/src/fields/Matrix.php b/src/fields/Matrix.php index 1f3cf238d22..f4c7019af56 100644 --- a/src/fields/Matrix.php +++ b/src/fields/Matrix.php @@ -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(), ]; } From dbf0da3f7cfcae87d6a82903392750bba9a4c7da Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 23 Aug 2023 11:34:15 -0700 Subject: [PATCH 08/13] Don't let notifications block previously-registered keyboard shortcuts Resolves #13591 --- CHANGELOG.md | 2 ++ src/web/assets/cp/dist/cp.js | 2 +- src/web/assets/cp/dist/cp.js.map | 2 +- src/web/assets/cp/src/js/CP.js | 4 ++- src/web/assets/garnish/dist/garnish.js | 2 +- src/web/assets/garnish/dist/garnish.js.map | 2 +- src/web/assets/garnish/src/UiLayerManager.js | 34 +++++++++++++++----- 7 files changed, 35 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a5b35a8fd4..63bedf5b84c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- 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)) diff --git a/src/web/assets/cp/dist/cp.js b/src/web/assets/cp/dist/cp.js index f3d21226cd5..eade7e3141c 100644 --- a/src/web/assets/cp/dist/cp.js +++ b/src/web/assets/cp/dist/cp.js @@ -1,2 +1,2 @@ -(function(){var __webpack_modules__={463:function(){Craft.Accordion=Garnish.Base.extend({$trigger:null,targetSelector:null,_$target:null,init:function(t){var e=this;this.$trigger=$(t),this.$trigger.data("accordion")&&(console.warn("Double-instantiating an accordion trigger on an element"),this.$trigger.data("accordion").destroy()),this.$trigger.data("accordion",this),this.targetSelector=this.$trigger.attr("aria-controls")?"#".concat(this.$trigger.attr("aria-controls")):null,this.targetSelector&&(this._$target=$(this.targetSelector)),this.addListener(this.$trigger,"click","onTriggerClick"),this.addListener(this.$trigger,"keypress",(function(t){var i=t.keyCode;i!==Garnish.SPACE_KEY&&i!==Garnish.RETURN_KEY||(t.preventDefault(),e.onTriggerClick())}))},onTriggerClick:function(){"true"===this.$trigger.attr("aria-expanded")?this.hideTarget(this._$target):this.showTarget(this._$target)},showTarget:function(t){var e=this;if(t&&t.length){this.showTarget._currentHeight=t.height(),t.removeClass("hidden"),this.$trigger.removeClass("collapsed").addClass("expanded").attr("aria-expanded","true");for(var i=0;i .address-card");for(var s=0;s=this.settings.maxItems)){var e=$(t).appendTo(this.$tbody),i=e.find(".delete");this.settings.sortable&&this.sorter.addItems(e),this.$deleteBtns=this.$deleteBtns.add(i),this.addListener(i,"click","handleDeleteBtnClick"),this.totalItems++,this.updateUI()}},reorderItems:function(){var t=this;if(this.settings.sortable){for(var e=[],i=0;i=this.settings.maxItems?$(this.settings.newItemBtnSelector).addClass("hidden"):$(this.settings.newItemBtnSelector).removeClass("hidden"))}},{defaults:{tableSelector:null,noItemsSelector:null,newItemBtnSelector:null,idAttribute:"data-id",nameAttribute:"data-name",sortable:!1,allowDeleteAll:!0,minItems:0,maxItems:null,reorderAction:null,deleteAction:null,reorderSuccessMessage:Craft.t("app","New order saved."),reorderFailMessage:Craft.t("app","Couldn’t save new order."),confirmDeleteMessage:Craft.t("app","Are you sure you want to delete “{name}”?"),deleteSuccessMessage:Craft.t("app","“{name}” deleted."),deleteFailMessage:Craft.t("app","Couldn’t delete “{name}”."),onReorderItems:$.noop,onDeleteItem:$.noop}})},6872:function(){Craft.AssetImageEditor=Garnish.Modal.extend({$body:null,$footer:null,$imageTools:null,$buttons:null,$cancelBtn:null,$replaceBtn:null,$saveBtn:null,$focalPointBtn:null,$editorContainer:null,$straighten:null,$croppingCanvas:null,$spinner:null,$constraintContainer:null,$constraintRadioInputs:null,$customConstraints:null,canvas:null,image:null,viewport:null,focalPoint:null,grid:null,croppingCanvas:null,clipper:null,croppingRectangle:null,cropperHandles:null,cropperGrid:null,croppingShade:null,imageStraightenAngle:0,viewportRotation:0,originalWidth:0,originalHeight:0,imageVerticeCoords:null,zoomRatio:1,animationInProgress:!1,currentView:"",assetId:null,cacheBust:null,draggingCropper:!1,scalingCropper:!1,draggingFocal:!1,previousMouseX:0,previousMouseY:0,shiftKeyHeld:!1,editorHeight:0,editorWidth:0,cropperState:!1,scaleFactor:1,flipData:{},focalPointState:!1,maxImageSize:null,lastLoadedDimensions:null,imageIsLoading:!1,mouseMoveEvent:null,croppingConstraint:!1,constraintOrientation:"landscape",showingCustomConstraint:!1,saving:!1,renderImage:null,renderCropper:null,_queue:null,init:function(t,e){var i=this;this._queue=new Craft.Queue,this.cacheBust=Date.now(),this.setSettings(e,Craft.AssetImageEditor.defaults),null===this.settings.allowDegreeFractions&&(this.settings.allowDegreeFractions=Craft.isImagick),Garnish.prefersReducedMotion()&&(this.settings.animationDuration=1),this.assetId=t,this.flipData={x:0,y:0},this.$container=$('').appendTo(Garnish.$bod),this.$body=$('
').appendTo(this.$container),this.$footer=$('