PHP 클래스 yii2tech\selfupdate\SelfUpdateController

You can configure available version control systems via [[versionControlSystems]]. Note: in order to work properly this command requires execution of VCS command without any prompt or user input. Usage: 1. Create a configuration file using the config action: yii self-update/config @app/config/selfupdate.php 2. Edit the created config file, adjusting it for your project needs. 3. Run the 'perform' action, using created config: yii self-update @app/config/selfupdate.php
부터: 1.0
저자: Paul Klimov ([email protected])
상속: extends yii\console\Controller
파일 보기 프로젝트 열기: yii2tech/selfupdate

공개 프로퍼티들

프로퍼티 타입 설명
$afterUpdateCommands list of shell commands, which should be executed after project update. If command is a string it will be executed as shell command, otherwise as PHP callback. For example: php [ 'php /path/to/project/yii migrate/up --interactive=0' ],
$beforeUpdateCommands list of commands, which should be executed before project update begins. If command is a string it will be executed as shell command, otherwise as PHP callback. For example: php [ 'mysqldump -h localhost -u root myproject > /path/to/backup/myproject.sql' ],
$cache list of cache application components, for which [[Cache::flush()]] method should be invoked. Component ids, instances or array configurations can be used here.
$composerBinPath path to the 'composer' bin command. By default simple 'composer' is used, assuming it available as global shell command. Path alias can be used here. For example: '@app/composer.phar'.
$composerOptions composer command options.
$composerRootPaths list of composer install root paths (the ones containing 'composer.json'). Path aliases can be used here.
$configFile configuration file name. Settings from this file will be merged with the default ones. Such configuration file can be created, using action 'config'. Path alias can be used here, for example: '@app/config/self-update.php'.
$defaultAction controller default action ID.
$emails list of email addresses, which should be used to send execution reports.
$mailer the mailer object or the application component ID of the mailer. It will be used to send notification messages to [[emails]]. If not set or sending email via this component fails, the fallback to the plain PHP mail() function will be used instead.
$mutex the mutex object or the application component ID of the mutex. After the controller object is created, if you want to change this property, you should only assign it with a mutex connection object.
$projectRootPath path to project root directory, which means VCS root directory. Path aliases can be use here.
$shellResponseErrorKeywords list of keywords, which presence in the shell command output is considered as its execution error.
$tmpDirectories list of temporary directories, which should be cleared after project update. Path aliases can be used here. For example: php [ '@app/web/assets', '@runtime/URI', '@runtime/HTML', '@runtime/debug', ]
$versionControlSystems list of possible version control systems (VCS) in format: vcsFolderName => classConfig. VCS will be detected automatically based on which folder is available inside [[projectRootPath]]
$webPaths project web path stubs configuration. Each path configuration should have following keys: - 'path' - string - path to web root folder - 'link' - string - path for the symbolic link, which should point to the web root - 'stub' - string - path to folder, which contains stub for the web Yii aliases can be used for all these keys. For example: php [ [ 'path' => '@app/web', 'link' => '@app/httpdocs', 'stub' => '@app/webstub', ] ]

공개 메소드들

메소드 설명
actionConfig ( string $fileName ) : integer Creates a configuration file for the "perform" command.
actionPerform ( string | null $configFile = null ) : integer Performs project update from VCS.
getCurrentDate ( ) : string
getHostName ( ) : string
getReportFrom ( ) : string
setHostName ( string $hostName )
setReportFrom ( string $reportFrom )

보호된 메소드들

메소드 설명
acquireMutex ( ) : boolean Acquires current action lock.
clearDirectory ( string $dir ) Clears specified directory.
clearTmpDirectories ( ) Clears all directories specified via [[tmpDirectories]].
composeMutexName ( ) : string Composes the mutex name.
detectVersionControlSystem ( string $path ) : yii2tech\selfupdate\VersionControlSystemInterface Detects version control system used for the project.
execShellCommand ( string $command, array $placeholders = [] ) : string Executes shell command.
executeCommands ( array $commands ) Executes list of given commands.
flushCache ( ) Flushes cache for all components specified at [[cache]].
flushLog ( ) : array Flushes log lines, returning them.
linkWebPaths ( ) Links web roots to the actual web directories.
linkWebStubs ( ) Links web roots to the stub directories.
log ( string $message ) Logs the message
normalizeWebPaths ( ) Normalizes [[webPaths]] value.
releaseMutex ( ) : boolean Release current action lock.
reportFail ( ) Sends report about failure.
reportResult ( string $subjectPrefix ) Sends execution report.
reportSuccess ( ) Sends report about success.
sendEmail ( string $from, string $email, string $subject, string $message ) : boolean Sends an email.
sendEmailFallback ( string $from, string $email, string $subject, string $message ) : boolean Sends an email via plain PHP mail() function.
updateVendor ( ) Performs vendors update via Composer at all [[composerRootPaths]].

