-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-26391: ez-support-tools factory called on every request (#21)
* EZP-26391: ez-support-tools factory called on every request Part 2, fixes Command by wrapping ezcSystemInfo and exposing magic properties.
- Loading branch information
Showing
7 changed files
with
90 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
/** | ||
* File containing the EzcSystemInfoWrapper class. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace EzSystems\EzSupportToolsBundle\SystemInfo; | ||
|
||
use ezcSystemInfo; | ||
use ezcSystemInfoReaderCantScanOSException; | ||
|
||
/** | ||
* This wraps zetacomponents/sysinfo, exposing its magic properties as public properties. | ||
* Used here to allow lazy loading. | ||
*/ | ||
class EzcSystemInfoWrapper | ||
{ | ||
/** @var string */ | ||
public $osType; | ||
|
||
/** @var string */ | ||
public $osName; | ||
|
||
/** @var string */ | ||
public $fileSystemType; | ||
|
||
/** @var integer */ | ||
public $cpuCount; | ||
|
||
/** @var string */ | ||
public $cpuType; | ||
|
||
/** @var float */ | ||
public $cpuSpeed; | ||
|
||
/** @var integer */ | ||
public $memorySize; | ||
|
||
/** @var string */ | ||
public $lineSeparator; | ||
|
||
/** @var string */ | ||
public $backupFileName; | ||
|
||
/** @var array */ | ||
public $phpVersion; | ||
|
||
/** @var \ezcSystemInfoAccelerator */ | ||
public $phpAccelerator; | ||
|
||
/** @var bool */ | ||
public $isShellExecution; | ||
|
||
public function __construct() | ||
{ | ||
try { | ||
$ezcSystemInfo = ezcSystemInfo::getInstance(); | ||
} catch(ezcSystemInfoReaderCantScanOSException $e) { | ||
// Leave properties as null: https://github.com/zetacomponents/SystemInformation/pull/9 | ||
return; | ||
} | ||
|
||
foreach (array_keys(get_object_vars($this)) as $var) { | ||
$this->$var = $ezcSystemInfo->$var; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters