Update to Kirby 4.7.0
This commit is contained in:
parent
02a9ab387c
commit
ba25a9a198
509 changed files with 26604 additions and 14872 deletions
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Exception\LogicException;
|
||||
use Kirby\Panel\Field;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
|
@ -8,64 +9,85 @@ return [
|
|||
// license key
|
||||
'license' => [
|
||||
'load' => function () {
|
||||
$license = App::instance()->system()->license();
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
// the system is registered but the license
|
||||
// key is only visible for admins
|
||||
if ($license === true) {
|
||||
$license = 'Kirby 3';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
$kirby = App::instance();
|
||||
$license = $kirby->system()->license();
|
||||
$obfuscated = $kirby->user()->isAdmin() === false;
|
||||
$status = $license->status();
|
||||
$renewable = $status->renewable();
|
||||
|
||||
return [
|
||||
'component' => 'k-form-dialog',
|
||||
'component' => 'k-license-dialog',
|
||||
'props' => [
|
||||
'size' => 'medium',
|
||||
'fields' => [
|
||||
'license' => [
|
||||
'type' => 'info',
|
||||
'label' => I18n::translate('license'),
|
||||
'text' => $license ? $license : I18n::translate('license.unregistered.label'),
|
||||
'theme' => $license ? 'code' : 'negative',
|
||||
'help' => $license ?
|
||||
// @codeCoverageIgnoreStart
|
||||
'<a href="https://hub.getkirby.com">' . I18n::translate('license.manage') . ' →</a>' :
|
||||
// @codeCoverageIgnoreEnd
|
||||
'<a href="https://getkirby.com/buy">' . I18n::translate('license.buy') . ' →</a>'
|
||||
]
|
||||
'license' => [
|
||||
'code' => $license->code($obfuscated),
|
||||
'icon' => $status->icon(),
|
||||
'info' => $status->info($license->renewal('Y-m-d', 'date')),
|
||||
'theme' => $status->theme(),
|
||||
'type' => $license->label(),
|
||||
],
|
||||
'submitButton' => false,
|
||||
'cancelButton' => false,
|
||||
'cancelButton' => $renewable,
|
||||
'submitButton' => $renewable ? [
|
||||
'icon' => 'refresh',
|
||||
'text' => I18n::translate('renew'),
|
||||
'theme' => 'love',
|
||||
] : false,
|
||||
]
|
||||
];
|
||||
},
|
||||
'submit' => function () {
|
||||
// @codeCoverageIgnoreStart
|
||||
$response = App::instance()->system()->license()->upgrade();
|
||||
|
||||
// the upgrade is still needed
|
||||
if ($response['status'] === 'upgrade') {
|
||||
return [
|
||||
'redirect' => $response['url']
|
||||
];
|
||||
}
|
||||
|
||||
// the upgrade has already been completed
|
||||
if ($response['status'] === 'complete') {
|
||||
return [
|
||||
'event' => 'system.renew',
|
||||
'message' => I18n::translate('license.success')
|
||||
];
|
||||
}
|
||||
|
||||
throw new LogicException('The upgrade failed');
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
],
|
||||
// license registration
|
||||
'registration' => [
|
||||
'load' => function () {
|
||||
$system = App::instance()->system();
|
||||
$local = $system->isLocal();
|
||||
|
||||
return [
|
||||
'component' => 'k-form-dialog',
|
||||
'props' => [
|
||||
'fields' => [
|
||||
'domain' => [
|
||||
'label' => I18n::translate('license.activate.label'),
|
||||
'type' => 'info',
|
||||
'theme' => $system->isLocal() ? 'notice' : 'info',
|
||||
'text' => I18n::template('license.register.' . ($system->isLocal() ? 'local' : 'domain'), ['host' => $system->indexUrl()])
|
||||
'theme' => $local ? 'warning' : 'info',
|
||||
'text' => I18n::template('license.activate.' . ($local ? 'local' : 'domain'), ['host' => $system->indexUrl()])
|
||||
],
|
||||
'license' => [
|
||||
'label' => I18n::translate('license.register.label'),
|
||||
'label' => I18n::translate('license.code.label'),
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
'counter' => false,
|
||||
'placeholder' => 'K3-',
|
||||
'help' => I18n::translate('license.register.help')
|
||||
'placeholder' => 'K-',
|
||||
'help' => I18n::translate('license.code.help') . ' ' . '<a href="https://getkirby.com/buy" target="_blank">' . I18n::translate('license.buy') . ' →</a>'
|
||||
],
|
||||
'email' => Field::email(['required' => true])
|
||||
],
|
||||
'submitButton' => I18n::translate('license.register'),
|
||||
'submitButton' => [
|
||||
'icon' => 'key',
|
||||
'text' => I18n::translate('activate'),
|
||||
'theme' => 'love',
|
||||
],
|
||||
'value' => [
|
||||
'license' => null,
|
||||
'email' => null
|
||||
|
@ -83,7 +105,7 @@ return [
|
|||
|
||||
return [
|
||||
'event' => 'system.register',
|
||||
'message' => I18n::translate('license.register.success')
|
||||
'message' => I18n::translate('license.success')
|
||||
];
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
|
|
@ -11,31 +11,34 @@ return [
|
|||
$system = $kirby->system();
|
||||
$updateStatus = $system->updateStatus();
|
||||
$license = $system->license();
|
||||
$debugMode = $kirby->option('debug', false) === true;
|
||||
$isLocal = $system->isLocal();
|
||||
|
||||
$environment = [
|
||||
[
|
||||
'label' => $license ? I18n::translate('license') : I18n::translate('license.register.label'),
|
||||
'value' => $license ? 'Kirby 3' : I18n::translate('license.unregistered.label'),
|
||||
'theme' => $license ? null : 'negative',
|
||||
'dialog' => $license ? 'license' : 'registration'
|
||||
'label' => $license->status()->label(),
|
||||
'value' => $license->label(),
|
||||
'theme' => $license->status()->theme(),
|
||||
'icon' => $license->status()->icon(),
|
||||
'dialog' => $license->status()->dialog()
|
||||
],
|
||||
[
|
||||
'label' => $updateStatus?->label() ?? I18n::translate('version'),
|
||||
'value' => $kirby->version(),
|
||||
'link' => (
|
||||
$updateStatus ?
|
||||
$updateStatus->url() :
|
||||
'https://github.com/getkirby/kirby/releases/tag/' . $kirby->version()
|
||||
),
|
||||
'theme' => $updateStatus?->theme()
|
||||
'link' => $updateStatus?->url() ??
|
||||
'https://github.com/getkirby/kirby/releases/tag/' . $kirby->version(),
|
||||
'theme' => $updateStatus?->theme(),
|
||||
'icon' => $updateStatus?->icon() ?? 'info'
|
||||
],
|
||||
[
|
||||
'label' => 'PHP',
|
||||
'value' => phpversion()
|
||||
'value' => phpversion(),
|
||||
'icon' => 'code'
|
||||
],
|
||||
[
|
||||
'label' => I18n::translate('server'),
|
||||
'value' => $system->serverSoftware() ?? '?'
|
||||
'value' => $system->serverSoftwareShort() ?? '?',
|
||||
'icon' => 'server'
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -44,10 +47,14 @@ return [
|
|||
$plugins = $system->plugins()->values(function ($plugin) use (&$exceptions) {
|
||||
$authors = $plugin->authorsNames();
|
||||
$updateStatus = $plugin->updateStatus();
|
||||
$version = $updateStatus?->toArray() ?? $plugin->version() ?? '–';
|
||||
$version = $updateStatus?->toArray();
|
||||
$version ??= $plugin->version() ?? '–';
|
||||
|
||||
if ($updateStatus !== null) {
|
||||
$exceptions = array_merge($exceptions, $updateStatus->exceptionMessages());
|
||||
$exceptions = [
|
||||
...$exceptions,
|
||||
...$updateStatus->exceptionMessages()
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -63,15 +70,29 @@ return [
|
|||
|
||||
$security = $updateStatus?->messages() ?? [];
|
||||
|
||||
if ($kirby->option('debug', false) === true) {
|
||||
if ($isLocal === true) {
|
||||
$security[] = [
|
||||
'id' => 'debug',
|
||||
'text' => I18n::translate('system.issues.debug'),
|
||||
'link' => 'https://getkirby.com/security/debug'
|
||||
'id' => 'local',
|
||||
'icon' => 'info',
|
||||
'theme' => 'info',
|
||||
'text' => I18n::translate('system.issues.local')
|
||||
];
|
||||
}
|
||||
|
||||
if ($kirby->environment()->https() !== true) {
|
||||
if ($debugMode === true) {
|
||||
$security[] = [
|
||||
'id' => 'debug',
|
||||
'icon' => $isLocal ? 'info' : 'alert',
|
||||
'theme' => $isLocal ? 'info' : 'negative',
|
||||
'text' => I18n::translate('system.issues.debug'),
|
||||
'link' => 'https://getkirby.com/security/debug'
|
||||
];
|
||||
}
|
||||
|
||||
if (
|
||||
$isLocal === false &&
|
||||
$kirby->environment()->https() !== true
|
||||
) {
|
||||
$security[] = [
|
||||
'id' => 'https',
|
||||
'text' => I18n::translate('system.issues.https'),
|
||||
|
@ -79,19 +100,34 @@ return [
|
|||
];
|
||||
}
|
||||
|
||||
if ($kirby->option('panel.vue.compiler', null) === null) {
|
||||
$security[] = [
|
||||
'id' => 'vue-compiler',
|
||||
'link' => 'https://getkirby.com/security/vue-compiler',
|
||||
'text' => I18n::translate('system.issues.vue.compiler'),
|
||||
'theme' => 'notice'
|
||||
];
|
||||
}
|
||||
|
||||
// sensitive URLs
|
||||
if ($isLocal === false) {
|
||||
$sensitive = [
|
||||
'content' => $system->exposedFileUrl('content'),
|
||||
'git' => $system->exposedFileUrl('git'),
|
||||
'kirby' => $system->exposedFileUrl('kirby'),
|
||||
'site' => $system->exposedFileUrl('site')
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'component' => 'k-system-view',
|
||||
'props' => [
|
||||
'environment' => $environment,
|
||||
'exceptions' => $kirby->option('debug') === true ? $exceptions : [],
|
||||
'exceptions' => $debugMode ? $exceptions : [],
|
||||
'info' => $system->info(),
|
||||
'plugins' => $plugins,
|
||||
'security' => $security,
|
||||
'urls' => [
|
||||
'content' => $system->exposedFileUrl('content'),
|
||||
'git' => $system->exposedFileUrl('git'),
|
||||
'kirby' => $system->exposedFileUrl('kirby'),
|
||||
'site' => $system->exposedFileUrl('site')
|
||||
]
|
||||
'urls' => $sensitive ?? null
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue