Add a more granular container detection (#2501)

Add a more granular container detection

Replace is_in_container by  get_container_info
Currently detect Official container (once they update a version with a tagfile) and LinuxServer container
All other container are marked as Unknown

Report two field :
- container_type ( none | Official | LinuxServer | Unknown
- container_version ( build Version number like 16.2.0a, only reported if Official container is detected )
This commit is contained in:
RushLana
2026-01-14 13:00:14 +01:00
committed by GitHub
parent c614efd33c
commit 5563ea98fd
3 changed files with 82 additions and 31 deletions

View File

@@ -267,6 +267,13 @@ $php_current_timestamp = date("Y-m-d H:i:s");
$db_version = pwg_get_db_version();
list($db_current_date) = pwg_db_fetch_row(pwg_query('SELECT now();'));
list($container_name,$container_version) = get_container_info();
if (!in_array($container_name, ['Official','none']))
{
$container_name = '(unofficial) '.$container_name;
}
$template->assign(
array(
'U_MAINT_CATEGORIES' => sprintf($url_format, 'categories'),
@@ -288,7 +295,8 @@ $template->assign(
'PHPWG_URL' => PHPWG_URL,
'PWG_VERSION' => PHPWG_VERSION,
'U_CHECK_UPGRADE' => sprintf($url_format, 'check_upgrade'),
'OS' => PHP_OS.((is_in_container()) ? ' (container)' : ''),
'OS' => PHP_OS,
'CONTAINER_INFO' => $container_name.(!empty($container_version) ? ' '.$container_version : ''),
'PHP_VERSION' => phpversion(),
'DB_ENGINE' => 'MySQL',
'DB_VERSION' => $db_version,

View File

@@ -17,6 +17,9 @@ const unit_MB = "{"%s MB"|@translate}"
<li>{'Installed on %s, %s'|translate:$INSTALLED_ON:$INSTALLED_SINCE}</li>
{/if}
<li>{'Operating system'|@translate}: {$OS}</li>
{if {$CONTAINER_INFO} neq 'none'}
<li>{'Container info'|translate}: {$CONTAINER_INFO}</li>
{/if}
<li>PHP: {$PHP_VERSION} (<a href="{$U_PHPINFO}" class="externalLink">{'Show info'|@translate}</a>) [{$PHP_DATATIME}]</li>
<li>{$DB_ENGINE}: {$DB_VERSION} [{$DB_DATATIME}]</li>
{if isset($GRAPHICS_LIBRARY)}