14 public static $temporaryDir =
'/tmp';
16 private $_zipLocation;
18 private $_currentVersion;
20 private $_invitationMessage;
22 private $_finishMessage;
33 $this->_zipLocation = $zipLocation;
43 return $this->_zipLocation;
53 private function _getZipArchive()
55 if ($this->_zipArchive === null) {
56 $this->_zipArchive =
new ZipArchive();
57 if (($errorCode = $this->_zipArchive->open($this->_zipLocation, ZIPARCHIVE::CHECKCONS)) !==
true) {
58 throw new Exception(
"Invalid zip file. Error: $errorCode");
62 return $this->_zipArchive;
72 if ($this->_currentVersion === null) {
73 $zip = $this->_getZipArchive();
74 $tmpFile = Yii::getPathOfAlias(
'common.runtime.release_main_config');
75 file_put_contents($tmpFile, $zip->getFromName(
'frontend/config/main.php'));
76 $updatesConfig = include $tmpFile;
77 $this->_currentVersion = $updatesConfig[
'modules'][
'updates'][
'currentVersion'];
80 return $this->_currentVersion;
90 if ($this->_invitationMessage === null) {
91 $zip = $this->_getZipArchive();
92 $this->_invitationMessage = $zip->getFromName(
'common/runtime/invitationMessage');
95 return $this->_invitationMessage;
105 if ($this->_finishMessage === null) {
106 $zip = $this->_getZipArchive();
107 $this->_finishMessage = $zip->getFromName(
'common/runtime/finishMessage');
110 return $this->_finishMessage;
124 unlink($destination .
'/common/runtime/invitationMessage');
125 unlink($destination .
'/common/runtime/finishMessage');
138 public static function make($location, $exclude = array(), $invitationMessage =
'', $finishMessage =
'')
146 'exclude' => $exclude
148 'common/runtime/invitationMessage' => $invitationMessage,
149 'common/runtime/finishMessage' => $finishMessage
166 $date = date(
'Y_m_d');
167 return "release_{$date}_v" . Yii::app()->getModule(
'updates')->currentVersion .
".zip";
194 $date = date(
'Y-m-d');
195 $zipPath = $destination .
'/' .
"gentics_portal_node_php_{$date}_v" . Yii::app()->getModule(
'updates')->currentVersion .
'.bak.zip';
198 $dump = $dbDumper->getDump();
202 'path' => Yii::getPathOfAlias(
'site'),
207 'frontend/www/assets'
210 "db_dump_$date.sql" => $dump