TYPO3\Surf\Application\BaseApplication

class BaseApplication

A base application with Git checkout and basic release directory structure

Most specific applications will extend from BaseApplication.

constant DEFAULT_SHARED_DIR

default directory name for shared directory

protected array

Symlinks, which should be created for each release.

property directories

protected array

Directories which should be created on deployment. E.g. shared folders.

property options

protected array

Basic application specific options

packageMethod: How to prepare the application assets (code and files) locally before transfer

“git” Make a local git checkout and transfer files to the server none Default, do not prepare anything locally

transferMethod: How to transfer the application assets to a node

“git” Make a checkout of the application assets remotely on the node

updateMethod: How to prepare and update the application assets on the node after transfer

lockDeployment: Locked deployments can only run once at a time

property name

protected string

The name

property nodes

protected array

The nodes for this application

property deploymentPath

protected string

The deployment path for this application on a node

property releasesDirectory

protected string

The relative releases directory for this application on a node

registerTasks(Workflow $workflow, Deployment $deployment)

Register tasks for the base application

The base application performs the following tasks:

Initialize stage: - Create directories for release structure

Update stage: - Perform Git checkout (and pass on sha1 / tag or branch option from application to the task)

Switch stage: - Symlink the current and previous release

Cleanup stage: - Clean up old releases

Parameters:

Override all symlinks to be created with the given array of symlinks.

Parameters:
  • $symlinks (array) –
Returns:

TYPO3SurfApplicationBaseApplication

Get all symlinks to be created for the application

Returns:array

Register an additional symlink to be created for the application

Parameters:
  • $linkPath (string) – The link to create
  • $sourcePath (string) – The file/directory where the link should point to
Returns:

TYPO3SurfApplicationBaseApplication

Register an array of additional symlinks to be created for the application

Parameters:
  • $symlinks (array) –
Returns:

TYPO3SurfApplicationBaseApplication

setDirectories($directories)

Override all directories to be created for the application

Parameters:
  • $directories (array) –
Returns:

TYPO3SurfApplicationBaseApplication

getDirectories()

Get directories to be created for the application

Returns:array
addDirectory($path)

Register an additional directory to be created for the application

Parameters:
  • $path (string) –
Returns:

TYPO3SurfApplicationBaseApplication

addDirectories($directories)

Register an array of additional directories to be created for the application

Parameters:
  • $directories (array) –
Returns:

TYPO3SurfApplicationBaseApplication

registerTasksForPackageMethod(Workflow $workflow, $packageMethod)
Parameters:
  • $workflow (Workflow) –
  • $packageMethod (string) –
registerTasksForTransferMethod(Workflow $workflow, $transferMethod)
Parameters:
  • $workflow (Workflow) –
  • $transferMethod (string) –
registerTasksForUpdateMethod(Workflow $workflow, $updateMethod)
Parameters:
  • $workflow (Workflow) –
  • $updateMethod (string) –
__construct($name)

Constructor

Parameters:
  • $name (string) –
getName()

Get the application name

Returns:string
setName($name)

Sets the application name

Parameters:
  • $name (string) –
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining

getNodes()

Get the nodes where this application should be deployed

Returns:Node[] The application nodes
setNodes($nodes)

Set the nodes where this application should be deployed

Parameters:
  • $nodes (array) – The application nodes
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining

addNode(Node $node)

Add a node where this application should be deployed

Parameters:
  • $node (Node) – The node to add
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining

hasNode(Node $node)

Return TRUE if the given node is registered for this application

Parameters:
  • $node (Node) – The node to test
Returns:

bool TRUE if the node is registered for this application

getDeploymentPath()

Get the deployment path for this application

This is the path for an application pointing to the root of the Surf deployment:

[deploymentPath] |– $this->getReleasesDirectory() |– cache |– shared

Returns:string The deployment path
getSharedPath()

Get the path for shared resources for this application

This path defaults to a directory “shared” below the deployment path.

Returns:string The shared resources path
getSharedDirectory()

Returns the shared directory

takes directory name from option “sharedDirectory” if option is not set or empty constant DEFAULT_SHARED_DIR “shared” is used

Returns:string
setDeploymentPath($deploymentPath)

Sets the deployment path

Parameters:
  • $deploymentPath (string) – The deployment path
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining

getReleasesDirectory()

Returns the releases directory

Returns:string $releasesDirectory
setReleasesDirectory($releasesDirectory)

Sets the releases directory

Parameters:
  • $releasesDirectory (string) –
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining

getReleasesPath()

Returns path to the directory with releases

Returns:string Path to the releases directory
getOptions()

Get all options defined on this application instance

The options will include the deploymentPath and sharedPath for unified option handling.

Returns:array An array of options indexed by option key
getOption($key)

Get an option defined on this application instance

Parameters:
  • $key (string) –
Returns:

mixed

hasOption($key)

Test if an option was set for this application

Parameters:
  • $key (string) – The option key
Returns:

bool TRUE If the option was set

setOptions($options)

Sets all options for this application instance

Parameters:
  • $options (array) – The options to set indexed by option key
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining

setOption($key, $value)

Set an option for this application instance

Parameters:
  • $key (string) – The option key
  • $value (mixed) – The option value
Returns:

TYPO3SurfDomainModelApplication The current instance for chaining