PHP Class DNEnvironment

This dataobject represents a target environment that source code can be deployed to. Permissions are controlled by environment, see the various many-many relationships.
Inheritance: extends DataObject
Afficher le fichier Open project: silverstripe/deploynaut Class Usage Examples

Méthodes publiques

Свойство Type Description
$db array
$has_many array
$has_one array
$many_many array
$searchable_fields array
$summary_fields array

Méthodes publiques

Méthode Description
Backend ( ) : DeploymentBackend Get the deployment backend used for this environment.
CurrentBuild ( ) : false | DNDeployment Get the current deployed build for this environment
CurrentMenu ( ) Return the current object from $this->Menu() Good for making titles and things
DNData ( ) : DNData
DeployHistory ( string $orderBy = '' ) : ArrayList A list of past deployments.
DeploymentsLink ( ) : string This provides the link to the deployments depending on whether the feature flag for the new deployment is enabled.
IsNewDeployEnabled ( ) : boolean Check if the new deployment form is enabled by whether the project has it, falling back to environment variables on whether it's enabled.
Link ( string $action = '' ) : string
Menu ( )
array_to_viewabledata ( array $array ) : object Helper function to convert a multi-dimensional array (associative or indexed) to an {@link ArrayList} or {@link ArrayData} object structure, so that values can be used in templates.
canBackup ( Member | null $member = null ) : boolean Allows only selected {@link Member} objects to backup this {@link DNEnvironment} to a {@link DNDataArchive} file.
canDeleteArchive ( Member | null $member = null ) : boolean Allows only selected {@link Member} objects to delete {@link DNDataArchive} objects from this {@link DNEnvironment}.
canDeploy ( Member | null $member = null ) : boolean Allow deploy only to some people.
canDownloadArchive ( Member | null $member = null ) : boolean Allows only selected {@link Member} objects to download {@link DNDataArchive} objects from this {@link DNEnvironment}.
canRestore ( Member | null $member = null ) : boolean Allows only selected {@link Member} objects to restore {@link DNDataArchive} objects into this {@link DNEnvironment}.
canUploadArchive ( Member | null $member = null ) : boolean Allows only selected {@link Member} objects to upload {@link DNDataArchive} objects linked to this {@link DNEnvironment}.
canView ( Member | null $member = null ) : boolean Environments are only viewable by people that can view the environment.
create_from_path ( string $path ) : DNEnvironment Used by the sync task
getArchiveDeletersList ( ) : string Get a string of groups/people that are allowed to delete {@link DNDataArchive} objects from this environment.
getArchiveDownloadersList ( ) : string Get a string of groups/people that are allowed to download {@link DNDataArchive} objects from this environment.
getArchiveUploadersList ( ) : string Get a string of groups/people that are allowed to upload {@link DNDataArchive} objects linked to this environment.
getBareDefaultURL ( )
getBareURL ( )
getCMSFields ( ) : FieldList
getCanBackupMembersList ( ) : string Get a string of groups/people that are allowed to backup {@link DNDataArchive} objects from this environment.
getCanRestoreMembersList ( ) : string Get a string of groups/people that are allowed to restore {@link DNDataArchive} objects into this environment.
getCannotDeployMessage ( ) : string Provide reason why the user cannot deploy.
getCommit ( string $sha ) : Gitonomy\Git\Commit This is a proxy call to gitonmy that caches the information per project and sha
getCommitMessage ( Gitonomy\Git\Commit $commit )
getCommitSubjectMessage ( Gitonomy\Git\Commit $commit )
getCommitTags ( Gitonomy\Git\Commit $commit )
getConfigFilename ( ) : string Returns the path to the ruby config file
getDefaultURL ( ) URL for the environment that can be used if no explicit URL is set.
getDeployStrategy ( SS_HTTPRequest $request ) : DeploymentStrategy
getDeployersList ( ) : string Get a string of groups/people that are allowed to deploy to this environment.
getFullName ( string $separator = ':' ) : string Return a name for this environment.
getSupportedOptions ( ) : ArrayList Return the supported options for this environment.
isCurrent ( ) : boolean Is this environment currently at the root level of the controller that handles it?
isSection ( ) : boolean Is this environment currently in a controller that is handling it or performing a sub-task?
onAfterDelete ( ) Delete any related config files
onAfterWrite ( )
onBeforeWrite ( )
runningDeployments ( ) : DataList Fetchs all deployments in progress. Limits to 1 hour to prevent deployments if an old deployment is stuck.

Méthodes protégées

