PHP Class PartKeepr\CoreBundle\Services\SystemService

Inheritance: extends Symfony\Component\DependencyInjection\ContainerAware
Show file Open project: partkeepr/PartKeepr

Public Methods

Method Description
__construct ( Doctrine\Bundle\DoctrineBundle\Registry $doctrine, Symfony\Component\DependencyInjection\ContainerInterface $container, VersionService $versionService, CronLoggerService $cronLoggerService )
format_bytes ( string | integer $number, boolean $base2conversion = true ) : string Filter for converting bytes to a human-readable format, as Unix command "ls -h" does.
getBytesFromHumanReadable ( string $size_str ) : integer Returns the effective size from a human-readable byte format.
getFreeDiskSpace ( ) : float Returns the available disk space for the configured data_dir.
getSystemInformation ( ) : SystemInformationRecord[] Returns a list of system information records.
getSystemStatus ( ) Returns the database schema status.
getTotalDiskSpace ( )
getUsedDiskSpace ( ) : integer Returns the used disk space occupied by attachments etc.

Protected Methods

Method Description
getSchemaStatus ( ) : string Checks if the schema is up-to-date. If yes, it returns "complete", if not, it returns "incomplete".
is_valid_value ( $number ) : boolean

Method Details

__construct() public method

public __construct ( Doctrine\Bundle\DoctrineBundle\Registry $doctrine, Symfony\Component\DependencyInjection\ContainerInterface $container, VersionService $versionService, CronLoggerService $cronLoggerService )
$doctrine Doctrine\Bundle\DoctrineBundle\Registry
$container Symfony\Component\DependencyInjection\ContainerInterface
$versionService VersionService
$cronLoggerService PartKeepr\CronLoggerBundle\Services\CronLoggerService

format_bytes() public method

Filter for converting bytes to a human-readable format, as Unix command "ls -h" does.
public format_bytes ( string | integer $number, boolean $base2conversion = true ) : string
$number string | integer A string or integer number value to format.
$base2conversion boolean Defines if the conversion has to be strictly performed as binary values or by using a decimal conversion such as 1 KByte = 1000 Bytes.
return string The number converted to human readable representation.

getBytesFromHumanReadable() public method

Example: getBytesFromHumanReadable("1M") will return 1048576.
public getBytesFromHumanReadable ( string $size_str ) : integer
$size_str string The byte
return integer The bytes

getFreeDiskSpace() public method

Returns the available disk space for the configured data_dir.
public getFreeDiskSpace ( ) : float
return float

getSchemaStatus() protected method

Checks if the schema is up-to-date. If yes, it returns "complete", if not, it returns "incomplete".
protected getSchemaStatus ( ) : string
return string Either "complete" or "incomplete"

getSystemInformation() public method

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.
public getSystemInformation ( ) : SystemInformationRecord[]
return PartKeepr\CoreBundle\System\SystemInformationRecord[] An array of SystemInformationRecords

getSystemStatus() public method

This method is usuall called once the user logs in, and alerts him if the schema is not up-to-date. Returns either status incomplete if the schema is not up-to-date, or complete if everything is OK.
public getSystemStatus ( )

getTotalDiskSpace() public method

public getTotalDiskSpace ( )

getUsedDiskSpace() public method

Does not count temporary files.
public getUsedDiskSpace ( ) : integer
return integer

is_valid_value() protected method

protected is_valid_value ( $number ) : boolean
$number
return boolean