PHP Class DNRoot

Inheritance: extends Controller, implements PermissionProvider, implements TemplateGlobalProvider
ファイルを表示 Open project: silverstripe/deploynaut Class Usage Examples

Protected Properties

Property Type Description
$_project_cache array
$data DNData

Public Methods

Method Description
AmbientMenu ( ) : ArrayList Get items for the ambient menu that should be accessible from all pages.
CanViewArchives ( Member $member = null ) : boolean | null Helper method to allow templates to know whether they should show the 'Archive List' include or not.
CompleteDataArchives ( ) : PaginatedList Returns a list of all archive files that can be accessed by the currently logged-in {@link Member}
CreateEnvironmentList ( ) : PaginatedList Returns a list of attempted environment creations.
DNData ( ) : DNData Get the DNData object.
DNProjectList ( ) : SS_List Provide a list of all projects.
DataTransferLogs ( ) : PaginatedList
DeployHistory ( ) : null | PaginatedList
Link ( ) : string
NavLink ( ) : string Return a link to the navigation template used for AJAX requests.
Navigation ( integer $limit = 5 ) : ArrayList Returns top level navigation of projects.
PendingDataArchives ( ) : PaginatedList
RedisUnavailable ( ) : string Returns an error message if redis is unavailable
RedisWorkersCount ( ) : integer Returns the number of connected Redis workers
UploadLimit ( ) : string Return the upload limit for snapshot uploads
abortDeploy ( SS_HTTPRequest $request ) : string
branch ( SS_HTTPRequest $request ) : SS_HTTPResponse
canCreateProjects ( $member = null ) : boolean Checks whether the user can create a project.
createenv ( SS_HTTPRequest $request ) : string Shows the creation log.
createenvlog ( SS_HTTPRequest $request )
createsnapshot ( SS_HTTPRequest $request ) : string Action
deletesnapshot ( SS_HTTPRequest $request ) : HTMLText View a form to delete a specific {@link DataArchive}.
deploy ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
deploySummary ( SS_HTTPRequest $request ) : string
deploylog ( SS_HTTPRequest $request ) : string
doCreateEnvironment ( array $data, Form $form ) : boolean | HTMLText | SS_HTTPResponse
doDataTransfer ( array $data, Form $form ) : SS_HTTPResponse
doDelete ( array $data, Form $form ) : boolean | SS_HTTPResponse
doMove ( array $data, Form $form ) : boolean | SS_HTTPResponse
doPostSnapshot ( array $data, Form $form ) : SS_HTTPResponse
doUploadSnapshot ( array $data, Form $form ) : boolean | HTMLText | SS_HTTPResponse
environment ( SS_HTTPRequest $request ) : SS_HTTPResponse
getCreateEnvironmentForm ( SS_HTTPRequest $request = null ) : Form
getCurrentActionType ( ) : string This will return a const that indicates the class of action currently being performed
getCurrentEnvironment ( DNProject $project = null ) : DNEnvironment | null
getCurrentProject ( ) : DNProject | null
getDataTransferForm ( SS_HTTPRequest $request = null ) : Form
getDataTransferRestoreForm ( SS_HTTPRequest $request, DNDataArchive $dataArchive = null ) : Form Note: Submits to the same action as {@link getDataTransferForm()}, but with a Direction=push and an archive reference.
getDeleteForm ( SS_HTTPRequest $request, DNDataArchive $dataArchive = null ) : Form
getDeployForm ( $request = null ) : Form Construct the deployment form
getMoveForm ( SS_HTTPRequest $request, DNDataArchive $dataArchive = null ) : Form | SS_HTTPResponse Build snapshot move form.
getPlatformSpecificStrings ( ) : ArrayList
getPostSnapshotForm ( SS_HTTPRequest $request ) : Form
getStarredProjects ( ) : SS_List Provide a list of all starred projects for the currently logged in member
getUploadSnapshotForm ( SS_HTTPRequest $request ) : Form Construct the upload form.
get_support_links ( ) : ArrayList
get_template_global_variables ( ) : array
gitRevisions ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
include_requirements ( ) Include requirements that deploynaut needs, such as javascript.
index ( SS_HTTPRequest $request ) : SS_HTTPResponse Actions
init ( )
movesnapshot ( SS_HTTPRequest $request ) : HTMLText View a form to move a specific {@link DataArchive}.
nav ( SS_HTTPRequest $request ) : HTMLText
postsnapshotsuccess ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
project ( SS_HTTPRequest $request ) : SS_HTTPResponse
projects ( SS_HTTPRequest $request ) : string Action
providePermissions ( ) : array
restoresnapshot ( SS_HTTPRequest $request ) : HTMLText View a form to restore a specific {@link DataArchive}.
sendResponse ( string $status, string $content ) : string
setCurrentActionType ( string $actionType ) Sets the current action type
snapshots ( SS_HTTPRequest $request ) : SS_HTTPResponse Action
snapshotslog ( SS_HTTPRequest $request ) : SS_HTTPResponse Action
startDeploy ( SS_HTTPRequest $request ) : SS_HTTPResponse Deployment form submission handler.
toggleprojectstar ( SS_HTTPRequest $request ) : SS_HTTPResponse This action will star / unstar a project for the current member
transfer ( SS_HTTPRequest $request ) : SS_HTTPResponse | string View into the log for a {@link DNDataTransfer}.
transferlog ( SS_HTTPRequest $request ) : string Action - Get the latest deploy log
uploadsnapshot ( SS_HTTPRequest $request ) : string Action