Méthode Description
buildPermissionField ( string $groupField, string $memberField, array $groups, array $members ) : FieldGroup Build a set of multi-select fields for assigning permissions to a pair of group and member many_many relations
checkEnvironmentPath ( ) Ensure that environment paths are setup on the local filesystem
envFileExists ( ) : boolean
getCommitData ( string $sha ) : array
getEnvironmentConfig ( ) : string
setDeployConfigurationFields ( FieldList &$fields )
validate ( )
writeConfigFile ( ) Write the deployment config file to filesystem

Method Details

Backend() public méthode

Enforces compliance with the allowed_backends setting; if the DNEnvironment.BackendIdentifier value is illegal then that value is ignored.
public Backend ( ) : DeploymentBackend
Résultat DeploymentBackend

CurrentBuild() public méthode

Dear people of the future: If you are looking to optimize this, simply create a CurrentBuildSHA(), which can be a lot faster. I presume you came here because of the Project display template, which only needs a SHA.
public CurrentBuild ( ) : false | DNDeployment
Résultat false | DNDeployment

CurrentMenu() public méthode

Return the current object from $this->Menu() Good for making titles and things
public CurrentMenu ( )

DNData() public méthode

public DNData ( ) : DNData
Résultat DNData

DeployHistory() public méthode

A list of past deployments.
public DeployHistory ( string $orderBy = '' ) : ArrayList
$orderBy string - the name of a DB column to sort in descending order
Résultat ArrayList

IsNewDeployEnabled() public méthode

Check if the new deployment form is enabled by whether the project has it, falling back to environment variables on whether it's enabled.
public IsNewDeployEnabled ( ) : boolean
Résultat boolean

Menu() public méthode

public Menu ( )

array_to_viewabledata() public static méthode

Helper function to convert a multi-dimensional array (associative or indexed) to an {@link ArrayList} or {@link ArrayData} object structure, so that values can be used in templates.
public static array_to_viewabledata ( array $array ) : object
$array array The (single- or multi-dimensional) array to convert
Résultat object Either an {@link ArrayList} or {@link ArrayData} object, or the original item ($array) if $array isn't an array.

buildPermissionField() protected méthode

Build a set of multi-select fields for assigning permissions to a pair of group and member many_many relations
protected buildPermissionField ( string $groupField, string $memberField, array $groups, array $members ) : FieldGroup
$groupField string Group field name
$memberField string Member field name
$groups array List of groups
$members array List of members
Résultat FieldGroup

canBackup() public méthode

Allows only selected {@link Member} objects to backup this {@link DNEnvironment} to a {@link DNDataArchive} file.
public canBackup ( Member | null $member = null ) : boolean
$member Member | null The {@link Member} object to test against. If null, uses Member::currentMember();
Résultat boolean true if $member can backup, and false if they can't.

canDeleteArchive() public méthode

Allows only selected {@link Member} objects to delete {@link DNDataArchive} objects from this {@link DNEnvironment}.
public canDeleteArchive ( Member | null $member = null ) : boolean
$member Member | null The {@link Member} object to test against. If null, uses Member::currentMember();
Résultat boolean true if $member can delete archives from this environment, false if they can't.

canDeploy() public méthode

Allow deploy only to some people.
public canDeploy ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

canDownloadArchive() public méthode

Allows only selected {@link Member} objects to download {@link DNDataArchive} objects from this {@link DNEnvironment}.
public canDownloadArchive ( Member | null $member = null ) : boolean
$member Member | null The {@link Member} object to test against. If null, uses Member::currentMember();
Résultat boolean true if $member can download archives from this environment, false if they can't.

canRestore() public méthode

Allows only selected {@link Member} objects to restore {@link DNDataArchive} objects into this {@link DNEnvironment}.
public canRestore ( Member | null $member = null ) : boolean
$member Member | null The {@link Member} object to test against. If null, uses Member::currentMember();
Résultat boolean true if $member can restore, and false if they can't.

canUploadArchive() public méthode

Note: This is not uploading them to the actual environment itself (e.g. uploading to the live site) - it is the process of uploading a *.sspak file into Deploynaut for later 'restoring' to an environment. See {@link self::canRestore()}.
public canUploadArchive ( Member | null $member = null ) : boolean
$member Member | null The {@link Member} object to test against. If null, uses Member::currentMember();
Résultat boolean true if $member can upload archives linked to this environment, false if they can't.

canView() public méthode

Environments are only viewable by people that can view the environment.
public canView ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

checkEnvironmentPath() protected méthode

Ensure that environment paths are setup on the local filesystem
protected checkEnvironmentPath ( )

create_from_path() public static méthode

Used by the sync task
public static create_from_path ( string $path ) : DNEnvironment
$path string
Résultat DNEnvironment

