123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace OC\App;
- use OCP\IBinaryFinder;
- use OCP\IConfig;
- class Platform {
- public function __construct(
- private IConfig $config,
- ) {
- }
- public function getPhpVersion(): string {
- return phpversion();
- }
- public function getIntSize(): int {
- return PHP_INT_SIZE;
- }
- public function getOcVersion(): string {
- $v = \OCP\Util::getVersion();
- return implode('.', $v);
- }
- public function getDatabase(): string {
- $dbType = $this->config->getSystemValueString('dbtype', 'sqlite');
- if ($dbType === 'sqlite3') {
- $dbType = 'sqlite';
- }
- return $dbType;
- }
- public function getOS(): string {
- return php_uname('s');
- }
-
- public function isCommandKnown(string $command): bool {
- return \OCP\Server::get(IBinaryFinder::class)->findBinaryPath($command) !== false;
- }
- public function getLibraryVersion(string $name): ?string {
- $repo = new PlatformRepository();
- return $repo->findLibrary($name);
- }
- public function getArchitecture(): string {
- return php_uname('m');
- }
- }
|