PHP Class Pantheon\Terminus\Models\Environment

Inheritance: extends TerminusModel, implements Robo\Contract\ConfigAwareInterface, implements League\Container\ContainerAwareInterface, use trait League\Container\ContainerAwareTrait, use trait Robo\Common\ConfigAwareTrait
Show file Open project: pantheon-systems/terminus Class Usage Examples

Public Properties

Property Type Description
$backups Pantheon\Terminus\Collections\Backups
$bindings Pantheon\Terminus\Collections\Bindings
$commits Pantheon\Terminus\Collections\Commits
$domains Pantheon\Terminus\Collections\Domains
$site Site
$workflows Pantheon\Terminus\Collections\Workflows

Protected Properties

Property Type Description
$lock Lock

Public Methods

Method Description
__construct ( object $attributes, array $options = [] ) Object constructor
applyUpstreamUpdates ( boolean $updatedb = true, boolean $xoption = false ) : Workflow Apply upstream updates
cacheserverConnectionInfo ( ) : array Gives cacheserver connection info for this environment
changeConnectionMode ( string $value ) : Workflow | string Changes connection mode
clearCache ( ) : Workflow Clears an environment's cache
cloneDatabase ( string $from_env ) : Workflow Clones database from this environment to another
cloneFiles ( string $from_env ) : Workflow Clones files from this environment to another
commitChanges ( string $commit = null ) : array Commits changes to code
connectionInfo ( ) : array Gives connection info for this environment
convergeBindings ( ) : array Converges all bindings on a site
countDeployableCommits ( ) : integer Counts the number of deployable commits
dashboardUrl ( ) : string Provides Pantheon Dashboard URL for this environment
databaseConnectionInfo ( ) : array Gives database connection info for this environment
delete ( array $arg_options = [] ) : Workflow Delete a multidev environment
deploy ( array $params ) : Workflow Deploys the Test or Live environment
diffstat ( ) : array Gets diff from multidev environment
disableHttpsCertificate ( ) : array Remove a HTTPS certificate from the environment
domain ( ) : string Generate environment URL
getBackups ( ) : Backups
getBindings ( ) : Bindings
getCommits ( ) : Commits
getDomains ( ) : Domains
getDrushVersion ( ) : integer Gets the Drush version of this environment
getLock ( ) : Lock Returns the lock object associated with this environment
getName ( ) : string Returns the environment's name
getParentEnvironment ( ) : Environment Returns the parent environment
getSite ( ) : Site
getWorkflows ( ) : Workflows
gitConnectionInfo ( ) : array Gives Git connection info for this environment
hasDeployableCode ( ) : boolean Decides if the environment has changes to deploy
import ( string $url ) : Workflow Imports a site archive onto Pantheon
importDatabase ( string $url ) : Workflow Imports a database archive
importFiles ( string $url ) : Workflow Imports a file archive
initializeBindings ( ) : Workflow Initializes the test/live environments on a newly created site and clones content from previous environment (e.g. test clones dev content, live clones test content.)
isInitialized ( ) : boolean Have the environment's bindings have been initialized?
isMultidev ( ) : boolean Is this branch a multidev environment?
mergeFromDev ( array $options = [] ) : Workflow Merge code from the Dev Environment into this Multidev Environment
mergeToDev ( array $options = [] ) : Workflow Merge code from a multidev environment into the dev environment
sendCommandViaSsh ( string $command ) : string[] Sends a command to an environment via SSH.
serialize ( ) : array Formats environment object into an associative array for output
setHttpsCertificate ( array $certificate = [] ) Add/replace an HTTPS certificate on the environment
sftpConnectionInfo ( ) : array Gives SFTP connection info for this environment
wake ( ) : array "Wake" a site
wipe ( ) : Workflow Deletes all content (files and database) from the Environment

Protected Methods

Method Description
parseAttributes ( object $data ) : object Modify response data between fetch and assignment

Private Methods

Method Description
settings ( string $setting = null ) : mixed Retrieves the value of an environmental setting

Method Details

__construct() public method

Object constructor
public __construct ( object $attributes, array $options = [] )
$attributes object Attributes of this model
$options array Options with which to configure this model

applyUpstreamUpdates() public method

Apply upstream updates
public applyUpstreamUpdates ( boolean $updatedb = true, boolean $xoption = false ) : Workflow
$updatedb boolean True to run update.php
$xoption boolean True to automatically resolve merge conflicts
return Workflow

cacheserverConnectionInfo() public method

Gives cacheserver connection info for this environment
public cacheserverConnectionInfo ( ) : array
return array

changeConnectionMode() public method

Changes connection mode
public changeConnectionMode ( string $value ) : Workflow | string
$value string Connection mode, "git" or "sftp"
return Workflow | string

clearCache() public method

Clears an environment's cache
public clearCache ( ) : Workflow
return Workflow

cloneDatabase() public method

Clones database from this environment to another
public cloneDatabase ( string $from_env ) : Workflow
$from_env string Name of the environment to clone
return Workflow

cloneFiles() public method

Clones files from this environment to another
public cloneFiles ( string $from_env ) : Workflow
$from_env string Name of the environment to clone
return Workflow

commitChanges() public method

Commits changes to code
public commitChanges ( string $commit = null ) : array
$commit string Should be the commit message to use if committing on server changes
return array Response data

connectionInfo() public method

Gives connection info for this environment
public connectionInfo ( ) : array
return array

convergeBindings() public method

Converges all bindings on a site
public convergeBindings ( ) : array
return array

