Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to create paths dirs before checking realpath #10562

Merged
merged 4 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
- Log entries are now single-line by default when Dev Mode is disabled. ([#10659](https://github.com/craftcms/cms/pull/10659))
- Log files are now rotated once every 24 hours. ([#10659](https://github.com/craftcms/cms/pull/10659))
- `CRAFT_STREAM_LOG` no longer logs _in addition to_ other log targets. ([#10659](https://github.com/craftcms/cms/pull/10659))
- Craft’s bootstrap script now attempts to create its configured system paths automatically. ([#10562](https://github.com/craftcms/cms/pull/10562))
- When using GraphQL to mutate entries, the `enabled` status is now affected on a per-site basis when specifying both the `enabled` and `siteId` parameters. ([#9771](https://github.com/craftcms/cms/issues/9771))
- The `forms/selectize` control panel template now supports `addOptionFn` and `addOptionLabel` params, which can be set to add new options to the list.
- Editable tables now support `allowAdd`, `allowDelete`, and `allowReorder` settings, replacing `staticRows`. ([#10163](https://github.com/craftcms/cms/pull/10163))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Changed
- Sites’ Language settings now use Selectize inputs. ([#10810](https://github.com/craftcms/cms/discussions/10810))
- Image thumbnails now use registered image transformers when available.
- Craft’s bootstrap script now attempts to create its configured system paths automatically. ([#10562](https://github.com/craftcms/cms/pull/10562))
- `craft\elements\Asset::getUrl()` now has an `$immediately` argument.
- `craft\gql\base\ElementResolver::prepareQuery()` now expects its third argument to have a `string|null` type declaration.
- `craft\test\TestSetup::getMockApp()` has been renamed to `getMockModule()`, and its `$appClass` argument has been renamed to `$moduleClass`.
Expand Down
14 changes: 9 additions & 5 deletions bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
return App::cliOption($cliName, true) ?? App::env($envName);
};

$findConfigPath = function($cliName, $envName) use ($findConfig) {
$path = $findConfig($cliName, $envName);
return $path ? realpath($path) : null;
};

$createFolder = function($path) {
// Code borrowed from Io...
if (!is_dir($path)) {
Expand All @@ -50,6 +45,15 @@
}
};

$findConfigPath = function($cliName, $envName) use ($findConfig, $createFolder) {
$path = $findConfig($cliName, $envName);
if (!$path) {
return null;
}
$createFolder($path);
return realpath($path);
};

$ensureFolderIsReadable = function($path, $writableToo = false) {
$realPath = realpath($path);

Expand Down