model/modx/transport/modtransportpackage.class.php

Classes 
package
modx
subpackage
transport
Classes
modTransportPackage

Description

Represents an xPDOTransport package as required for MODX Web Transport Facilities.

\modTransportPackage

Extends from
\xPDOObject
package
modx
subpackage
transport
Properties
$identifier
$package
$release
$version
Methods
_bytes
_getByFsockopen
compareVersion
getComparableVersion
getTransport
install
listPackages
parseSignature
removePackage
save
set
transferPackage
uninstall

Description

Represents an xPDOTransport package as required for MODX Web Transport Facilities.

This is the basis for the entire xPDO object model, and can also be used by a class generator {@link xPDOGenerator}, ultimately allowing custom classes to be user-defined in a web interface and framework-generated at runtime.

Properties

$identifierThe unique identifier of a package.

string $identifier = 'null'

Details

string
The unique identifier of a package.
visibility
public
default
null
final
false
static
false
access
public

$packageThe package to transport.

mixed $package = 'null'

Details

mixed
The package to transport.
visibility
public
default
null
final
false
static
false
access
protected

$releaseThe release number of a package.

string $release = 'null'

Details

string
The release number of a package.
visibility
public
default
null
final
false
static
false
access
public

$versionThe version number of a package.

string $version = 'null'

Details

string
The version number of a package.
visibility
public
default
null
final
false
static
false
access
public

Methods

_bytes

_bytes( string $value ) : integer

Converts to bytes from PHP ini_get() format.

PHP ini modifiers for byte values:

  • G = gigabytes
  • M = megabytes
  • K = kilobytes
Arguments
$value
string
Number of bytes represented in PHP ini value format.
Output
integer
The value converted to bytes.
Details
visibility
protected
final
false
static
false
access
protected

_getByFsockopen

_getByFsockopen( string $url ) : string

If for some reason the server does not have allow_url_fopen or cURL enabled, use this function to get the file via fsockopen.

Arguments
$url
string
The source URL to retrieve
Output
string
The response from the server
Details
visibility
protected
final
false
static
false
access
protected

compareVersion

compareVersion( string $version, string $direction = <= ) : boolean

Compares this version of the package to another

Arguments
$version
string
The version to compare to. Must be a PHP- standardized version.
$direction
string
The direction to compare. Defaults to &lt;=
Output
boolean
Result of comparison.
Details
visibility
public
final
false
static
false

getComparableVersion

getComparableVersion( ) : string

Gets a version string able to be used by version_compare for checking

Output
string
The properly formatted string.
Details
visibility
public
final
false
static
false

getTransport

getTransport( integer $state ) : mixed

Gets the package's transport mechanism.

Arguments
$state
integer
The state of the package.
Output
mixed
The package.
Details
visibility
public
final
false
static
false
access
public

install

install( array $options = array ) : boolean

Installs or upgrades the package.

Arguments
$options
array
An array of installation options
Output
boolean
True if successful.
Details
visibility
public
final
false
static
false
access
public

listPackages

listPackages( \modX $modx, \$workspace $workspace, int $limit = 0, int $offset = 0 ) : array

List the packages from this transport package

Arguments
$modx
\modX
A reference to the modX instance
$workspace
\$workspace
The current active workspace ID
$limit
int
The limit of packages to return
$offset
int
The offset on which to list by
Output
array
Details
visibility
public
final
false
static
true
static

parseSignature

parseSignature( ) : boolean

Parses the signature.

Output
boolean
True if successful.
Details
visibility
public
final
false
static
false
access
public

removePackage

removePackage( boolean $force = false, boolean $uninstall = true ) : boolean

Removes and uninstalls the package.

Arguments
$force
boolean
Indicates if removal should be forced even if currently installed.
$uninstall
boolean
Indicates if the package should be uninstalled before removal.
Output
boolean
True if the package was successfully removed.
Details
visibility
public
final
false
static
false

save

save( boolean $cacheFlag = null ) : boolean

Overrides xPDOObject::save to set a default created time if new.

{@inheritDoc}

Arguments
$cacheFlag
boolean
Output
boolean
True if the save was successful
Details
visibility
public
final
false
static
false

set

set( string $k, mixed $v = null, string $vType ) : boolean

Overrides xPDOObject::set. Checks if signature is set, and if so, parses it and sets the source if is a new package.

{@inheritdoc}

Additional logic added for the following fields: -alias: Applies {@link modResource::cleanAlias()} -contentType: Calls {@link modResource::addOne()} to sync contentType -content_type: Sets the contentType field appropriately

Arguments
$k
string
The key to set
$v
mixed
The value to set
$vType
string
The validation type to set against
Output
boolean
True if successfully set
Details
visibility
public
final
false
static
false

transferPackage

transferPackage( string $sourceFile, string $targetDir ) : boolean

Transfers the package from one directory to another.

Arguments
$sourceFile
string
The file to transfer.
$targetDir
string
The directory to transfer into.
Output
boolean
True if successful.
Details
visibility
public
final
false
static
false
access
public

uninstall

uninstall( array $options = array ) : boolean

Uninstalls the package.

Arguments
$options
array
An array of uninstallation options
Output
boolean
True if successful.
Details
visibility
public
final
false
static
false
access
public
Documentation was generated by DocBlox 0.11.2.