PHP Class DNProject

Inheritance: extends DataObject
Afficher le fichier Open project: silverstripe/deploynaut Class Usage Examples

Protected Properties

Свойство Type Description
$_current_member_cache boolean | Member
$relation_cache array In-memory cache for currentBuilds per environment since fetching them from disk is pretty resource hungry.

Méthodes publiques

Méthode Description
APILink ( string $action ) : string
CreateEnvironmentLink ( ) : string | null
CurrentMenu ( ) : DataObject Return the current object from $this->Menu() Good for making titles and things
DNBranchList ( ) : DNBranchList Provides a list of the branches in this project.
DNBuildList ( ) : DNReferenceList Provides a DNBuildList of builds found in this project.
DNData ( ) : DNData
DNEnvironmentList ( ) : ArrayList Provides a list of environments found in this project.
DNTagList ( ) : DNReferenceList Provides a list of the tags in this project.
DataArchives ( ) : DataList
DiskQuotaUsagePercent ( ) : integer Returns the current disk quota usage as a percentage
EnvironmentsByUsage ( string $usage ) : ArrayList
HasDiskQuota ( ) : boolean Is there a disk quota set for this project?
HasExceededDiskQuota ( ) : boolean Has the disk quota been exceeded?
IsStarred ( ) : boolean
Link ( $action = '' ) : string
Menu ( ) : ArrayList Get the menu to be shown on projects
PendingManualUploadDataArchives ( ) : DataList Return all archives which are "manual upload requests", meaning they don't have a file attached to them (yet).
ToggleStarLink ( ) : string
allowed ( string $code, Member | null $member = null ) : boolean Convenience wrapper for a single permission code.
allowedAny ( array | string $codes, Member | null $member = null ) : boolean Check if member has a permission code in this project.
canBackup ( Member | null $member = null ) : boolean
canCreate ( Member $member = null ) : boolean
canCreateEnvironments ( Member | null $member = null ) : boolean This is a permission check for the front-end only.
canDownloadArchive ( Member | null $member = null ) : boolean
canRestore ( Member | null $member = null ) : boolean
canUploadArchive ( Member | null $member = null ) : boolean
canView ( Member | null $member = null ) : boolean Restrict access to viewing this project
clearGitCache ( ) This will clear the cache for the git getters and should be called when the local git repo is updated
cloneRepo ( ) : string Setup a job to clone a git repository.
create_from_path ( string $path ) : DNProject Used by the sync task
currentBuilds ( ) : false | DNDeployment Returns a map of envrionment name to build name
getCMSFields ( ) : FieldList
getCommit ( string $sha ) : false | Gitonomy\Git\Commit This is a proxy call to gitonmy that caches the information per project and sha
getCommitMessage ( Gitonomy\Git\Commit $commit ) : string
getCommitSubjectMessage ( Gitonomy\Git\Commit $commit ) : string get the commit "subject", getCommitMessage get the full message
getCommitTags ( Gitonomy\Git\Commit $commit ) : mixed
getCompleteInitialEnvironmentCreations ( ) : DataList Returns a list of completed initial environment creations. This includes failed tasks.
getDiskQuotaMB ( ) : string | integer Getter for DiskQuotaMB field to provide a default for existing records that have no quota field set, as it will need to default to a globally set size.
getInitialEnvironmentCreations ( ) : DataList Returns a list of initial environments created for this project.
getKeyDir ( ) : string | null Returns the location of the projects key dir if one exists.
getLocalCVSPath ( ) : string
getPrivateKeyPath ( ) : string | null This returns that path of the private key if a key directory is set. It doesn't check whether the file exists.
getProcessEnv ( ) : array Build an environment variable array to be used with this project.
getPublicKey ( ) : string | void Fetch the public key for this project.
getPublicKeyPath ( ) : string | null This returns that path of the public key if a key directory is set. It doesn't check whether the file exists.
getRepository ( ) : false | Gitonomy\Git\Repository
getRepositoryInterface ( ) : ArrayData Get a ViewableData structure describing the UI tool that lets the user view the repository code
getRepositoryURL ( ) : void | string Provide current repository URL to the users.
getRunningEnvironmentCreations ( ) : SS_List Returns a list of environments still being created.
getRunningInitialEnvironmentCreations ( ) : DataList Only returns initial environments that are being created.
getUsedQuotaMB ( integer $round = 2 ) : double Return the used quota in MB.
getViewersList ( ) : string Get a string of people allowed to view this project
get_git_cache ( ) : Zend_Cache_Frontend_Output
groupAllowed ( string $permissionCode, Group $group ) : boolean Checks if a group is allowed to the project and the permission code
isCurrent ( ) : boolean Is this project currently at the root level of the controller that handles it?
isProjectReady ( ) : boolean Checks if the environment has been fully built.
isSection ( ) : boolean Is this project currently in a controller that is handling it or performing a sub-task?
onAfterDelete ( ) Delete related environments and folders
onAfterWrite ( )
onBeforeWrite ( )
projectFolderExists ( ) : boolean
repoExists ( ) : boolean
resolveRevision ( $value ) : boolean | string Resolve a git reference like a branch or tag into a SHA.
setCreateProjectFolderField ( FieldList &$fields ) If there isn't a capistrano env project folder, show options to create one
whoIsAllowed ( string $code ) : SS_List Convenience wrapper for a single permission code.
whoIsAllowedAny ( array | string $codes ) : SS_List List members who have $codes on this project.

