Skip to content

Commit 2f5a0cc

Browse files
committed
Merge remote-tracking branch 'origin/5.x' into 5.next
2 parents fa70a7d + 85b6344 commit 2f5a0cc

6 files changed

Lines changed: 101 additions & 97 deletions

File tree

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
],
5353
"cs-check": "phpcs --colors -p",
5454
"cs-fix": "phpcbf --colors -p",
55-
"stan": "phpstan analyze",
5655
"test": "phpunit --colors=always"
5756
}
5857
}

config/app.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,33 @@
412412
'Session' => [
413413
'defaults' => 'php',
414414
],
415+
416+
/**
417+
* DebugKit configuration.
418+
*
419+
* Contains an array of configurations to apply to the DebugKit plugin, if loaded.
420+
* Documentation: https://book.cakephp.org/debugkit/5/en/index.html#configuration
421+
*
422+
* ## Options
423+
*
424+
* - `panels` - Enable or disable panels. The key is the panel name, and the value is true to enable,
425+
* or false to disable.
426+
* - `includeSchemaReflection` - Set to true to enable logging of schema reflection queries. Disabled by default.
427+
* - `safeTld` - Set an array of whitelisted TLDs for local development.
428+
* - `forceEnable` - Force DebugKit to display. Careful with this, it is usually safer to simply whitelist
429+
* your local TLDs.
430+
* - `ignorePathsPattern` - Regex pattern (including delimiter) to ignore paths.
431+
* DebugKit won’t save data for request URLs that match this regex.
432+
* - `ignoreAuthorization` - Set to true to ignore Cake Authorization plugin for DebugKit requests.
433+
* Disabled by default.
434+
* - `maxDepth` - Defines how many levels of nested data should be shown in general for debug output.
435+
* Default is 5. WARNING: Increasing the max depth level can lead to an out of memory error.
436+
* - `variablesPanelMaxDepth` - Defines how many levels of nested data should be shown in the variables tab.
437+
* Default is 5. WARNING: Increasing the max depth level can lead to an out of memory error.
438+
*/
415439
'DebugKit' => [
416440
'forceEnable' => filter_var(env('DEBUG_KIT_FORCE_ENABLE', false), FILTER_VALIDATE_BOOLEAN),
417441
'safeTld' => env('DEBUG_KIT_SAFE_TLD', null),
418-
'ignoreAuthorization' => env('DEBUG_KIT_IGNORE_AUTHORIZATION', false)
442+
'ignoreAuthorization' => env('DEBUG_KIT_IGNORE_AUTHORIZATION', false),
419443
],
420444
];

config/bootstrap.php

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@
1515
* @license https://opensource.org/licenses/mit-license.php MIT License
1616
*/
1717

18+
/*
19+
* This file is loaded by your src/Application.php bootstrap method.
20+
* Feel free to extend/extract parts of the bootstrap process into your own files
21+
* to suit your needs/preferences.
22+
*/
23+
1824
/*
1925
* Configure paths required to find CakePHP + general filepath constants
2026
*/
2127
require __DIR__ . DIRECTORY_SEPARATOR . 'paths.php';
2228

2329
/*
24-
* Bootstrap CakePHP.
25-
*
26-
* Does the various bits of setup that CakePHP needs to do.
27-
* This includes:
28-
*
29-
* - Registering the CakePHP autoloader.
30-
* - Setting the default application paths.
30+
* Bootstrap CakePHP
31+
* Currently all this does is initialize the router (without loading your routes)
3132
*/
3233
require CORE_PATH . 'config' . DS . 'bootstrap.php';
3334

@@ -44,8 +45,8 @@
4445
use Cake\Routing\Router;
4546
use Cake\Utility\Security;
4647

47-
/**
48-
* Load global functions.
48+
/*
49+
* Load global functions for collections, translations, debugging etc.
4950
*/
5051
require CAKE . 'functions.php';
5152

@@ -72,12 +73,11 @@
7273
// }
7374

