Skip to content

Commit 08e2ccc

Browse files
trashercedric-anne
authored andcommitted
Remove library display from system information
closes #19645
1 parent d0b8c85 commit 08e2ccc

File tree

4 files changed

+2
-339
lines changed

4 files changed

+2
-339
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ The present file will list all changes made to the project; according to the
395395
- `ComputerVirtualMachine::showForComputer()`
396396
- `Config::detectRootDoc()`
397397
- `Config::getCurrentDBVersion()`
398+
- `Config::getLibraries()`
399+
- `Config::getLibraryDir()`
398400
- `Config::showDebug()`
399401
- `Config::showLibrariesInformation()`
400402
- `Config::validatePassword()`

phpunit/functional/ConfigTest.php

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -170,57 +170,6 @@ public function testUnsetUndisclosedFields()
170170
$this->assertSame($expected, $input);
171171
}
172172

173-
public function testGetLibraries()
174-
{
175-
$actual = $expected = [];
176-
$deps = \Config::getLibraries(true);
177-
foreach ($deps as $dep) {
178-
// composer names only (skip htmlLawed)
179-
if (strpos($dep['name'], '/')) {
180-
$actual[] = $dep['name'];
181-
}
182-
}
183-
sort($actual);
184-
$this->assertNotEmpty($actual);
185-
$composer = json_decode(file_get_contents(__DIR__ . '/../../composer.json'), true);
186-
foreach (array_keys($composer['require']) as $dep) {
187-
// composer names only (skip php, ext-*, ...)
188-
if (strpos($dep, '/')) {
189-
$expected[] = $dep;
190-
}
191-
}
192-
sort($expected);
193-
$this->assertNotEmpty($expected);
194-
195-
$unexpected_libs = array_diff($actual, $expected);
196-
$missing_libs = array_diff($expected, $actual);
197-
198-
$this->assertEmpty(
199-
$unexpected_libs,
200-
'Unexpected libs returned by Config::getLibraries(): ' . implode(', ', $unexpected_libs)
201-
);
202-
$this->assertEmpty(
203-
$missing_libs,
204-
'Missing libs in Config::getLibraries() return value: ' . implode(', ', $missing_libs)
205-
);
206-
}
207-
208-
public function testGetLibraryDir()
209-
{
210-
$this->assertFalse(\Config::getLibraryDir(''));
211-
$this->assertFalse(\Config::getLibraryDir('abcde'));
212-
213-
$expected = realpath(__DIR__ . '/../../vendor/symfony/console');
214-
if (is_dir($expected)) { // skip when system library is used
215-
$this->assertSame($expected, \Config::getLibraryDir('Symfony\Component\Console\Application'));
216-
217-
$mailer = new \Symfony\Component\Console\Application();
218-
$this->assertSame($expected, \Config::getLibraryDir($mailer));
219-
}
220-
221-
$expected = realpath(__DIR__ . '/../../tests/src/autoload');
222-
$this->assertSame($expected, \Config::getLibraryDir('getItemByTypeName'));
223-
}
224173