envFileExists() protected méthode

protected envFileExists ( ) : boolean
Résultat boolean

getArchiveDeletersList() public méthode

Get a string of groups/people that are allowed to delete {@link DNDataArchive} objects from this environment.
public getArchiveDeletersList ( ) : string
Résultat string

getArchiveDownloadersList() public méthode

Get a string of groups/people that are allowed to download {@link DNDataArchive} objects from this environment.
public getArchiveDownloadersList ( ) : string
Résultat string

getArchiveUploadersList() public méthode

Get a string of groups/people that are allowed to upload {@link DNDataArchive} objects linked to this environment.
public getArchiveUploadersList ( ) : string
Résultat string

getBareDefaultURL() public méthode

public getBareDefaultURL ( )

getBareURL() public méthode

public getBareURL ( )

getCMSFields() public méthode

public getCMSFields ( ) : FieldList
Résultat FieldList

getCanBackupMembersList() public méthode

Get a string of groups/people that are allowed to backup {@link DNDataArchive} objects from this environment.
public getCanBackupMembersList ( ) : string
Résultat string

getCanRestoreMembersList() public méthode

Get a string of groups/people that are allowed to restore {@link DNDataArchive} objects into this environment.
public getCanRestoreMembersList ( ) : string
Résultat string

getCannotDeployMessage() public méthode

Provide reason why the user cannot deploy.
public getCannotDeployMessage ( ) : string
Résultat string

getCommit() public méthode

This is a proxy call to gitonmy that caches the information per project and sha
public getCommit ( string $sha ) : Gitonomy\Git\Commit
$sha string
Résultat Gitonomy\Git\Commit

getCommitData() protected méthode

protected getCommitData ( string $sha ) : array
$sha string
Résultat array

getCommitMessage() public méthode

public getCommitMessage ( Gitonomy\Git\Commit $commit )
$commit Gitonomy\Git\Commit

getCommitSubjectMessage() public méthode

public getCommitSubjectMessage ( Gitonomy\Git\Commit $commit )
$commit Gitonomy\Git\Commit

getCommitTags() public méthode

public getCommitTags ( Gitonomy\Git\Commit $commit )
$commit Gitonomy\Git\Commit

getConfigFilename() public méthode

Returns the path to the ruby config file
public getConfigFilename ( ) : string
Résultat string

getDefaultURL() public méthode

URL for the environment that can be used if no explicit URL is set.
public getDefaultURL ( )

getDeployStrategy() public méthode

public getDeployStrategy ( SS_HTTPRequest $request ) : DeploymentStrategy
$request SS_HTTPRequest
Résultat DeploymentStrategy

getDeployersList() public méthode

Used in DNRoot_project.ss to list {@link Member}s who have permission to perform this action.
public getDeployersList ( ) : string
Résultat string

getEnvironmentConfig() protected méthode

protected getEnvironmentConfig ( ) : string
Résultat string

getFullName() public méthode

Return a name for this environment.
public getFullName ( string $separator = ':' ) : string
$separator string The string used when concatenating project with env name
Résultat string

getSupportedOptions() public méthode

Return the supported options for this environment.
public getSupportedOptions ( ) : ArrayList
Résultat ArrayList

isCurrent() public méthode

Is this environment currently at the root level of the controller that handles it?
public isCurrent ( ) : boolean
Résultat boolean

isSection() public méthode

Is this environment currently in a controller that is handling it or performing a sub-task?
public isSection ( ) : boolean
Résultat boolean

onAfterDelete() public méthode

Delete any related config files
public onAfterDelete ( )

onAfterWrite() public méthode

public onAfterWrite ( )

onBeforeWrite() public méthode

public onBeforeWrite ( )

runningDeployments() public méthode

Fetchs all deployments in progress. Limits to 1 hour to prevent deployments if an old deployment is stuck.
public runningDeployments ( ) : DataList
Résultat DataList

setDeployConfigurationFields() protected méthode

protected setDeployConfigurationFields ( FieldList &$fields )
$fields FieldList

validate() protected méthode

protected validate ( )

writeConfigFile() protected méthode

Write the deployment config file to filesystem
protected writeConfigFile ( )

Property Details

$db public_oe static_oe property

public static array $db
Résultat array

$has_many public_oe static_oe property

public static array $has_many
Résultat array

$has_one public_oe static_oe property

public static array $has_one
Résultat array

$many_many public_oe static_oe property

public static array $many_many
Résultat array

$searchable_fields public_oe static_oe property

public static array $searchable_fields
Résultat array

$summary_fields public_oe static_oe property

public static array $summary_fields
Résultat array