PartKeepr\CoreBundle\System\OperatingSystem::getRelease PHP Method

getRelease() public method

Returns the distribution.
public getRelease ( ) : string
return string string
    public function getRelease()
    {
        switch (strtolower($this->getPlatform())) {
            case 'freebsd':
                /*
                 * Unfortunately, there's no text file on FreeBSD which tells us the release
                 * number. Thus, we hope that "release" within posix_uname() is defined.
                 */
                if (function_exists('posix_uname')) {
                    $data = posix_uname();
                    if (array_key_exists('release', $data)) {
                        return $data['release'];
                    }
                }
                break;
            case 'darwin':
                /*
                 * Mac stores its version number in a public readable plist file, which
                 * is in XML format.
                 */
                $document = new \DomDocument();
                $document->load('/System/Library/CoreServices/SystemVersion.plist');
                $xpath = new \DOMXPath($document);
                $entries = $xpath->query('/plist/dict/*');
                $previous = '';
                foreach ($entries as $entry) {
                    if (strpos($previous, 'ProductVersion') !== false) {
                        return $entry->textContent;
                    }
                    $previous = $entry->textContent;
                }
                break;
            case 'linux':
                return $this->getLinuxDistribution();
                break;
            default:
                break;
        }
        return 'unknown';
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Returns a list of system information records.
  *
  * Please note that it is not defined which information is returned; the result
  * should be seen as "informational" to the system operator, not for automated purposes.
  *
  * @return SystemInformationRecord[] An array of SystemInformationRecords
  */
 public function getSystemInformation()
 {
     $aData = array();
     $aData[] = new SystemInformationRecord("Doctrine ORM", ORMVersion::VERSION, "Libraries");
     $aData[] = new SystemInformationRecord("Doctrine DBAL", DBALVersion::VERSION, "Libraries");
     $aData[] = new SystemInformationRecord("PHP Version", phpversion(), "System");
     $os = new OperatingSystem();
     $aData[] = new SystemInformationRecord("Operating System Type", $os->getPlatform(), "System");
     $aData[] = new SystemInformationRecord("Operating System Release", $os->getRelease(), "System");
     $aData[] = new SystemInformationRecord("memory_limit", ini_get("memory_limit"), "PHP");
     $aData[] = new SystemInformationRecord("post_max_size", ini_get("post_max_size"), "PHP");
     $aData[] = new SystemInformationRecord("upload_max_filesize", ini_get("upload_max_filesize"), "PHP");
     $aData[] = new SystemInformationRecord("allow_url_fopen", ini_get("allow_url_fopen"), "PHP");
     $aData[] = new SystemInformationRecord("max_execution_time", ini_get("max_execution_time"), "PHP");
     $queryCache = get_class($this->entityManager->getConfiguration()->getQueryCacheImpl());
     $metadataCache = get_class($this->entityManager->getConfiguration()->getMetadataCacheImpl());
     $aData[] = new SystemInformationRecord("Query Cache Implementation", $queryCache, "PHP");
     $aData[] = new SystemInformationRecord("Metadata Cache Implementation", $metadataCache, "PHP");
     $aData[] = new SystemInformationRecord("Disk Space (Total)", $this->format_bytes($this->getTotalDiskSpace()), "PartKeepr");
     $aData[] = new SystemInformationRecord("Disk Space (Free)", $this->format_bytes($this->getFreeDiskSpace()), "PartKeepr");
     $aData[] = new SystemInformationRecord("Disk Space (Used)", $this->format_bytes($this->getUsedDiskSpace()), "PartKeepr");
     $aData[] = new SystemInformationRecord("Data Directory", realpath($this->container->getParameter("partkeepr.filesystem.data_directory")), "PartKeepr");
     $aData[] = new SystemInformationRecord("PartKeepr Version", $this->versionService->getVersion(), "PartKeepr");
     return $aData;
 }
All Usage Examples Of PartKeepr\CoreBundle\System\OperatingSystem::getRelease