Protected Methods

Method Description
applyRedeploy ( SS_HTTPRequest $request, &$data )
environment404Response ( ) : SS_HTTPResponse
getCustomisedViewSection ( string $sectionName, string $title = '', $data = [] ) : SS_HTTPResponse
project404Response ( ) : SS_HTTPResponse
validateSnapshotMode ( string $mode ) Validate the snapshot mode

Method Details

AmbientMenu() public method

Get items for the ambient menu that should be accessible from all pages.
public AmbientMenu ( ) : ArrayList
return ArrayList

CanViewArchives() public method

The actual permissions are set on a per-environment level, so we need to find out if this $member can upload to or download from *any* {@link DNEnvironment} that (s)he has access to. TODO To be replaced with a method that just returns the list of archives this {@link Member} has access to.
public CanViewArchives ( Member $member = null ) : boolean | null
$member Member The {@link Member} to check (or null to check the currently logged in Member)
return boolean | null true if $member has access to upload or download to at least one {@link DNEnvironment}.

CompleteDataArchives() public method

Returns a list of all archive files that can be accessed by the currently logged-in {@link Member}
public CompleteDataArchives ( ) : PaginatedList
return PaginatedList

CreateEnvironmentList() public method

Returns a list of attempted environment creations.
public CreateEnvironmentList ( ) : PaginatedList
return PaginatedList

DNData() public method

Get the DNData object.
public DNData ( ) : DNData
return DNData

DNProjectList() public method

Provide a list of all projects.
public DNProjectList ( ) : SS_List
return SS_List

DataTransferLogs() public method

public DataTransferLogs ( ) : PaginatedList
return PaginatedList

DeployHistory() public method

Deprecation: 2.0.0 - moved to DeployDispatcher
public DeployHistory ( ) : null | PaginatedList
return null | PaginatedList

Navigation() public method

Returns top level navigation of projects.
public Navigation ( integer $limit = 5 ) : ArrayList
$limit integer
return ArrayList

PendingDataArchives() public method

public PendingDataArchives ( ) : PaginatedList
return PaginatedList The list of "pending" data archives which are waiting for a file to be delivered offline by post, and manually uploaded into the system.

RedisUnavailable() public static method

Returns an error message if redis is unavailable
public static RedisUnavailable ( ) : string
return string

RedisWorkersCount() public static method

Returns the number of connected Redis workers
public static RedisWorkersCount ( ) : integer
return integer

UploadLimit() public method

Return the upload limit for snapshot uploads
public UploadLimit ( ) : string
return string

abortDeploy() public method

Deprecation: 2.0.0 - moved to DeployDispatcher
public abortDeploy ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string

applyRedeploy() protected method

protected applyRedeploy ( SS_HTTPRequest $request, &$data )
$request SS_HTTPRequest

branch() public method

public branch ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

canCreateProjects() public method

Checks whether the user can create a project.
public canCreateProjects ( $member = null ) : boolean
return boolean

createenv() public method

Shows the creation log.
public createenv ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string

createenvlog() public method

public createenvlog ( SS_HTTPRequest $request )
$request SS_HTTPRequest

createsnapshot() public method

Action
public createsnapshot ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string - HTML

deletesnapshot() public method

Permission checks are handled in {@link DataArchives()}. Submissions are handled through {@link doDelete()}.
public deletesnapshot ( SS_HTTPRequest $request ) : HTMLText
$request SS_HTTPRequest
return HTMLText

deploy() public method

Deprecation: 2.0.0 - moved to DeployDispatcher Action - Do the actual deploy
public deploy ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
$request SS_HTTPRequest
return SS_HTTPResponse | string

deploySummary() public method

Deprecation: 2.0.0 - moved to DeployDispatcher
public deploySummary ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string

deploylog() public method

Deprecation: 2.0.0 - moved to DeployDispatcher Action - Get the latest deploy log
public deploylog ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string

doCreateEnvironment() public method

public doCreateEnvironment ( array $data, Form $form ) : boolean | HTMLText | SS_HTTPResponse
$data array
$form Form
return boolean | HTMLText | SS_HTTPResponse

doDataTransfer() public method

public doDataTransfer ( array $data, Form $form ) : SS_HTTPResponse
$data array
$form Form
return SS_HTTPResponse

doDelete() public method

public doDelete ( array $data, Form $form ) : boolean | SS_HTTPResponse
$data array
$form Form
return boolean | SS_HTTPResponse

doMove() public method

public doMove ( array $data, Form $form ) : boolean | SS_HTTPResponse
$data array
$form Form
return boolean | SS_HTTPResponse

doPostSnapshot() public method

public doPostSnapshot ( array $data, Form $form ) : SS_HTTPResponse
$data array
$form Form
return SS_HTTPResponse

doUploadSnapshot() public method

public doUploadSnapshot ( array $data, Form $form ) : boolean | HTMLText | SS_HTTPResponse
$data array
$form Form
return boolean | HTMLText | SS_HTTPResponse

environment() public method

public environment ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

environment404Response() protected method

protected environment404Response ( ) : SS_HTTPResponse
return SS_HTTPResponse

getCreateEnvironmentForm() public method

public getCreateEnvironmentForm ( SS_HTTPRequest $request = null ) : Form
$request SS_HTTPRequest
return Form

getCurrentActionType() public method

Until DNRoot is de-godded, it does a bunch of different actions all in the same class. So we just have each action handler calll setCurrentActionType to define what sort of action it is.
public getCurrentActionType ( ) : string
return string - one of the consts from self::$action_types

getCurrentEnvironment() public method

public getCurrentEnvironment ( DNProject $project = null ) : DNEnvironment | null
$project DNProject
return DNEnvironment | null

getCurrentProject() public method

public getCurrentProject ( ) : DNProject | null
return DNProject | null

getCustomisedViewSection() protected method

protected getCustomisedViewSection ( string $sectionName, string $title = '', $data = [] ) : SS_HTTPResponse
$sectionName string
$title string
return SS_HTTPResponse

getDataTransferForm() public method

public getDataTransferForm ( SS_HTTPRequest $request = null ) : Form
$request SS_HTTPRequest
return Form

getDataTransferRestoreForm() public method

Note: Submits to the same action as {@link getDataTransferForm()}, but with a Direction=push and an archive reference.
public getDataTransferRestoreForm ( SS_HTTPRequest $request, DNDataArchive $dataArchive = null ) : Form
$request SS_HTTPRequest
$dataArchive DNDataArchive Only set when method is called manually in {@link restore()}, otherwise the state is inferred from the request data.
return Form

getDeleteForm() public method

public getDeleteForm ( SS_HTTPRequest $request, DNDataArchive $dataArchive = null ) : Form
$request SS_HTTPRequest
$dataArchive DNDataArchive Only set when method is called manually, otherwise the state is inferred from the request data.
return Form

getDeployForm() public method

Construct the deployment form
Deprecation: 2.0.0 - moved to DeployDispatcher
public getDeployForm ( $request = null ) : Form
return Form

getMoveForm() public method

Build snapshot move form.
public getMoveForm ( SS_HTTPRequest $request, DNDataArchive $dataArchive = null ) : Form | SS_HTTPResponse
$request SS_HTTPRequest
$dataArchive DNDataArchive
return Form | SS_HTTPResponse

getPlatformSpecificStrings() public method

public getPlatformSpecificStrings ( ) : ArrayList
return ArrayList

getPostSnapshotForm() public method

public getPostSnapshotForm ( SS_HTTPRequest $request ) : Form
$request SS_HTTPRequest
return Form

getStarredProjects() public method

Provide a list of all starred projects for the currently logged in member
public getStarredProjects ( ) : SS_List
return SS_List

getUploadSnapshotForm() public method

Construct the upload form.
public getUploadSnapshotForm ( SS_HTTPRequest $request ) : Form
$request SS_HTTPRequest
return Form

get_template_global_variables() public static method

public static get_template_global_variables ( ) : array
return array

gitRevisions() public method

Deprecation: 2.0.0 - moved to GitDispatcher
public gitRevisions ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
$request SS_HTTPRequest
return SS_HTTPResponse | string

include_requirements() public static method

Include requirements that deploynaut needs, such as javascript.
public static include_requirements ( )

index() public method

Actions
public index ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

init() public method

public init ( )

movesnapshot() public method

View a form to move a specific {@link DataArchive}.
public movesnapshot ( SS_HTTPRequest $request ) : HTMLText
$request SS_HTTPRequest
return HTMLText

nav() public method

public nav ( SS_HTTPRequest $request ) : HTMLText
$request SS_HTTPRequest
return HTMLText

postsnapshotsuccess() public method

public postsnapshotsuccess ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
$request SS_HTTPRequest
return SS_HTTPResponse | string

project() public method

public project ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

project404Response() protected method

protected project404Response ( ) : SS_HTTPResponse
return SS_HTTPResponse

projects() public method

Action
public projects ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string - HTML

providePermissions() public method

public providePermissions ( ) : array
return array

restoresnapshot() public method

Permission checks are handled in {@link DataArchives()}. Submissions are handled through {@link doDataTransfer()}, same as backup operations.
public restoresnapshot ( SS_HTTPRequest $request ) : HTMLText
$request SS_HTTPRequest
return HTMLText

sendResponse() public method

public sendResponse ( string $status, string $content ) : string
$status string
$content string
return string

setCurrentActionType() public method

Sets the current action type
public setCurrentActionType ( string $actionType )
$actionType string string - one of the consts from self::$action_types

snapshots() public method

Action
public snapshots ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse - HTML

snapshotslog() public method

Action
public snapshotslog ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse - HTML

startDeploy() public method

Deployment form submission handler.
Deprecation: 2.0.0 - moved to DeployDispatcher Initiate a DNDeployment record and redirect to it for status polling
public startDeploy ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

toggleprojectstar() public method

This action will star / unstar a project for the current member
public toggleprojectstar ( SS_HTTPRequest $request ) : SS_HTTPResponse
$request SS_HTTPRequest
return SS_HTTPResponse

transfer() public method

View into the log for a {@link DNDataTransfer}.
public transfer ( SS_HTTPRequest $request ) : SS_HTTPResponse | string
$request SS_HTTPRequest
return SS_HTTPResponse | string

transferlog() public method

Action - Get the latest deploy log
public transferlog ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string

uploadsnapshot() public method

Action
public uploadsnapshot ( SS_HTTPRequest $request ) : string
$request SS_HTTPRequest
return string - HTML

validateSnapshotMode() protected method

Validate the snapshot mode
protected validateSnapshotMode ( string $mode )
$mode string

Property Details

$_project_cache protected_oe static_oe property

protected static array $_project_cache
return array

$data protected_oe property

protected DNData $data
return DNData