225174
public function testCheckExtensions()
226175
{

src/Config.php

Lines changed: 0 additions & 276 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
use Glpi\System\RequirementsManager;
4141
use Glpi\Toolbox\ArrayNormalizer;
4242
use Glpi\UI\ThemeManager;
43-
use SimplePie\SimplePie;
4443
use Symfony\Component\HttpFoundation\Request;
4544

4645
/**
@@ -858,281 +857,6 @@ public function showSystemInformations()
858857
}
859858

860859

861-
/**
862-
* Retrieve full directory of a lib
863-
*
864-
* @param $libstring object, class or function
865-
*
866-
* @return false|string the path or false
867-
*
868-
* @since 9.1
869-
*/
870-
public static function getLibraryDir($libstring)
871-
{
872-
if (is_object($libstring)) {
873-
return realpath(dirname((new ReflectionObject($libstring))->getFileName()));
874-
} elseif (class_exists($libstring) || interface_exists($libstring)) {
875-
return realpath(dirname((new ReflectionClass($libstring))->getFileName()));
876-
} elseif (function_exists($libstring)) {
877-
// Internal function have no file name
878-
$path = (new ReflectionFunction($libstring))->getFileName();
879-
return ($path ? realpath(dirname($path)) : false);
880-
}
881-
return false;
882-
}
883-
884-
885-
/**
886-
* get libraries list
887-
*
888-
* @param $all (default false)
889-
* @return array dependencies list
890-
*
891-
* @since 9.4
892-
*/
893-
public static function getLibraries($all = false)
894-
{
895-
// use same name that in composer.json
896-
$deps = [
897-
[ 'name' => 'symfony/mailer',
898-
'check' => 'Symfony/Mailer',
899-
],
900-
[ 'name' => 'simplepie/simplepie',
901-
'version' => SimplePie::VERSION,
902-
'check' => SimplePie::class,
903-
],
904-
[ 'name' => 'tecnickcom/tcpdf',
905-
'version' => TCPDF_STATIC::getTCPDFVersion(),
906-
'check' => 'TCPDF',
907-
],
908-
[ 'name' => 'tecnickcom/tc-lib-barcode',
909-
'check' => 'Com\\Tecnick\\Barcode\\Barcode',
910-
],
911-
[ 'name' => 'sabre/dav',
912-
'check' => 'Sabre\\DAV\\Version',
913-
],
914-
[ 'name' => 'sabre/http',
915-
'check' => 'Sabre\\HTTP\\Version',
916-
],
917-
[ 'name' => 'sabre/uri',
918-
'check' => 'Sabre\\Uri\\Version',
919-
],
920-
[ 'name' => 'sabre/vobject',
921-
'check' => 'Sabre\\VObject\\Component',
922-
],
923-
[ 'name' => 'laminas/laminas-i18n',
924-
'check' => 'Laminas\\I18n\\Module',
925-
],
926-
[ 'name' => 'monolog/monolog',
927-
'check' => 'Monolog\\Logger',
928-
],
929-
[ 'name' => 'sebastian/diff',
930-
'check' => 'SebastianBergmann\\Diff\\Diff',
931-
],
932-
[ 'name' => 'donatj/phpuseragentparser',
933-
'check' => 'donatj\\UserAgent\\UserAgentParser',
934-
],
935-
[ 'name' => 'elvanto/litemoji',
936-
'check' => 'LitEmoji\\LitEmoji',
937-
],
938-
[ 'name' => 'gettext/languages',
939-
'check' => 'Gettext\\Languages\\Language',
940-
],
941-
[ 'name' => 'symfony/console',
942-
'check' => 'Symfony\\Component\\Console\\Application',
943-
],
944-
[ 'name' => 'symfony/config',
945-
'check' => 'Symfony\\Component\\Config\\Loader\\LoaderInterface',
946-
],
947-
[ 'name' => 'symfony/dependency-injection',
948-
'check' => 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
949-
],
950-
[ 'name' => 'symfony/event-dispatcher',
951-
'check' => 'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface',
952-
],
953-
[ 'name' => 'symfony/filesystem',
954-
'check' => 'Symfony\\Component\\Filesystem\\Filesystem',
955-
],
956-
[ 'name' => 'symfony/framework-bundle',
957-
'check' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
958-
],
959-
[ 'name' => 'symfony/http-foundation',
960-
'check' => 'Symfony\\Component\\HttpFoundation\\Request',
961-
],
962-
[ 'name' => 'symfony/http-kernel',
963-
'check' => 'Symfony\\Component\\HttpKernel\\KernelInterface',
964-
],
965-
[ 'name' => 'symfony/routing',
966-
'check' => 'Symfony\\Component\\Routing\\RouterInterface',
967-
],
968-
[ 'name' => 'scssphp/scssphp',
969-
'check' => 'ScssPhp\ScssPhp\Compiler',
970-
],
971-
[ 'name' => 'laminas/laminas-mail',
972-
'check' => 'Laminas\\Mail\\Protocol\\Imap',
973-
],
974-
[ 'name' => 'laminas/laminas-mime',
975-
'check' => 'Laminas\\Mime\\Mime',
976-
],
977-
[ 'name' => 'rlanvin/php-rrule',
978-
'check' => 'RRule\\RRule',
979-
],
980-
[ 'name' => 'ramsey/uuid',
981-
'check' => 'Ramsey\\Uuid\\Uuid',
982-
],
983-
[ 'name' => 'phpoffice/phpspreadsheet',
984-
'check' => 'PhpOffice\\PhpSpreadsheet\\Spreadsheet',
985-
],
986-
[ 'name' => 'psr/log',
987-
'check' => 'Psr\\Log\\LoggerInterface',
988-
],
989-
[ 'name' => 'psr/simple-cache',
990-
'check' => 'Psr\\SimpleCache\\CacheInterface',
991-
],
992-
[ 'name' => 'psr/cache',
993-
'check' => 'Psr\\Cache\\CacheItemPoolInterface',
994-
],
995-
[ 'name' => 'psr/container',
996-
'check' => 'Psr\\Container\\ContainerInterface',
997-
],
998-
[ 'name' => 'league/csv',
999-
'check' => 'League\\Csv\\Writer',
1000-
],
1001-
[ 'name' => 'mexitek/phpcolors',
1002-
'check' => 'Mexitek\\PHPColors\\Color',
1003-
],
1004-
[ 'name' => 'guzzlehttp/guzzle',
1005-
'check' => 'GuzzleHttp\\Client',
1006-
],
1007-
[ 'name' => 'guzzlehttp/psr7',
1008-
'check' => 'GuzzleHttp\\Psr7\\Response',
1009-
],
1010-
[ 'name' => 'glpi-project/inventory_format',
1011-
'check' => 'Glpi\Inventory\Converter',
1012-
],
1013-
[ 'name' => 'wapmorgan/unified-archive',
1014-
'check' => 'wapmorgan\\UnifiedArchive\\UnifiedArchive',
1015-
],
1016-
[ 'name' => 'paragonie/sodium_compat',
1017-
'check' => 'ParagonIE_Sodium_Compat',
1018-
],
1019-
[ 'name' => 'symfony/cache',
1020-
'check' => 'Symfony\\Component\\Cache\\Psr16Cache',
1021-
],
1022-
[ 'name' => 'html2text/html2text',
1023-
'check' => 'Html2Text\\Html2Text',
1024-
],
1025-
[
1026-
'name' => 'symfony/css-selector',
1027-
'check' => 'Symfony\\Component\\CssSelector\\CssSelectorConverter',
1028-
],
1029-
[ 'name' => 'symfony/dom-crawler',
1030-
'check' => 'Symfony\\Component\\DomCrawler\\Crawler',
1031-
],
1032-
[ 'name' => 'twig/twig',
1033-
'check' => 'Twig\\Environment',
1034-
],
1035-
[ 'name' => 'twig/string-extra',
1036-
'check' => 'Twig\\Extra\\String\\StringExtension',
1037-
],
1038-
[ 'name' => 'symfony/polyfill-ctype',
1039-
'check' => 'ctype_digit',
1040-
],
1041-
[ 'name' => 'symfony/polyfill-iconv',
1042-
'check' => 'iconv',
1043-
],
1044-
[ 'name' => 'symfony/polyfill-mbstring',
1045-
'check' => 'mb_list_encodings',
1046-
],
1047-
[
1048-
'name' => 'symfony/polyfill-php83',
1049-
'check' => 'json_validate',
1050-
],
1051-
[
1052-
'name' => 'league/oauth2-client',
1053-
'check' => 'League\\OAuth2\\Client\\Provider\\AbstractProvider',
1054-
],
1055-
[
1056-
'name' => 'league/oauth2-google',
1057-
'check' => 'League\\OAuth2\\Client\\Provider\\Google',
1058-
],
1059-
[
1060-
'name' => 'thenetworg/oauth2-azure',
1061-
'check' => 'TheNetworg\\OAuth2\\Client\\Provider\\Azure',
1062-
],
1063-
[
1064-
'name' => 'league/commonmark',
1065-
'check' => 'League\\CommonMark\\Extension\\CommonMark\\CommonMarkCoreExtension',
1066-
],
1067-
[
1068-
'name' => 'egulias/email-validator',
1069-
'check' => 'Egulias\\EmailValidator\\EmailValidator',
1070-
],
1071-
[
1072-
'name' => 'symfony/mime',
1073-
'check' => 'Symfony\\Mime\\Message',
1074-
],
1075-
[
1076-
'name' => 'apereo/phpcas',
1077-
'check' => 'phpCAS',
1078-
],
1079-
[
1080-
'name' => 'bacon/bacon-qr-code',
1081-
'check' => 'BaconQrCode\\Writer',
1082-
],
1083-
[
1084-
'name' => 'robthree/twofactorauth',
1085-
'check' => 'RobThree\\Auth\\TwoFactorAuth',
1086-
],
1087-
[
1088-
'name' => 'ralouphie/getallheaders',
1089-
'check' => 'getallheaders',
1090-
],
1091-
[
1092-
'name' => 'symfony/html-sanitizer',
1093-
'check' => 'Symfony\\Component\\HtmlSanitizer\\HtmlSanitizer',
1094-
],
1095-
[
1096-
'name' => 'league/oauth2-server',
1097-
'check' => 'League\\OAuth2\\Server\\AuthorizationServer',
1098-
],
1099-
[
1100-
'name' => 'league/html-to-markdown',
1101-
'check' => 'League\\HTMLToMarkdown\\HtmlConverter',
1102-
],
1103-
[
1104-
'name' => 'twig/markdown-extra',
1105-
'check' => 'Twig\\Extra\\Markdown\\LeagueMarkdown',
1106-
],
1107-
[
1108-
'name' => 'webonyx/graphql-php',
1109-
'check' => 'GraphQL\\GraphQL',
1110-
],
1111-
[
1112-
'name' => 'phpdocumentor/reflection-docblock',
1113-
'check' => 'phpDocumentor\Reflection\DocBlock',
1114-
],
1115-
[
1116-
'name' => 'symfony/property-access',
1117-
'check' => 'Symfony\Component\PropertyAccess\PropertyAccess',
1118-
],
1119-
[
1120-
'name' => 'symfony/serializer',
1121-
'check' => 'Symfony\Component\Serializer\Serializer',
1122-
],
1123-
[
1124-
'name' => 'symfony/property-info',
1125-
'check' => 'Symfony\Component\PropertyInfo\Type',
1126-
],
1127-
[
1128-
'name' => 'symfony/error-handler',
1129-
'check' => 'Symfony\Component\ErrorHandler\ErrorHandler',
1130-
],
1131-
];
1132-
return $deps;
1133-
}
1134-
1135-
1136860
/**
1137861
* Dropdown for global management config
1138862
*

templates/pages/setup/general/systeminfo_table.html.twig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,6 @@ Requirements:
9494
{%- endfor -%}
9595
{% endset %}
9696

97-
{% set lib_info %}
98-
{%- for dep in call('Config::getLibraries') -%}
99-
{% set path = call('Config::getLibraryDir', [dep['check']]) %}
100-
{%- if path -%}
101-
{{ "\n" ~ dep['name'] }} version {{ dep['version'] }} in {{ path }}
102-
{%- else -%}
103-
{{ "\n" ~ dep['name'] }} not found
104-
{%- endif -%}
105-
{%- endfor -%}
106-
{% endset %}
107-
10897
{% set locale_info %}
10998
{%- for file in locales_overrides -%}
11099
{{ "\n" ~ file }}
@@ -115,7 +104,6 @@ Requirements:
115104
{{ _self.sysinfo_section('GLPI information', glpi_info) }}
116105
{{ _self.sysinfo_section('Server', server_info, true) }}
117106
{{ _self.sysinfo_section('GLPI constants', constants_info, true) }}
118-
{{ _self.sysinfo_section('Libraries', lib_info, true) }}
119107
{% for info_obj in system_info_objs %}
120108
{% set info = call([info_obj, 'getSystemInformation']) %}
121109
{% if info['label'] is not empty and info['content'] is not empty %}

0 commit comments

Comments
 (0)