Méthodes protégées

Méthode Description
getProjectFolderPath ( ) : string
setEnvironmentFields ( FieldList &$fields, GridField $environments ) Setup a gridfield for the environment configs
validate ( ) : ValidationResult

Method Details

CurrentMenu() public méthode

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

DNBranchList() public méthode

Provides a list of the branches in this project.
public DNBranchList ( ) : DNBranchList
Résultat DNBranchList

DNBuildList() public méthode

Provides a DNBuildList of builds found in this project.
public DNBuildList ( ) : DNReferenceList
Résultat DNReferenceList

DNData() public méthode

public DNData ( ) : DNData
Résultat DNData

DNEnvironmentList() public méthode

CAUTION: filterByCallback will change this into an ArrayList!
public DNEnvironmentList ( ) : ArrayList
Résultat ArrayList

DNTagList() public méthode

Provides a list of the tags in this project.
public DNTagList ( ) : DNReferenceList
Résultat DNReferenceList

DataArchives() public méthode

public DataArchives ( ) : DataList
Résultat DataList

DiskQuotaUsagePercent() public méthode

Returns the current disk quota usage as a percentage
public DiskQuotaUsagePercent ( ) : integer
Résultat integer

EnvironmentsByUsage() public méthode

public EnvironmentsByUsage ( string $usage ) : ArrayList
$usage string
Résultat ArrayList

HasDiskQuota() public méthode

Is there a disk quota set for this project?
public HasDiskQuota ( ) : boolean
Résultat boolean

HasExceededDiskQuota() public méthode

Has the disk quota been exceeded?
public HasExceededDiskQuota ( ) : boolean
Résultat boolean

IsStarred() public méthode

public IsStarred ( ) : boolean
Résultat boolean

Menu() public méthode

Get the menu to be shown on projects
public Menu ( ) : ArrayList
Résultat ArrayList

PendingManualUploadDataArchives() public méthode

Return all archives which are "manual upload requests", meaning they don't have a file attached to them (yet).
public PendingManualUploadDataArchives ( ) : DataList
Résultat DataList

allowed() public méthode

Convenience wrapper for a single permission code.
public allowed ( string $code, Member | null $member = null ) : boolean
$code string
$member Member | null
Résultat boolean

allowedAny() public méthode

Check if member has a permission code in this project.
public allowedAny ( array | string $codes, Member | null $member = null ) : boolean
$codes array | string
$member Member | null
Résultat boolean

canBackup() public méthode

public canBackup ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

canCreate() public méthode

public canCreate ( Member $member = null ) : boolean
$member Member
Résultat boolean

canCreateEnvironments() public méthode

Only admins can create environments for now. Also, we need to check the value of AllowedEnvironmentType which dictates which backend to use to render the form.
public canCreateEnvironments ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

canDownloadArchive() public méthode

public canDownloadArchive ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

canRestore() public méthode

public canRestore ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

canUploadArchive() public méthode

public canUploadArchive ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

canView() public méthode

Restrict access to viewing this project
public canView ( Member | null $member = null ) : boolean
$member Member | null
Résultat boolean

clearGitCache() public méthode

This will clear the cache for the git getters and should be called when the local git repo is updated
public clearGitCache ( )

cloneRepo() public méthode

Setup a job to clone a git repository.
public cloneRepo ( ) : string
Résultat string resque token

create_from_path() public static méthode

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

currentBuilds() public méthode

Returns a map of envrionment name to build name
public currentBuilds ( ) : false | DNDeployment
Résultat false | DNDeployment

getCMSFields() public méthode

public getCMSFields ( ) : FieldList
Résultat FieldList

getCommit() public méthode

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

getCommitMessage() public méthode

public getCommitMessage ( Gitonomy\Git\Commit $commit ) : string
$commit Gitonomy\Git\Commit
Résultat string

getCommitSubjectMessage() public méthode

get the commit "subject", getCommitMessage get the full message
public getCommitSubjectMessage ( Gitonomy\Git\Commit $commit ) : string
$commit Gitonomy\Git\Commit
Résultat string

getCommitTags() public méthode

public getCommitTags ( Gitonomy\Git\Commit $commit ) : mixed
$commit Gitonomy\Git\Commit
Résultat mixed

getCompleteInitialEnvironmentCreations() public méthode

Returns a list of completed initial environment creations. This includes failed tasks.
public getCompleteInitialEnvironmentCreations ( ) : DataList
Résultat DataList