메소드 상세

acquireMutex() 보호된 메소드

Acquires current action lock.
protected acquireMutex ( ) : boolean
리턴 boolean lock acquiring result.

actionConfig() 공개 메소드

The generated configuration file contains detailed instructions on how to customize it to fit for your needs. After customization, you may use this configuration file with the "perform" command.
public actionConfig ( string $fileName ) : integer
$fileName string output file name or alias.
리턴 integer CLI exit code

actionPerform() 공개 메소드

Performs project update from VCS.
public actionPerform ( string | null $configFile = null ) : integer
$configFile string | null the path or alias of the configuration file. You may use the "config" command to generate this file and then customize it for your needs.
리턴 integer CLI exit code

clearDirectory() 보호된 메소드

Clears specified directory.
protected clearDirectory ( string $dir )
$dir string directory to be cleared.

clearTmpDirectories() 보호된 메소드

Clears all directories specified via [[tmpDirectories]].
protected clearTmpDirectories ( )

composeMutexName() 보호된 메소드

Composes the mutex name.
protected composeMutexName ( ) : string
리턴 string mutex name.

detectVersionControlSystem() 보호된 메소드

Detects version control system used for the project.
protected detectVersionControlSystem ( string $path ) : yii2tech\selfupdate\VersionControlSystemInterface
$path string project root path.
리턴 yii2tech\selfupdate\VersionControlSystemInterface version control system instance.

execShellCommand() 보호된 메소드

Executes shell command.
protected execShellCommand ( string $command, array $placeholders = [] ) : string
$command string command text.
$placeholders array placeholders to be replaced using `escapeshellarg()` in format: placeholder => value.
리턴 string command output.

executeCommands() 보호된 메소드

Executes list of given commands.
protected executeCommands ( array $commands )
$commands array commands to be executed.

flushCache() 보호된 메소드

Flushes cache for all components specified at [[cache]].
protected flushCache ( )

flushLog() 보호된 메소드

Flushes log lines, returning them.
protected flushLog ( ) : array
리턴 array log lines.

getCurrentDate() 공개 메소드

public getCurrentDate ( ) : string
리턴 string current date string.

getHostName() 공개 메소드

public getHostName ( ) : string
리턴 string server hostname.

getReportFrom() 공개 메소드

public getReportFrom ( ) : string
리턴 string email address, which should be used to send report email messages.

linkWebPaths() 보호된 메소드

Links web roots to the actual web directories.
또한 보기: webPaths
protected linkWebPaths ( )

linkWebStubs() 보호된 메소드

Links web roots to the stub directories.
또한 보기: webPaths
protected linkWebStubs ( )

log() 보호된 메소드

Logs the message
protected log ( string $message )
$message string log message.

normalizeWebPaths() 보호된 메소드

Normalizes [[webPaths]] value.
protected normalizeWebPaths ( )

releaseMutex() 보호된 메소드

Release current action lock.
protected releaseMutex ( ) : boolean
리턴 boolean lock release result.

reportFail() 보호된 메소드

Sends report about failure.
protected reportFail ( )

reportResult() 보호된 메소드

Report message content will be composed from log messages.
protected reportResult ( string $subjectPrefix )
$subjectPrefix string report message subject.

reportSuccess() 보호된 메소드

Sends report about success.
protected reportSuccess ( )

sendEmail() 보호된 메소드

Sends an email.
protected sendEmail ( string $from, string $email, string $subject, string $message ) : boolean
$from string sender email address
$email string single email address
$subject string email subject
$message string email content
리턴 boolean success.

sendEmailFallback() 보호된 메소드

Sends an email via plain PHP mail() function.
protected sendEmailFallback ( string $from, string $email, string $subject, string $message ) : boolean
$from string sender email address
$email string single email address
$subject string email subject
$message string email content
리턴 boolean success.

setHostName() 공개 메소드

public setHostName ( string $hostName )
$hostName string server hostname.

setReportFrom() 공개 메소드

public setReportFrom ( string $reportFrom )
$reportFrom string email address, which should be used to send report email messages.

updateVendor() 보호된 메소드

Performs vendors update via Composer at all [[composerRootPaths]].
protected updateVendor ( )

프로퍼티 상세

$afterUpdateCommands 공개적으로 프로퍼티

list of shell commands, which should be executed after project update. If command is a string it will be executed as shell command, otherwise as PHP callback. For example: php [ 'php /path/to/project/yii migrate/up --interactive=0' ],
public $afterUpdateCommands

$beforeUpdateCommands 공개적으로 프로퍼티

list of commands, which should be executed before project update begins. If command is a string it will be executed as shell command, otherwise as PHP callback. For example: php [ 'mysqldump -h localhost -u root myproject > /path/to/backup/myproject.sql' ],
public $beforeUpdateCommands

$cache 공개적으로 프로퍼티

list of cache application components, for which [[Cache::flush()]] method should be invoked. Component ids, instances or array configurations can be used here.
public $cache

$composerBinPath 공개적으로 프로퍼티

path to the 'composer' bin command. By default simple 'composer' is used, assuming it available as global shell command. Path alias can be used here. For example: '@app/composer.phar'.
public $composerBinPath

$composerOptions 공개적으로 프로퍼티

composer command options.
또한 보기: Shell::buildOptions() for valid syntax on specifying this value. For example: ```php [ 'prefer-dist', 'no-dev', ] ``` Note, that `no-interaction` option will be added automatically to the options list.
부터: 1.0.2
public $composerOptions

$composerRootPaths 공개적으로 프로퍼티

list of composer install root paths (the ones containing 'composer.json'). Path aliases can be used here.
public $composerRootPaths

$configFile 공개적으로 프로퍼티

configuration file name. Settings from this file will be merged with the default ones. Such configuration file can be created, using action 'config'. Path alias can be used here, for example: '@app/config/self-update.php'.
public $configFile

$defaultAction 공개적으로 프로퍼티

controller default action ID.
public $defaultAction

$emails 공개적으로 프로퍼티

list of email addresses, which should be used to send execution reports.
public $emails

$mailer 공개적으로 프로퍼티

the mailer object or the application component ID of the mailer. It will be used to send notification messages to [[emails]]. If not set or sending email via this component fails, the fallback to the plain PHP mail() function will be used instead.
public $mailer

$mutex 공개적으로 프로퍼티

the mutex object or the application component ID of the mutex. After the controller object is created, if you want to change this property, you should only assign it with a mutex connection object.
public $mutex

$projectRootPath 공개적으로 프로퍼티

path to project root directory, which means VCS root directory. Path aliases can be use here.
public $projectRootPath

$shellResponseErrorKeywords 공개적으로 프로퍼티

list of keywords, which presence in the shell command output is considered as its execution error.
public $shellResponseErrorKeywords

$tmpDirectories 공개적으로 프로퍼티

list of temporary directories, which should be cleared after project update. Path aliases can be used here. For example: php [ '@app/web/assets', '@runtime/URI', '@runtime/HTML', '@runtime/debug', ]
public $tmpDirectories

$versionControlSystems 공개적으로 프로퍼티

list of possible version control systems (VCS) in format: vcsFolderName => classConfig. VCS will be detected automatically based on which folder is available inside [[projectRootPath]]
public $versionControlSystems

$webPaths 공개적으로 프로퍼티

project web path stubs configuration. Each path configuration should have following keys: - 'path' - string - path to web root folder - 'link' - string - path for the symbolic link, which should point to the web root - 'stub' - string - path to folder, which contains stub for the web Yii aliases can be used for all these keys. For example: php [ [ 'path' => '@app/web', 'link' => '@app/httpdocs', 'stub' => '@app/webstub', ] ]
public $webPaths