7475
/*
75-
* Read configuration file and inject configuration into various
76-
* CakePHP classes.
76+
* Initializes default Config store and loads the main configuration file (app.php)
7777
*
78-
* By default there is only one configuration file. It is often a good
79-
* idea to create multiple configuration files, and separate the configuration
80-
* that changes from configuration that does not. This makes deployment simpler.
78+
* CakePHP contains 2 configuration files after project creation:
79+
* - `config/app.php` for the default application configuration.
80+
* - `config/app_local.php` for environment specific configuration.
8181
*/
8282
try {
8383
Configure::config('default', new PhpConfig());
@@ -95,8 +95,7 @@
9595
}
9696

9797
/*
98-
* When debug = true the metadata cache should only last
99-
* for a short time.
98+
* When debug = true the metadata cache should only last for a short time.
10099
*/
101100
if (Configure::read('debug')) {
102101
Configure::write('Cache._cake_model_.duration', '+2 minutes');
@@ -127,15 +126,26 @@
127126
(new ExceptionTrap(Configure::read('Error')))->register();
128127

129128
/*
130-
* Include the CLI bootstrap overrides.
129+
* CLI/Command specific configuration.
131130
*/
132131
if (PHP_SAPI === 'cli') {
133-
require CONFIG . 'bootstrap_cli.php';
132+
// Set the fullBaseUrl to allow URLs to be generated in commands.
133+
// This is useful when sending email from commands.
134+
// Configure::write('App.fullBaseUrl', php_uname('n'));
135+
136+
// Set logs to different files so they don't have permission conflicts.
137+
if (Configure::check('Log.debug')) {
138+
Configure::write('Log.debug.file', 'cli-debug');
139+
}
140+
if (Configure::check('Log.error')) {
141+
Configure::write('Log.error.file', 'cli-error');
142+
}
134143
}
135144

136145
/*
137146
* Set the full base URL.
138147
* This URL is used as the base of all absolute links.
148+
* Can be very useful for CLI/Commandline applications.
139149
*/
140150
$fullBaseUrl = Configure::read('App.fullBaseUrl');
141151
if (!$fullBaseUrl) {
@@ -165,6 +175,10 @@
165175
}
166176
unset($fullBaseUrl);
167177

178+
/*
179+
* Apply the loaded configuration settings to their respective systems.
180+
* This will also remove the loaded config data from memory.
181+
*/
168182
Cache::setConfig(Configure::consume('Cache'));
169183
ConnectionManager::setConfig(Configure::consume('Datasources'));
170184
TransportFactory::setConfig(Configure::consume('EmailTransport'));
@@ -191,37 +205,29 @@
191205
/*
192206
* You can enable default locale format parsing by adding calls
193207
* to `useLocaleParser()`. This enables the automatic conversion of
194-
* locale specific date formats. For details see
208+
* locale specific date formats when processing request data. For details see
195209
* @link https://book.cakephp.org/5/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
196210
*/
197-
// \Cake\Database\TypeFactory::build('time')
198-
// ->useLocaleParser();
199-
// \Cake\Database\TypeFactory::build('date')
200-
// ->useLocaleParser();
201-
// \Cake\Database\TypeFactory::build('datetime')
202-
// ->useLocaleParser();
203-
// \Cake\Database\TypeFactory::build('timestamp')
204-
// ->useLocaleParser();
205-
// \Cake\Database\TypeFactory::build('datetimefractional')
206-
// ->useLocaleParser();
207-
// \Cake\Database\TypeFactory::build('timestampfractional')
208-
// ->useLocaleParser();
209-
// \Cake\Database\TypeFactory::build('datetimetimezone')
210-
// ->useLocaleParser();
211-
// \Cake\Database\TypeFactory::build('timestamptimezone')
212-
// ->useLocaleParser();
211+
// \Cake\Database\TypeFactory::build('time')->useLocaleParser();
212+
// \Cake\Database\TypeFactory::build('date')->useLocaleParser();
213+
// \Cake\Database\TypeFactory::build('datetime')->useLocaleParser();
214+
// \Cake\Database\TypeFactory::build('timestamp')->useLocaleParser();
215+
// \Cake\Database\TypeFactory::build('datetimefractional')->useLocaleParser();
216+
// \Cake\Database\TypeFactory::build('timestampfractional')->useLocaleParser();
217+
// \Cake\Database\TypeFactory::build('datetimetimezone')->useLocaleParser();
218+
// \Cake\Database\TypeFactory::build('timestamptimezone')->useLocaleParser();
213219

214220
/*
215221
* Custom Inflector rules, can be set to correctly pluralize or singularize
216222
* table, model, controller names or whatever other string is passed to the
217223
* inflection functions.
218224
*/
219-
//Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
220-
//Inflector::rules('irregular', ['red' => 'redlings']);
221-
//Inflector::rules('uninflected', ['dontinflectme']);
225+
// \Cake\Utility\Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
226+
// \Cake\Utility\Inflector::rules('irregular', ['red' => 'redlings']);
227+
// \Cake\Utility\Inflector::rules('uninflected', ['dontinflectme']);
222228

223229
// set a custom date and time format
224230
// see https://book.cakephp.org/5/en/core-libraries/time.html#setting-the-default-locale-and-format-string
225231
// and https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax
226-
//\Cake\I18n\Date::setToStringFormat('dd.MM.yyyy');
227-
//\Cake\I18n\Time::setToStringFormat('dd.MM.yyyy HH:mm');
232+
// \Cake\I18n\Date::setToStringFormat('dd.MM.yyyy');
233+
// \Cake\I18n\Time::setToStringFormat('dd.MM.yyyy HH:mm');

config/bootstrap_cli.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/Console/Installer.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ public static function setFolderPermissions(string $dir, IOInterface $io): void
155155
};
156156

157157
$walker = function (string $dir) use (&$walker, $changePerms): void {
158-
/** @phpstan-ignore-next-line */
159-
$files = array_diff(scandir($dir), ['.', '..']);
158+
$files = array_diff(scandir($dir) ?: [], ['.', '..']);
160159
foreach ($files as $file) {
161160
$path = $dir . '/' . $file;
162161

@@ -200,8 +199,12 @@ public static function setSecuritySaltInFile(string $dir, IOInterface $io, strin
200199
{
201200
$config = $dir . '/config/' . $file;
202201
$content = file_get_contents($config);
202+
if ($content === false) {
203+
$io->write('Config file not readable or not found: config/' . $file);
204+
205+
return;
206+
}
203207

204-
/** @phpstan-ignore-next-line */
205208
$content = str_replace('__SALT__', $newKey, $content, $count);
206209

207210
if ($count == 0) {
@@ -232,7 +235,12 @@ public static function setAppNameInFile(string $dir, IOInterface $io, string $ap
232235
{
233236
$config = $dir . '/config/' . $file;
234237
$content = file_get_contents($config);
235-
/** @phpstan-ignore-next-line */
238+
if ($content === false) {
239+
$io->write('Config file not readable or not found: config/' . $file);
240+
241+
return;
242+
}
243+
236244
$content = str_replace('__APP_NAME__', $appName, $content, $count);
237245

238246
if ($count == 0) {

webroot/css/cake.css

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,32 +179,34 @@ th {
179179
}
180180

181181
/* Forms */
182-
.input.radio,
183-
.input.checkbox,
184-
.input.multicheckbox {
185-
margin-bottom: 2.0rem;
186-
}
187-
.input.radio input,
188-
.input.checkbox input,
189-
.input.multicheckbox input {
190-
margin: 0;
182+
.input {
183+
margin-bottom: 1.5rem;
191184
}
192-
.input.radio label,
193-
.input.checkbox label,
194-
.input.multicheckbox label {
195-
margin: 0;
185+
.input input,
186+
.input select,
187+
.input textarea {
188+
margin-bottom: 0;
189+
}
190+
.input label:has(input[type='checkbox']),
191+
.input label:has(input[type='radio']) {
196192
display: flex;
197193
align-items: center;
198194
}
199-
.input.radio label > input,
200-
.input.checkbox label > input,
201-
.input.multicheckbox label > input {
195+
.input label:has(~ label),
196+
.input label:has(input[type='radio']) {
197+
margin-bottom: 0;
198+
}
199+
.input label > input[type='checkbox'],
200+
.input label > input[type='radio'] {
202201
margin-right: 1.0rem;
203202
}
204203
input[type='color'] {
205204
max-width: 4rem;
206205
padding: 0.3rem .5rem 0.3rem;
207206
}
207+
.error-message {
208+
color: var(--color-message-error-text);
209+
}
208210

209211
/* Paginator */
210212
.paginator {

0 commit comments

Comments
 (0)