countDeployableCommits() public method

Counts the number of deployable commits
public countDeployableCommits ( ) : integer
return integer

dashboardUrl() public method

Provides Pantheon Dashboard URL for this environment
public dashboardUrl ( ) : string
return string

databaseConnectionInfo() public method

Gives database connection info for this environment
public databaseConnectionInfo ( ) : array
return array

delete() public method

Delete a multidev environment
public delete ( array $arg_options = [] ) : Workflow
$arg_options array Elements as follow: bool delete_branch True to delete branch
return Workflow

deploy() public method

Deploys the Test or Live environment
public deploy ( array $params ) : Workflow
$params array Parameters for the deploy workflow
return Workflow

diffstat() public method

Gets diff from multidev environment
public diffstat ( ) : array
return array

disableHttpsCertificate() public method

Remove a HTTPS certificate from the environment
public disableHttpsCertificate ( ) : array
return array $workflow

domain() public method

Generate environment URL
public domain ( ) : string
return string

getBackups() public method

public getBackups ( ) : Backups
return Pantheon\Terminus\Collections\Backups

getBindings() public method

public getBindings ( ) : Bindings
return Pantheon\Terminus\Collections\Bindings

getCommits() public method

public getCommits ( ) : Commits
return Pantheon\Terminus\Collections\Commits

getDomains() public method

public getDomains ( ) : Domains
return Pantheon\Terminus\Collections\Domains

getDrushVersion() public method

Gets the Drush version of this environment
public getDrushVersion ( ) : integer
return integer

getLock() public method

Returns the lock object associated with this environment
public getLock ( ) : Lock
return Lock

getName() public method

Returns the environment's name
public getName ( ) : string
return string

getParentEnvironment() public method

Returns the parent environment
public getParentEnvironment ( ) : Environment
return Environment

getSite() public method

public getSite ( ) : Site
return Site

getWorkflows() public method

public getWorkflows ( ) : Workflows
return Pantheon\Terminus\Collections\Workflows

gitConnectionInfo() public method

Gives Git connection info for this environment
public gitConnectionInfo ( ) : array
return array

hasDeployableCode() public method

Decides if the environment has changes to deploy
public hasDeployableCode ( ) : boolean
return boolean

import() public method

Imports a site archive onto Pantheon
public import ( string $url ) : Workflow
$url string URL of the archive to import
return Workflow

importDatabase() public method

Imports a database archive
public importDatabase ( string $url ) : Workflow
$url string URL to import data from
return Workflow

importFiles() public method

Imports a file archive
public importFiles ( string $url ) : Workflow
$url string URL to import data from
return Workflow

initializeBindings() public method

Initializes the test/live environments on a newly created site and clones content from previous environment (e.g. test clones dev content, live clones test content.)
public initializeBindings ( ) : Workflow
return Workflow In-progress workflow

isInitialized() public method

Have the environment's bindings have been initialized?
public isInitialized ( ) : boolean
return boolean True if environment has been instantiated

isMultidev() public method

Is this branch a multidev environment?
public isMultidev ( ) : boolean
return boolean True if ths environment is a multidev environment

mergeFromDev() public method

Merge code from the Dev Environment into this Multidev Environment
public mergeFromDev ( array $options = [] ) : Workflow
$options array Parameters to override defaults boolean updatedb True to update DB with merge
return Workflow

mergeToDev() public method

Merge code from a multidev environment into the dev environment
public mergeToDev ( array $options = [] ) : Workflow
$options array Parameters to override defaults string from_environment Name of the multidev environment to merge boolean updatedb True to update DB with merge
return Workflow

parseAttributes() protected method

Modify response data between fetch and assignment
protected parseAttributes ( object $data ) : object
$data object attributes received from API response
return object $data

sendCommandViaSsh() public method

Sends a command to an environment via SSH.
public sendCommandViaSsh ( string $command ) : string[]
$command string The command to be run on the platform
return string[] $response Elements as follow: string output The output from the command run string exit_code The status code returned by the command run

serialize() public method

Formats environment object into an associative array for output
public serialize ( ) : array
return array Associative array of data for output

setHttpsCertificate() public method

Add/replace an HTTPS certificate on the environment
public setHttpsCertificate ( array $certificate = [] )
$certificate array Certificate data elements as follow string cert Certificate string key RSA private key string intermediary CA intermediate certificate(s)

sftpConnectionInfo() public method

Gives SFTP connection info for this environment
public sftpConnectionInfo ( ) : array
return array

wake() public method

"Wake" a site
public wake ( ) : array
return array

wipe() public method

Deletes all content (files and database) from the Environment
public wipe ( ) : Workflow
return Workflow

Property Details

$backups public property

public Backups,Pantheon\Terminus\Collections $backups
return Pantheon\Terminus\Collections\Backups

$bindings public property

public Bindings,Pantheon\Terminus\Collections $bindings
return Pantheon\Terminus\Collections\Bindings

$commits public property

public Commits,Pantheon\Terminus\Collections $commits
return Pantheon\Terminus\Collections\Commits

$domains public property

public Domains,Pantheon\Terminus\Collections $domains
return Pantheon\Terminus\Collections\Domains

$lock protected property

protected Lock,Pantheon\Terminus\Models $lock
return Lock

$site public property

public Site,Pantheon\Terminus\Models $site
return Site

$workflows public property

public Workflows,Pantheon\Terminus\Collections $workflows
return Pantheon\Terminus\Collections\Workflows