Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Release Class Reference

Public Member Functions

 __construct ($zipLocation)
 getZipLocation ()
 getVersion ()
 getInvitationMessage ()
 getFinishMessage ()
 update ($destination)

Static Public Member Functions

static make ($location, $exclude=array(), $invitationMessage= '', $finishMessage= '')
static releaseName ()
static migrate ()
static backupProject ($destination= '/tmp')

Static Public Attributes

static $temporaryDir = '/tmp'

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

Definition at line 11 of file Release.php.

Constructor & Destructor Documentation

Release::__construct (   $zipLocation)

Constructor

Parameters
string$zipLocationlocation of release zip archive

Definition at line 31 of file Release.php.

{
$this->_zipLocation = $zipLocation;
}

Member Function Documentation

static Release::backupProject (   $destination = '/tmp')
static

Backup project folder

Parameters
string$destinationfolder where backup will be saved
Returns
bool

Definition at line 192 of file Release.php.

References ZipHelper\compress().

Referenced by ReleaseController\actionUpdateStep3().

{
$date = date('Y-m-d');
$zipPath = $destination . '/' . "gentics_portal_node_php_{$date}_v" . Yii::app()->getModule('updates')->currentVersion . '.bak.zip';
@unlink($zipPath);
$dbDumper = new DbDumper();
$dump = $dbDumper->getDump();
array(
array(
'path' => Yii::getPathOfAlias('site'),
'exclude' => array(
'common/runtime',
'custom/runtime',
'frontend/runtime',
'frontend/www/assets'
)
),
"db_dump_$date.sql" => $dump
),
$zipPath
);
return $zipPath;
}
Release::getFinishMessage ( )

Retrieve finish message from archive

Returns
mixed

Definition at line 103 of file Release.php.

{
if ($this->_finishMessage === null) {
$zip = $this->_getZipArchive();
$this->_finishMessage = $zip->getFromName('common/runtime/finishMessage');
}
return $this->_finishMessage;
}
Release::getInvitationMessage ( )

Retrieve invitation message from archive

Returns
mixed

Definition at line 88 of file Release.php.

{
if ($this->_invitationMessage === null) {
$zip = $this->_getZipArchive();
$this->_invitationMessage = $zip->getFromName('common/runtime/invitationMessage');
}
return $this->_invitationMessage;
}
Release::getVersion ( )

Retrieve release version from archive

Returns
mixed

Definition at line 70 of file Release.php.

{
if ($this->_currentVersion === null) {
$zip = $this->_getZipArchive();
$tmpFile = Yii::getPathOfAlias('common.runtime.release_main_config');
file_put_contents($tmpFile, $zip->getFromName('frontend/config/main.php'));
$updatesConfig = include $tmpFile;
$this->_currentVersion = $updatesConfig['modules']['updates']['currentVersion'];
unlink($tmpFile);
}
return $this->_currentVersion;
}
Release::getZipLocation ( )

Public getter

Returns
string

Definition at line 41 of file Release.php.

Referenced by update().

{
return $this->_zipLocation;
}
static Release::make (   $location,
  $exclude = array(),
  $invitationMessage = '',
  $finishMessage = '' 
)
static

Create release of current project. Compress all necessary data into archive

Parameters
string$locationrelease folder
array$excludefiles/folder which need to be excluded
string$invitationMessagemessage which will be displayed before update process
string$finishMessagemessage which will be displayed after update process
Returns
Release

Definition at line 138 of file Release.php.

References ZipHelper\compress(), and releaseName().

Referenced by ReleaseController\actionCreate().

{
$zipPath = self::$temporaryDir . '/' . self::releaseName();
@unlink($zipPath);
array(
array(
'path' => $location,
'exclude' => $exclude
),
'common/runtime/invitationMessage' => $invitationMessage,
'common/runtime/finishMessage' => $finishMessage
), $zipPath
);
return new Release($zipPath);
}
static Release::migrate ( )
static

Runs migrate command

Returns
void

Definition at line 177 of file Release.php.

{
//Yii::import('system.cli.commands.MigrateCommand');
//$command = new MigrateCommand('', new CConsoleCommandRunner());
//$command->actionUp(array());
}
static Release::releaseName ( )
static

Returns release name

Returns
string

Definition at line 164 of file Release.php.

Referenced by make().

{
$date = date('Y_m_d');
return "release_{$date}_v" . Yii::app()->getModule('updates')->currentVersion . ".zip";
}
Release::update (   $destination)

Update project placed in $destination folder from release archive

Parameters
string$destinationdestination folder
Returns
void

Definition at line 121 of file Release.php.

References ZipHelper\extract(), and getZipLocation().

{
ZipHelper::extract($this->getZipLocation(), realpath($destination));
unlink($destination . '/common/runtime/invitationMessage');
unlink($destination . '/common/runtime/finishMessage');
}

The documentation for this class was generated from the following file: