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

getPlatform() public method

Typical return values are: "Linux", "FreeBSD", "Darwin" (Mac OSX), "Windows".
public getPlatform ( )
    public function getPlatform()
    {
        if (function_exists('posix_uname')) {
            $data = posix_uname();
            if (array_key_exists('sysname', $data)) {
                return $data['sysname'];
            }
        }
        if (\PHP_OS == 'WINNT') {
            return 'Windows';
        }
        return 'unknown';
    }

Usage Example

Beispiel #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::getPlatform