Skip to content

Commit

Permalink
Merge branch '5.x' into feature/cms-1348-resaveall-to-check-if-provid…
Browse files Browse the repository at this point in the history
…ed-options-are-supported
  • Loading branch information
brandonkelly committed Nov 19, 2024
2 parents 499eed1 + 5f72aba commit 30b4ce2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for Craft CMS 5

## Unreleased

- Fixed an error that could occur if an invalid folder ID was passed to `craft\services\Assets::deleteFoldersByIds()`. ([#16147](https://github.com/craftcms/cms/pull/16147))
- Fixed a SQL error that occurred when creating a new Single section. ([#16145](https://github.com/craftcms/cms/issues/16145))
- Fixed an RCE vulnerability.

## 5.5.1.1 - 2024-11-18

- Fixed a PHP error. ([#16142](https://github.com/craftcms/cms/issues/16142))
Expand Down
17 changes: 10 additions & 7 deletions bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@
// Determine the paths
// -----------------------------------------------------------------------------

$findConfig = function(string $cliName, string $envName) {
return App::cliOption($cliName, true) ?? App::env($envName);
$findConfig = function(string $cliName, string $envName) use ($appType) {
if ($appType === 'console') {
$value = App::cliOption($cliName, true);
if ($value !== null) {
return $value;
}
}

return App::env($envName);
};

// Set the vendor path. By default assume that it's 4 levels up from here
Expand All @@ -49,11 +56,7 @@
// Set the environment
// -----------------------------------------------------------------------------

$environment = App::cliOption('--env', true)
?? App::env('CRAFT_ENVIRONMENT')
?? App::env('ENVIRONMENT')
?? $_SERVER['SERVER_NAME']
?? null;
$environment = $findConfig('--env', 'CRAFT_ENVIRONMENT') ?? App::env('ENVIRONMENT') ?? $_SERVER['SERVER_NAME'] ?? null;

// Load the general config
// -----------------------------------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion src/services/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,13 @@ public function deleteFoldersByIds(int|array $folderIds, bool $deleteDir = true)

foreach ((array)$folderIds as $folderId) {
$folder = $this->getFolderById((int)$folderId);
if (!$folder) {
continue;
}

$folders[] = $folder;

if ($folder && $deleteDir) {
if ($folder->path && $deleteDir) {
$volume = $folder->getVolume();
try {
$volume->deleteDirectory($folder->path);
Expand Down
3 changes: 1 addition & 2 deletions src/services/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
use craft\models\Structure;
use craft\queue\jobs\ApplyNewPropagationMethod;
use craft\queue\jobs\ResaveElements;
use craft\records\Entry as EntryRecord;
use craft\records\EntryType as EntryTypeRecord;
use craft\records\Section as SectionRecord;
use craft\records\Section_SiteSettings as Section_SiteSettingsRecord;
Expand Down Expand Up @@ -979,7 +978,7 @@ private function _ensureSingleEntry(Section $section, ?array $siteSettings = nul
if ($entry === null) {
$entry = $baseEntryQuery
->trashed(null)
->where([EntryRecord::tableName() . '.[[deletedWithEntryType]]' => 1])
->where(['entries.deletedWithEntryType' => true])
->one();

if ($entry !== null) {
Expand Down

0 comments on commit 30b4ce2

Please sign in to comment.