getDiskQuotaMB() public méthode

Getter for DiskQuotaMB field to provide a default for existing records that have no quota field set, as it will need to default to a globally set size.
public getDiskQuotaMB ( ) : string | integer
Résultat string | integer The quota size in MB

getInitialEnvironmentCreations() public méthode

Returns a list of initial environments created for this project.
public getInitialEnvironmentCreations ( ) : DataList
Résultat DataList

getKeyDir() public méthode

Returns the location of the projects key dir if one exists.
public getKeyDir ( ) : string | null
Résultat string | null

getLocalCVSPath() public méthode

public getLocalCVSPath ( ) : string
Résultat string

getPrivateKeyPath() public méthode

This returns that path of the private key if a key directory is set. It doesn't check whether the file exists.
public getPrivateKeyPath ( ) : string | null
Résultat string | null

getProcessEnv() public méthode

This is relevant if every project needs to use an individual SSH pubkey. Include this with all Gitonomy\Git\Repository, and \Symfony\Component\Process\Processes.
public getProcessEnv ( ) : array
Résultat array

getProjectFolderPath() protected méthode

protected getProjectFolderPath ( ) : string
Résultat string

getPublicKey() public méthode

Fetch the public key for this project.
public getPublicKey ( ) : string | void
Résultat string | void

getPublicKeyPath() public méthode

This returns that path of the public key if a key directory is set. It doesn't check whether the file exists.
public getPublicKeyPath ( ) : string | null
Résultat string | null

getRepository() public méthode

public getRepository ( ) : false | Gitonomy\Git\Repository
Résultat false | Gitonomy\Git\Repository

getRepositoryInterface() public méthode

Get a ViewableData structure describing the UI tool that lets the user view the repository code
public getRepositoryInterface ( ) : ArrayData
Résultat ArrayData

getRepositoryURL() public méthode

Provide current repository URL to the users.
public getRepositoryURL ( ) : void | string
Résultat void | string

getRunningEnvironmentCreations() public méthode

Returns a list of environments still being created.
public getRunningEnvironmentCreations ( ) : SS_List
Résultat SS_List

getRunningInitialEnvironmentCreations() public méthode

Only returns initial environments that are being created.
public getRunningInitialEnvironmentCreations ( ) : DataList
Résultat DataList

getUsedQuotaMB() public méthode

Return the used quota in MB.
public getUsedQuotaMB ( integer $round = 2 ) : double
$round integer Number of decimal places to round to
Résultat double The used quota size in MB

getViewersList() public méthode

Get a string of people allowed to view this project
public getViewersList ( ) : string
Résultat string

get_git_cache() public static méthode

public static get_git_cache ( ) : Zend_Cache_Frontend_Output
Résultat Zend_Cache_Frontend_Output

groupAllowed() public méthode

Checks if a group is allowed to the project and the permission code
public groupAllowed ( string $permissionCode, Group $group ) : boolean
$permissionCode string
$group Group
Résultat boolean

isCurrent() public méthode

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

isProjectReady() public méthode

Checks if the environment has been fully built.
public isProjectReady ( ) : boolean
Résultat boolean

isSection() public méthode

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

onAfterDelete() public méthode

Delete related environments and folders
public onAfterDelete ( )

onAfterWrite() public méthode

public onAfterWrite ( )

onBeforeWrite() public méthode

public onBeforeWrite ( )

projectFolderExists() public méthode

public projectFolderExists ( ) : boolean
Résultat boolean

repoExists() public méthode

public repoExists ( ) : boolean
Résultat boolean

resolveRevision() public méthode

Resolve a git reference like a branch or tag into a SHA.
public resolveRevision ( $value ) : boolean | string
Résultat boolean | string

setCreateProjectFolderField() public méthode

If there isn't a capistrano env project folder, show options to create one
public setCreateProjectFolderField ( FieldList &$fields )
$fields FieldList

setEnvironmentFields() protected méthode

Setup a gridfield for the environment configs
protected setEnvironmentFields ( FieldList &$fields, GridField $environments )
$fields FieldList
$environments GridField

validate() protected méthode

protected validate ( ) : ValidationResult
Résultat ValidationResult

whoIsAllowed() public méthode

Convenience wrapper for a single permission code.
public whoIsAllowed ( string $code ) : SS_List
$code string
Résultat SS_List

whoIsAllowedAny() public méthode

Does not support Permission::DENY_PERMISSION malarky, same as Permission::get_groups_by_permission anyway...
public whoIsAllowedAny ( array | string $codes ) : SS_List
$codes array | string
Résultat SS_List

Property Details

$_current_member_cache protected_oe static_oe property

protected static bool|Member $_current_member_cache
Résultat boolean | Member

$relation_cache protected_oe static_oe property

In-memory cache for currentBuilds per environment since fetching them from disk is pretty resource hungry.
protected static array $relation_cache
Résultat array