/
InfoCommand.php
79 lines (65 loc) · 2.7 KB
/
InfoCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Concrete\Core\Console\Command;
use Concrete\Core\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Concrete\Core\Support\Facade\Facade;
use Concrete\Core\System\Info;
class InfoCommand extends Command
{
protected function configure()
{
$errExitCode = static::RETURN_CODE_ON_FAILURE;
$this
->setName('c5:info')
->setDescription('Get server and concrete5 detailed informations.')
->addEnvOption()
->setHelp(<<<EOT
Returns codes:
0 operation completed successfully
$errExitCode errors occurred
More info at http://documentation.concrete5.org/developers/appendix/cli-commands#c5-info
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$info = Facade::getFacadeApplication()->make(Info::class);
/* @var Info $info */
$output->writeln('<info># concrete5 Version</info>');
$output->writeln('Installed - ' . ($info->isInstalled() ? 'Yes' : 'No'));
$output->writeln($info->getCoreVersions());
if ($info->isInstalled()) {
$output->writeln('');
$output->writeln('<info># Database Information</info>');
$output->writeln('Version - ' . $info->getDBMSVersion());
$output->writeln('SQL Mode - ' . $info->getDBMSSqlMode());
}
$output->writeln('');
$output->writeln('<info># Paths</info>');
$output->writeln('Web root - ' . $info->getWebRootDirectory());
$output->writeln('Core root - ' . $info->getCoreRootDirectory());
$output->writeln('');
$output->writeln('<info># concrete5 Packages</info>');
$output->writeln($info->getPackages() ?: 'None');
$output->writeln('');
$output->writeln('<info># concrete5 Overrides</info>');
$output->writeln($info->getOverrides() ?: 'None');
$output->writeln('');
$output->writeln('<info># concrete5 Cache Settings</info>');
$output->writeln($info->getCache());
$output->writeln('');
$output->writeln('<info># Server API</info>');
$output->writeln($info->getServerAPI());
$output->writeln('');
$output->writeln('<info># PHP Version</info>');
$output->writeln($info->getPhpVersion());
$output->writeln('');
$output->writeln('<info># PHP Extensions</info>');
$output->writeln(($info->getPhpExtensions() === false ? 'Unable to determine' : $info->getPhpExtensions()));
$output->writeln('');
$output->writeln('<info># PHP Settings</info>');
$output->writeln($info->getPhpSettings());
}
}