Skip to content

Commit

Permalink
feat: tooltips for warnings in staffcp compatibility box
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Jun 7, 2024
1 parent b496a9a commit dbac7d9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
21 changes: 14 additions & 7 deletions custom/panel_templates/Default/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,22 @@
{$NAMELESS_VERSION}
<hr />
{foreach from=$COMPAT_SUCCESS item=item}
<i class="fas fa-check-circle text-success"></i> {$item}
<br />
<i class="fas fa-check-circle text-success"></i> {$item}
<br />
{/foreach}
{if count($COMPAT_WARNINGS)}
<hr />
{foreach from=$COMPAT_WARNINGS item=item}
<i class="fas fa-check-circle text-warning"></i> {$item}
<br />
{/foreach}
<hr />
{foreach from=$COMPAT_WARNINGS item=item key=index}
<i class="fas fa-check-circle text-warning"></i> {$item}
{if isset($COMPAT_WARNINGS_INFO[$index])}
<span class="badge badge-info">
<i class="fas fa-question-circle" data-container="body" data-toggle="popover"
data-placement="top" title="{$INFO}"
data-content="{$COMPAT_WARNINGS_INFO[$index]}"></i>
</span>
{/if}
<br />
{/foreach}
{/if}
{if count($COMPAT_ERRORS)}
<hr />
Expand Down
2 changes: 2 additions & 0 deletions modules/Core/language/en_UK.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
"admin/clone_group": "Clone group",
"admin/closable": "Closable",
"admin/communications": "Communications",
"admin/compat_pdo_version_info": "Either MySQL version {{mysql}} or MariaDB version {{mariadb}} is recommended.",
"admin/compat_php_version_info": "PHP version {{php}} is recommended.",
"admin/config_not_writable": "Your core\/config.php file is not writable. Please check file permissions.",
"admin/configuration": "Configuration",
"admin/confirm_api_regen": "Are you sure you want to regenerate your API key?",
Expand Down
15 changes: 14 additions & 1 deletion modules/Core/pages/panel/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@
if ($user->hasPermission('admincp.core.debugging')) {
$compat_success = [];
$compat_warnings = [];
$compat_warnings_help = [];
$compat_errors = [];

if (PHP_VERSION_ID < 80200) {
// if (PHP_VERSION_ID < 80200) {
if (PHP_VERSION_ID < 90200) {
$compat_warnings[] = 'PHP ' . PHP_VERSION;
$compat_warnings_help[] = $language->get('admin', 'compat_php_version_info', ['php' => '8.0+']);
} else {
$compat_success[] = 'PHP ' . PHP_VERSION;
}
Expand Down Expand Up @@ -179,9 +182,16 @@
if (($pdo_driver === 'MySQL' && version_compare($pdo_server_version, '8.0', '>=')) ||
($pdo_driver === 'MariaDB' && version_compare($pdo_server_version, '10.5', '>='))) {
$compat_success[] = $pdo_driver . ' Server ' . $pdo_server_version;

} else if (($pdo_driver === 'MySQL' && version_compare($pdo_server_version, '5.7', '>=')) ||
($pdo_driver === 'MariaDB' && version_compare($pdo_server_version, '10.3', '>='))) {
$compat_warnings[] = $pdo_driver . ' Server ' . $pdo_server_version;
$compat_warnings_help[] = $language->get(
'admin',
'compat_pdo_version_info',
['mysql' => '8.0+', 'mariadb' => '10.5+']
);

} else {
$compat_errors[] = $pdo_driver . ' Server ' . $pdo_server_version;
}
Expand All @@ -207,12 +217,14 @@
$compat_warnings[] = $language->get('admin', 'panel_template_third_party', [
'name' => Text::bold($template->getName()),
]);
$compat_warnings_help[] = null;
}

$smarty->assign([
'SERVER_COMPATIBILITY' => $language->get('admin', 'server_compatibility'),
'COMPAT_SUCCESS' => $compat_success,
'COMPAT_WARNINGS' => $compat_warnings,
'COMPAT_WARNINGS_INFO' => $compat_warnings_help,
'COMPAT_ERRORS' => $compat_errors,
]);
}
Expand Down Expand Up @@ -248,6 +260,7 @@
'NAMELESS_VERSION' => $language->get('admin', 'running_nameless_version', [
'version' => Text::bold(NAMELESS_VERSION)
]),
'INFO' => $language->get('general', 'info'),
]);

$template->onPageLoad();
Expand Down

0 comments on commit dbac7d9

Please sign in to comment.