Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
ReleaseController Class Reference
Inheritance diagram for ReleaseController:
BaseController

Public Member Functions

 filters ()
 accessRules ()
 actionCreate ()
 actionUpdateStep1 ()
 actionUpdateStep2 ()
 actionUpdateStep3 ()
- Public Member Functions inherited from BaseController
 getClient ()
 getAssetsPath ()
 getViewFile ($viewName)
 getJs ($path)
 renderMail ($view, $title=null, $data)
 redirect ($url, $terminate=true, $statusCode=302)

Additional Inherited Members

- Public Attributes inherited from BaseController
 $layout = '//layouts/gportal'
 $mailLayout = '//layouts/mail'
- Protected Member Functions inherited from BaseController
 beforeAction ($action)

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 12 of file ReleaseController.php.

Member Function Documentation

ReleaseController::accessRules ( )

Sets access rules

Returns
array

Definition at line 33 of file ReleaseController.php.

{
return array(
array('allow',
'actions' => array('create', 'updateStep1', 'updateStep2', 'updateStep3'),
'roles' => array('Admin'),
),
array('deny',
'users' => array('*'),
),
);
}
ReleaseController::actionCreate ( )

Creates a release

Returns
array

Definition at line 51 of file ReleaseController.php.

References Release\make(), and UpdatesModule\t().

{
$model = new CreateReleaseForm();
$model->invitationMessage = UpdatesModule::t('With this archive you can update Gentics Portal.Node PHP to version {version}', array('{version}' => Yii::app()->getModule('updates')->currentVersion));
$model->invitationMessage .= "\nNOTE: Before run update check if application directory is writable!";
$model->finishMessage = 'Successfully updated';
if (!empty($_POST['CreateReleaseForm'])) {
$model->attributes = $_POST['CreateReleaseForm'];
if ($model->validate()) {
$release = Release::make(
Yii::getPathOfAlias('site'),
array('.git', '.idea', '.gitignore', 'custom', 'frontend/runtime', 'frontend/www/assets', 'common/runtime', 'DCR', 'FSCR'),
$model->invitationMessage,
$model->finishMessage
);
Yii::app()->request->sendFile(pathinfo($release->getZipLocation(), PATHINFO_BASENAME), file_get_contents($release->getZipLocation()), null, false);
exit(0);
}
}
$this->render('create', array('model' => $model));
}
ReleaseController::actionUpdateStep1 ( )

Update action, step 1

Exceptions
Exception
Returns
void

Definition at line 80 of file ReleaseController.php.

{
Yii::app()->user->setState('releaseFile', null);
$model = new UpdateForm();
if (!empty($_POST['UpdateForm'])) {
$model->attributes = $_POST['UpdateForm'];
$model->validate();
$file = CUploadedFile::getInstance($model, 'file');
if ($file && !$file->getHasError()) {
$fileName = Yii::getPathOfAlias('site.custom.runtime') . '/' . $file->getName();
$file->saveAs($fileName);
Yii::app()->user->setState('releaseFile', $fileName);
$this->redirect('updateStep2');
} else {
throw new Exception('Upload file error.' . ($file ? 'Code: ' . $file->getError() : ''));
}
}
$this->render('updateStep1', array('model' => $model));
}
ReleaseController::actionUpdateStep2 ( )

Update action, step 2

Returns
void

Definition at line 106 of file ReleaseController.php.

{
if ($releaseFile = Yii::app()->user->getState('releaseFile')) {
$release = new Release($releaseFile);
$this->render('updateStep2', array('release' => $release));
} else {
$this->redirect('updateStep1');
}
}
ReleaseController::actionUpdateStep3 ( )

Update action, step 1

Returns
void

Definition at line 121 of file ReleaseController.php.

References Release\backupProject(), and UpdatesModule\t().

{
if (isset($_POST['Update']) && ($releaseFile = Yii::app()->user->getState('releaseFile'))) {
try {
$backupPath = Release::backupProject(Yii::getPathOfAlias('site.custom.runtime'));
$release = new Release($releaseFile);
$release->update(Yii::getPathOfAlias('site'));
//Release::migrate();
Yii::app()->user->setState('releaseFile', null);
$this->render('updateStep3', array('release' => $release, 'backupPath' => $backupPath));
} catch (Exception $e) {
Yii::app()->user->setFlash('error', UpdatesModule::t('Update process fails') . ' ' . $e->getMessage());
$this->render('updateStep3');
}
} else {
$this->redirect('updateStep1');
}
}
ReleaseController::filters ( )

Sets access filters

Returns
array

Definition at line 21 of file ReleaseController.php.

{
return array(
'accessControl'
);
}

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