From 43dbd317308f29eae72172ca1877177a70b540d1 Mon Sep 17 00:00:00 2001 From: Leevi Graham Date: Wed, 24 Aug 2022 11:54:13 +1000 Subject: [PATCH 01/13] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd3ec86e0f6..2a52d6e8d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ - Fixed PHP warnings that would occur when passing `0` into `craft\helpers\DateTimeHelper::humanDuration()`. ([#11787](https://github.com/craftcms/cms/issues/11787)) - Fixed a bug where selected assets weren’t getting automatically replaced when an image was edited and “Save as a new asset” was chosen. ([#11805](https://github.com/craftcms/cms/issues/11805)) - Fixed a JavaScript error that occurred when editing a user via a slideout, if the user had any addresses. ([#11810](https://github.com/craftcms/cms/issues/11810)) -- Fixed a beg where some invalid slideout submissions weren’t being handled properly. ([#11812](https://github.com/craftcms/cms/issues/11812)) +- Fixed a bug where some invalid slideout submissions weren’t being handled properly. ([#11812](https://github.com/craftcms/cms/issues/11812)) - Fixed a bug where `craft\helpers\DateTimeHelper::toDateInterval()` was returning negative interval durations when integers were passed in. ([#11814](https://github.com/craftcms/cms/pull/11814)) - Fixed a bug where `iframeResizer.contentWindow.js` was getting loaded for all preview requests, not just Live Preview, and even when `useIframeResizer` was disabled. ([#11778](https://github.com/craftcms/cms/issues/11778)) - Fixed a bug where deleted relations and Matrix blocks could persist if the edit form was submitted before they had been fully animated away. ([#11789](https://github.com/craftcms/cms/issues/11789)) From 86fbf90081c652f3e05aa244eaa426b34a67f770 Mon Sep 17 00:00:00 2001 From: Leevi Graham Date: Wed, 24 Aug 2022 22:06:14 +1000 Subject: [PATCH 02/13] Add `data-asset-id` to PreviewFileModal This allows plugins which provide their own `AssetPreviewHandlerInterface` to apply styles based on Asset id. --- src/web/assets/cp/src/js/PreviewFileModal.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/web/assets/cp/src/js/PreviewFileModal.js b/src/web/assets/cp/src/js/PreviewFileModal.js index d04db8a33ab..5b514ec1aec 100644 --- a/src/web/assets/cp/src/js/PreviewFileModal.js +++ b/src/web/assets/cp/src/js/PreviewFileModal.js @@ -209,7 +209,9 @@ Craft.PreviewFileModal = Garnish.Modal.extend( } this.$container.removeClass('zilch'); + this.$container.attr('data-asset-id', this.assetId); this.$container.append(response.data.previewHtml); + this._addBumperButtons(); Craft.appendHeadHtml(response.data.headHtml); Craft.appendBodyHtml(response.data.bodyHtml); From 0f67c11a510bbd69ca8c36ee170b727b431969a7 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 24 Aug 2022 07:23:27 -0700 Subject: [PATCH 03/13] Fixed #11818 --- CHANGELOG.md | 5 +++++ src/controllers/AssetsController.php | 9 +++++++-- src/elements/Asset.php | 11 +++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 074570d117e..01dc4cffe26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Craft CMS 3.x +## Unreleased + +### Fixed +- Fixed a bug where the “Edit files uploaded by other users” volume permission was useless unless the “Upload files” permission had been granted. ([#11818](https://github.com/craftcms/cms/issues/11818)) + ## 3.7.52 - 2022-08-23 ### Changed diff --git a/src/controllers/AssetsController.php b/src/controllers/AssetsController.php index 5b4e41ff5af..9ce9787e70a 100644 --- a/src/controllers/AssetsController.php +++ b/src/controllers/AssetsController.php @@ -210,8 +210,13 @@ public function actionSaveAsset() throw new BadRequestHttpException("Invalid asset ID: {$assetId}"); } - $this->requireVolumePermissionByAsset('saveAssetInVolume', $asset); - $this->requirePeerVolumePermissionByAsset('editPeerFilesInVolume', $asset); + $isUploader = $asset->uploaderId && $asset->uploaderId == Craft::$app->getUser()->getId(); + + if ($isUploader) { + $this->requireVolumePermissionByAsset('saveAssetInVolume', $asset); + } else { + $this->requirePeerVolumePermissionByAsset('editPeerFilesInVolume', $asset); + } if (Craft::$app->getIsMultiSite()) { // Make sure they have access to this site diff --git a/src/elements/Asset.php b/src/elements/Asset.php index ef1e33a48ad..10d68a7c565 100644 --- a/src/elements/Asset.php +++ b/src/elements/Asset.php @@ -876,10 +876,13 @@ protected function isEditable(): bool { $volume = $this->getVolume(); $userSession = Craft::$app->getUser(); - return ( - $userSession->checkPermission("saveAssetInVolume:$volume->uid") && - ($userSession->getId() == $this->uploaderId || $userSession->checkPermission("editPeerFilesInVolume:$volume->uid")) - ); + $isUploader = $this->uploaderId && $this->uploaderId == $userSession->getId(); + + if ($isUploader) { + return $userSession->checkPermission("saveAssetInVolume:$volume->uid"); + } + + return $userSession->checkPermission("editPeerFilesInVolume:$volume->uid"); } /** From e1b8038b89787384125ee004cacc26f94beeb31b Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 24 Aug 2022 07:36:12 -0700 Subject: [PATCH 04/13] Fixed #11819 --- CHANGELOG.md | 1 + src/templates/_layouts/element.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01dc4cffe26..671a7d29104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed - Fixed a bug where the “Edit files uploaded by other users” volume permission was useless unless the “Upload files” permission had been granted. ([#11818](https://github.com/craftcms/cms/issues/11818)) +- Fixed a bug where the “Save and add another” entry action was being shown for users without the “Create entries” section permission. ([#11819](https://github.com/craftcms/cms/issues/11819)) ## 3.7.52 - 2022-08-23 diff --git a/src/templates/_layouts/element.html b/src/templates/_layouts/element.html index f8a41b9d712..4ecab209edb 100644 --- a/src/templates/_layouts/element.html +++ b/src/templates/_layouts/element.html @@ -144,7 +144,7 @@ autosave: false, }, }) %} - {% if addAnotherRedirectUrl %} + {% if canAddAnother and addAnotherRedirectUrl %} {% set formActions = formActions|push({ label: isUnpublishedDraft ? 'Create and add another'|t('app') : 'Save and add another'|t('app'), action: isUnpublishedDraft ? publishDraftAction : null, From b497e5ab6cab2e808830650920e6e91bb02161ac Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 25 Aug 2022 06:43:49 -0700 Subject: [PATCH 05/13] Backported #10836 to Craft 3 --- CHANGELOG.md | 6 ++++++ src/services/Gc.php | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 671a7d29104..9452e2709e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +### Added +- Added `craft\services\Gc::removeEmptyTempFolders()`. + +### Changed +- Empty subfolders within the temporary upload volume are now removed during garbage collection. ([#10746](https://github.com/craftcms/cms/issues/10746)) + ### Fixed - Fixed a bug where the “Edit files uploaded by other users” volume permission was useless unless the “Upload files” permission had been granted. ([#11818](https://github.com/craftcms/cms/issues/11818)) - Fixed a bug where the “Save and add another” entry action was being shown for users without the “Create entries” section permission. ([#11819](https://github.com/craftcms/cms/issues/11819)) diff --git a/src/services/Gc.php b/src/services/Gc.php index 16e80948a3f..60a0c27e8ef 100644 --- a/src/services/Gc.php +++ b/src/services/Gc.php @@ -24,6 +24,7 @@ use craft\helpers\Db; use craft\records\Volume; use craft\records\VolumeFolder; +use craft\volumes\Temp; use DateTime; use ReflectionMethod; use yii\base\Component; @@ -115,7 +116,7 @@ public function run(bool $force = false) ]); $this->hardDeleteVolumes(); - + $this->removeEmptyTempFolders(); $this->_gcCache(); } @@ -238,6 +239,38 @@ private function _purgePendingUsers(GeneralConfig $generalConfig) Console::stdout("done\n", Console::FG_GREEN); } + /** + * Removes any temp upload folders with no assets in them. + * + * @since 3.7.53 + */ + public function removeEmptyTempFolders(): void + { + Console::stdout(' > removing empty temp folders ... '); + + $emptyFolders = (new Query()) + ->from(['folders' => Table::VOLUMEFOLDERS]) + ->select(['folders.id', 'folders.path']) + ->leftJoin(['assets' => Table::ASSETS], '[[assets.folderId]] = [[folders.id]]') + ->where([ + 'folders.volumeId' => null, + 'assets.id' => null, + ]) + ->andWhere(['not', ['folders.parentId' => null]]) + ->pairs(); + + $volume = Craft::createObject(Temp::class); + + foreach ($emptyFolders as $emptyFolderPath) { + if ($volume->directoryExists($emptyFolderPath)) { + $volume->deleteDirectory($emptyFolderPath); + } + } + + VolumeFolder::deleteAll(['id' => array_keys($emptyFolders)]); + Console::stdout("done\n", Console::FG_GREEN); + } + /** * Deletes any session rows that have gone stale. */ From 2d3417ed3867f98dba7a3ed76d510c23a1379433 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 25 Aug 2022 07:11:35 -0700 Subject: [PATCH 06/13] Fixed #11830 --- CHANGELOG.md | 1 + src/services/Plugins.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9452e2709e2..0df8b18f223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2017,6 +2017,7 @@ ### Fixed - Fixed a bug where the `migrate/all` command wasn’t working when executed from a Composer script in a non-interactive shell, unless `--interactive=0` was explicitly passed. ([#7381](https://github.com/craftcms/cms/issues/7381)) - Fixed an error that occurred when saving a Categories field with a branch limit. ([#7449](https://github.com/craftcms/cms/pull/7449)) +- Fixed a bug where Craft was overwriting plugin license keys set to an environment variable, if the environment variable didn’t have a value. ([#11830](https://github.com/craftcms/cms/issues/11830)) ## 3.6.0.1 - 2021-01-26 diff --git a/src/services/Plugins.php b/src/services/Plugins.php index d658393135f..8a0a6436d02 100644 --- a/src/services/Plugins.php +++ b/src/services/Plugins.php @@ -1151,7 +1151,8 @@ public function getPluginIconSvg(string $handle): string */ public function getPluginLicenseKey(string $handle) { - return $this->normalizePluginLicenseKey(App::parseEnv($this->getStoredPluginInfo($handle)['licenseKey'] ?? null)); + $licenseKey = $this->getStoredPluginInfo($handle)['licenseKey'] ?? null; + return $this->normalizePluginLicenseKey(App::parseEnv($licenseKey) ?: $licenseKey); } /** From 1c7b7cc6c1219e53b0560b6565378b0c33f929ba Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 26 Aug 2022 07:10:29 -0700 Subject: [PATCH 07/13] That was in the wrong spot --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0df8b18f223..68574351204 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Fixed - Fixed a bug where the “Edit files uploaded by other users” volume permission was useless unless the “Upload files” permission had been granted. ([#11818](https://github.com/craftcms/cms/issues/11818)) - Fixed a bug where the “Save and add another” entry action was being shown for users without the “Create entries” section permission. ([#11819](https://github.com/craftcms/cms/issues/11819)) +- Fixed a bug where Craft was overwriting plugin license keys set to an environment variable, if the environment variable didn’t have a value. ([#11830](https://github.com/craftcms/cms/issues/11830)) ## 3.7.52 - 2022-08-23 @@ -2017,7 +2018,6 @@ ### Fixed - Fixed a bug where the `migrate/all` command wasn’t working when executed from a Composer script in a non-interactive shell, unless `--interactive=0` was explicitly passed. ([#7381](https://github.com/craftcms/cms/issues/7381)) - Fixed an error that occurred when saving a Categories field with a branch limit. ([#7449](https://github.com/craftcms/cms/pull/7449)) -- Fixed a bug where Craft was overwriting plugin license keys set to an environment variable, if the environment variable didn’t have a value. ([#11830](https://github.com/craftcms/cms/issues/11830)) ## 3.6.0.1 - 2021-01-26 From 22165acfc884cd68c9a4b043533ec36a5457ce7c Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 26 Aug 2022 07:14:37 -0700 Subject: [PATCH 08/13] Still generate trial license keys, but store them in .env (#11830 take 2) --- CHANGELOG.md | 2 +- src/services/Plugins.php | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68574351204..bf42b955cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,12 @@ - Added `craft\services\Gc::removeEmptyTempFolders()`. ### Changed +- If a plugin’s license key is set to an empty environment variable, its trial license key will now be stored in `.env` rather than the project config. ([#11830](https://github.com/craftcms/cms/issues/11830)) - Empty subfolders within the temporary upload volume are now removed during garbage collection. ([#10746](https://github.com/craftcms/cms/issues/10746)) ### Fixed - Fixed a bug where the “Edit files uploaded by other users” volume permission was useless unless the “Upload files” permission had been granted. ([#11818](https://github.com/craftcms/cms/issues/11818)) - Fixed a bug where the “Save and add another” entry action was being shown for users without the “Create entries” section permission. ([#11819](https://github.com/craftcms/cms/issues/11819)) -- Fixed a bug where Craft was overwriting plugin license keys set to an environment variable, if the environment variable didn’t have a value. ([#11830](https://github.com/craftcms/cms/issues/11830)) ## 3.7.52 - 2022-08-23 diff --git a/src/services/Plugins.php b/src/services/Plugins.php index 8a0a6436d02..d35504ff5c5 100644 --- a/src/services/Plugins.php +++ b/src/services/Plugins.php @@ -1152,7 +1152,7 @@ public function getPluginIconSvg(string $handle): string public function getPluginLicenseKey(string $handle) { $licenseKey = $this->getStoredPluginInfo($handle)['licenseKey'] ?? null; - return $this->normalizePluginLicenseKey(App::parseEnv($licenseKey) ?: $licenseKey); + return $this->normalizePluginLicenseKey(App::parseEnv($licenseKey)); } /** @@ -1171,13 +1171,19 @@ public function setPluginLicenseKey(string $handle, string $licenseKey = null): // Validate the license key $normalizedLicenseKey = $this->normalizePluginLicenseKey($licenseKey); - // Set the plugin's license key in the project config - Craft::$app->getProjectConfig()->set(self::CONFIG_PLUGINS_KEY . '.' . $handle . '.licenseKey', $normalizedLicenseKey, "Set license key for plugin “{$handle}”"); + // If the license key is set to an empty environment variable, set the environment variable's value + $oldLicenseKey = $this->getStoredPluginInfo($handle)['licenseKey'] ?? null; + if (preg_match('/^\$(\w+)$/', $oldLicenseKey, $matches) && App::env($matches[1]) === '') { + Craft::$app->getConfig()->setDotEnvVar($matches[1], $normalizedLicenseKey); + } else { + // Set the plugin's license key in the project config + Craft::$app->getProjectConfig()->set(sprintf('%s.%s.licenseKey', self::CONFIG_PLUGINS_KEY, $handle), $normalizedLicenseKey, "Set license key for plugin “{$handle}”"); - // Update our cache of it - $this->loadPlugins(); - if (isset($this->_storedPluginInfo[$handle])) { - $this->_storedPluginInfo[$handle]['licenseKey'] = $normalizedLicenseKey; + // Update our cache of it + $this->loadPlugins(); + if (isset($this->_storedPluginInfo[$handle])) { + $this->_storedPluginInfo[$handle]['licenseKey'] = $normalizedLicenseKey; + } } // If we've cached the plugin's license key status, update the cache From 2ed73d892d44a3b7ee724b3b18074d78647ec206 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 26 Aug 2022 07:45:20 -0700 Subject: [PATCH 09/13] Fixed #11829 --- CHANGELOG.md | 1 + src/services/Gc.php | 50 ++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf42b955cf3..424c90d28dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### Fixed - Fixed a bug where the “Edit files uploaded by other users” volume permission was useless unless the “Upload files” permission had been granted. ([#11818](https://github.com/craftcms/cms/issues/11818)) - Fixed a bug where the “Save and add another” entry action was being shown for users without the “Create entries” section permission. ([#11819](https://github.com/craftcms/cms/issues/11819)) +- Fixed a PHP error that occurred when garbage collection was run on web requests. ([#11829](https://github.com/craftcms/cms/issues/11829)) ## 3.7.52 - 2022-08-23 diff --git a/src/services/Gc.php b/src/services/Gc.php index 60a0c27e8ef..7c44e60b8ec 100644 --- a/src/services/Gc.php +++ b/src/services/Gc.php @@ -10,6 +10,7 @@ use Craft; use craft\base\ElementInterface; use craft\config\GeneralConfig; +use craft\console\Application as ConsoleApplication; use craft\db\Query; use craft\db\Table; use craft\elements\Asset; @@ -130,7 +131,7 @@ public function hardDeleteVolumes() return; } - Console::stdout(" > deleting trashed volumes and their folders ... "); + $this->_stdout(" > deleting trashed volumes and their folders ... "); $condition = $this->getHardDeleteConditions($generalConfig); $volumes = (new Query())->select(['id'])->from([Table::VOLUMES])->where($condition)->all(); @@ -150,7 +151,7 @@ public function hardDeleteVolumes() } Volume::deleteAll(['id' => $volumeIds]); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } /** @@ -172,9 +173,9 @@ public function hardDelete($tables) } foreach ($tables as $table) { - Console::stdout(" > deleting trashed rows in the `$table` table ... "); + $this->_stdout(" > deleting trashed rows in the `$table` table ... "); Db::delete($table, $condition); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } } @@ -214,7 +215,7 @@ public function deletePartialElements(string $elementType, string $table, string } $db->createCommand($sql, ['type' => $elementType])->execute(); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } private function _purgeUnsavedDrafts(GeneralConfig $generalConfig) @@ -223,9 +224,9 @@ private function _purgeUnsavedDrafts(GeneralConfig $generalConfig) return; } - Console::stdout(' > purging unsaved drafts that have gone stale ... '); + $this->_stdout(' > purging unsaved drafts that have gone stale ... '); Craft::$app->getDrafts()->purgeUnsavedDrafts(); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } private function _purgePendingUsers(GeneralConfig $generalConfig) @@ -234,9 +235,9 @@ private function _purgePendingUsers(GeneralConfig $generalConfig) return; } - Console::stdout(' > purging pending users with stale activation codes ... '); + $this->_stdout(' > purging pending users with stale activation codes ... '); Craft::$app->getUsers()->purgeExpiredPendingUsers(); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } /** @@ -246,7 +247,7 @@ private function _purgePendingUsers(GeneralConfig $generalConfig) */ public function removeEmptyTempFolders(): void { - Console::stdout(' > removing empty temp folders ... '); + $this->_stdout(' > removing empty temp folders ... '); $emptyFolders = (new Query()) ->from(['folders' => Table::VOLUMEFOLDERS]) @@ -268,7 +269,7 @@ public function removeEmptyTempFolders(): void } VolumeFolder::deleteAll(['id' => array_keys($emptyFolders)]); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } /** @@ -280,12 +281,12 @@ private function _deleteStaleSessions(GeneralConfig $generalConfig) return; } - Console::stdout(' > deleting stale user sessions ... '); + $this->_stdout(' > deleting stale user sessions ... '); $interval = DateTimeHelper::secondsToInterval($generalConfig->purgeStaleUserSessionDuration); $expire = DateTimeHelper::currentUTCDateTime(); $pastTime = $expire->sub($interval); Db::delete(Table::SESSIONS, ['<', 'dateUpdated', Db::prepareDateForDb($pastTime)]); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } /** @@ -293,9 +294,9 @@ private function _deleteStaleSessions(GeneralConfig $generalConfig) */ private function _deleteStaleAnnouncements(): void { - Console::stdout(' > deleting stale feature announcements ... '); + $this->_stdout(' > deleting stale feature announcements ... '); Db::delete(Table::ANNOUNCEMENTS, ['<', 'dateRead', Db::prepareDateForDb(new DateTime('7 days ago'))]); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } @@ -304,7 +305,7 @@ private function _deleteStaleAnnouncements(): void */ private function _deleteOrphanedDraftsAndRevisions(): void { - Console::stdout(' > deleting orphaned drafts and revisions ... '); + $this->_stdout(' > deleting orphaned drafts and revisions ... '); $db = Craft::$app->getDb(); $elementsTable = Table::ELEMENTS; @@ -329,14 +330,14 @@ private function _deleteOrphanedDraftsAndRevisions(): void $db->createCommand($sql)->execute(); } - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } private function _deleteOrphanedSearchIndexes(): void { - Console::stdout(' > deleting orphaned search indexes ... '); + $this->_stdout(' > deleting orphaned search indexes ... '); Craft::$app->getSearch()->deleteOrphanedIndexes(); - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } private function _gcCache(): void @@ -364,7 +365,7 @@ private function _gcCache(): void return; } - Console::stdout(' > garbage-collecting data caches ... '); + $this->_stdout(' > garbage-collecting data caches ... '); if ($hasForceArg) { $cache->gc(true); @@ -372,7 +373,7 @@ private function _gcCache(): void $cache->gc(); } - Console::stdout("done\n", Console::FG_GREEN); + $this->_stdout("done\n", Console::FG_GREEN); } /** @@ -395,4 +396,11 @@ protected function getHardDeleteConditions(GeneralConfig $generalConfig): array } return $condition; } + + private function _stdout(string $string, ...$format): void + { + if (Craft::$app instanceof ConsoleApplication) { + Console::stdout($string, ...$format); + } + } } From e51903774cebd2b78ae20339655383a482730b8c Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Fri, 26 Aug 2022 07:53:13 -0700 Subject: [PATCH 10/13] Build --- src/web/assets/cp/dist/cp.js | 2 +- src/web/assets/cp/dist/cp.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/web/assets/cp/dist/cp.js b/src/web/assets/cp/dist/cp.js index b8ae88f32c2..2dab400cb42 100644 --- a/src/web/assets/cp/dist/cp.js +++ b/src/web/assets/cp/dist/cp.js @@ -1,3 +1,3 @@ /*! For license information please see cp.js.LICENSE.txt */ -(function(){var __webpack_modules__={3839:function(){Craft.AddressesInput=Garnish.Base.extend({$container:null,$addBtn:null,$addBtnItem:null,$cards:null,init:function(t,e){var i=this;this.$container=$(t),this.setSettings(e,Craft.AddressesInput.defaults),this.$container.data("addresses")&&(console.warn("Double-instantiating an address input on an element"),this.$container.data("addresses").destroy()),this.$container.data("addresses",this),this.$addBtn=this.$container.find(".address-cards__add-btn"),this.$addBtnItem=this.$addBtn.closest("li"),this.$cards=this.$container.find("> .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=$('