From 7d460a5797b46cd5f6b8da9a1f7f2be4ed43cc97 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 14 Jan 2025 08:42:03 -0800 Subject: [PATCH 1/2] Use Db::each() --- 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 c51b7490960..56c919bd1f2 100644 --- a/src/services/Assets.php +++ b/src/services/Assets.php @@ -334,7 +334,7 @@ public function deleteFoldersByIds(int|array $folderIds, bool $deleteDir = true) $assetQuery = Asset::find()->folderId($allFolderIds); $elementService = Craft::$app->getElements(); - foreach ($assetQuery->each() as $asset) { + foreach (Db::each($assetQuery) as $asset) { /** @var Asset $asset */ $asset->keepFileOnDelete = !$deleteDir; $elementService->deleteElement($asset, true); From 0b32fe398cbbc6d98029589950ccec4c4d282ea8 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 14 Jan 2025 08:59:05 -0800 Subject: [PATCH 2/2] Improve securityKey docs [ci skip] --- src/config/GeneralConfig.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/config/GeneralConfig.php b/src/config/GeneralConfig.php index aa3ba660514..5635867e214 100644 --- a/src/config/GeneralConfig.php +++ b/src/config/GeneralConfig.php @@ -2642,12 +2642,23 @@ class GeneralConfig extends BaseConfig /** * @var string A private, random, cryptographically-secure key that is used for hashing and encrypting data in [[\craft\services\Security]]. * - * This value should be the same across all environments. If this key ever changes, any data that was encrypted with it will be inaccessible. + * ::: warning + * **Do not** share this key publicly. If exposed, it could lead to a compromised system. + * ::: + * + * In the event that the key is compromised, a new secure key can be generated with the command: + * + * ```sh + * php craft setup/security-key + * ``` + * + * Note that if the key changes, any data that is encrypted with it (e.g. user session cookies) will be inaccessible. * * ```php Static Config * ->securityKey('2cf24dba5...') * ``` * + * @see https://craftcms.com/knowledge-base/securing-craft * @group Security */ public string $securityKey = ''; @@ -6164,7 +6175,17 @@ public function sanitizeSvgUploads(bool $value = true): self /** * A private, random, cryptographically-secure key that is used for hashing and encrypting data in [[\craft\services\Security]]. * - * This value should be the same across all environments. If this key ever changes, any data that was encrypted with it will be inaccessible. + * ::: warning + * **Do not** share this key publicly. If exposed, it could lead to a compromised system. + * ::: + * + * In the event that the key is compromised, a new secure key can be generated with the command: + * + * ```sh + * php craft setup/security-key + * ``` + * + * Note that if the key changes, any data that is encrypted with it (e.g. user session cookies) will be inaccessible. * * ```php * ->securityKey('2cf24dba5...') @@ -6174,6 +6195,7 @@ public function sanitizeSvgUploads(bool $value = true): self * @param string $value * @return self * @see $securityKey + * @see https://craftcms.com/knowledge-base/securing-craft * @since 4.2.0 */ public function securityKey(string $value): self