[Fusionforge-commits] FusionForge branch master updated. 9158a60af6ca3c3a182542e3896973d0cd72b8e9

Franck Villaume nerville at fusionforge.org
Sun Nov 9 17:14:57 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  9158a60af6ca3c3a182542e3896973d0cd72b8e9 (commit)
       via  f42d56c9067c3604a0d703914f4b5b6a44ea830a (commit)
       via  28e549d25587d49cdb4671c79541108acc197305 (commit)
       via  d7ecf640d15fdab719b9f24d1f0710aa7a25da29 (commit)
      from  bc4be4b9876bc013e8557da2cd6bd6f5c4ddbb9e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9158a60af6ca3c3a182542e3896973d0cd72b8e9
Merge: bc4be4b f42d56c
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Nov 9 17:13:17 2014 +0100

    Merge Branch_5_3

diff --cc src/common/frs/FRSPackage.class.php
index 140d3f6,5a26d2e..86467a2
--- a/src/common/frs/FRSPackage.class.php
+++ b/src/common/frs/FRSPackage.class.php
@@@ -559,99 -521,41 +559,99 @@@ class FRSPackage extends Error 
  		}
  	}
  
 -	public function getNewestReleaseZipName() {
 -		return $this->getFileName()."-latest.zip";
 +	public function getReleaseZipPath($release) {
 +		return forge_get_config('upload_dir').'/'.$this->Group->getUnixName().'/'.$this->getFileName().'/'.$this->getReleaseZipName($release);
  	}
  
 -	public function getNewestReleaseZipPath () {
 -		return forge_get_config('upload_dir').'/'.$this->Group->getUnixName().'/'.$this->getFileName().'/'.$this->getNewestReleaseZipName();
 +	public function getReleaseZipName($release) {
 +		$frsr = frsrelease_get_object($release);
 +		return $this->getFileName().'-'.$frsr->getName().'.zip';
  	}
  
 -	public function createNewestReleaseFilesAsZip(){
 -		$release = $this->getNewestRelease();
 -		if ($release && class_exists('ZipArchive')) {
 +	public function getNewestReleaseZipName() {
 +		return $this->getFileName().'-latest.zip';
 +	}
 +
 +	/**
 +	 * createReleaseFilesAsZip - create the Zip Archive of the release
 +	 *
 +	 * @param	integer	release id.
 +	 * @return	bool	true on success even if the php ZipArchive does not exist
 +	 */
 +	public function createReleaseFilesAsZip($release_id) {
 +		if ($release_id && class_exists('ZipArchive')) {
  			$zip = new ZipArchive();
 -			$zipPath = $this->getNewestReleaseZipPath();
 +			$zipPath = $this->getReleaseZipPath($release_id);
 +			$release = frsrelease_get_object($release_id);
  			$filesPath = forge_get_config('upload_dir').'/'.$this->Group->getUnixName().'/'.$this->getFileName().'/'.$release->getFileName();
- 			if ($zip->open($zipPath, ZIPARCHIVE::CREATE) !== true) {
 -
+ 			if ($zip->open($zipPath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) != true) {
 -				exit_error(_('Cannot open the file archive.').' '.$zipPath.'.');
 +				$this->setError(_('Cannot open the file archive')._(': ').$zipPath.'.');
 +				return false;
  			}
 -
  			$files = $release->getFiles();
 -
  			foreach ($files as $f) {
  				$filePath = $filesPath.'/'.$f->getName();
 -				$zip->addFile($filePath,$f->getName());
 +				if ($zip->addFile($filePath, $f->getName()) !== true) {
 +					$this->setError(_('Cannot add file to the file archive')._(': ').$zipPath.'.');
 +					return false;
 +				}
 +			}
 +			if ($zip->close() !== true) {
 +				$this->setError(_('Cannot close the file archive')._(': ').$zipPath.'.');
 +				return false;
  			}
 -
 -			$zip->close();
  		}
 +		return true;
  	}
  
 -	public function deleteNewestReleaseFilesAsZip() {
 -		if (file_exists($this->getNewestReleaseZipPath()))
 -			unlink($this->getNewestReleaseZipPath());
 +	public function deleteReleaseFilesAsZip($release_id) {
 +		if (file_exists($this->getReleaseZipPath($release_id)))
 +			unlink($this->getReleaseZipPath($release_id));
  		return true;
  	}
 +
 +	/**
 +	 * sendNotice - Notifies of package actions
 +	 *
 +	 * @param	boolean	true = new package (default value)
 +	 * @return	bool
 +	 */
 +	function sendNotice($new = true) {
 +		$BCC = $this->Group->getFRSEmailAddress();
 +		if ($this->isMonitoredBy('ALL')) {
 +			$BCC .= $this->getMonitoredUserEmailAddress();
 +		}
 +		if (strlen($BCC) > 0) {
 +			$session = session_get_user();
 +			if ($new) {
 +				$status = _('New Package');
 +			} else {
 +				$status = _('Updated Package').' '._('by').' ' . $session->getRealName();
 +			}
 +			$subject = '['.$this->Group->getPublicName().'] '.$status.' - '.$this->getName();
 +			$body = _('Project')._(': ').$this->Group->getPublicName()."\n";
 +			$body .= _('Package')._(': ').$this->getName()."\n";
 +			$body .= "\n\n-------------------------------------------------------\n".
 +				_('For more info, visit')._(':').
 +				"\n\n" . util_make_url('/frs/?group_id='.$this->Group->getID());
 +
 +			$BCCarray = explode(',',$BCC);
 +			foreach ($BCCarray as $dest_email) {
 +				util_send_message($dest_email, $subject, $body, 'noreply@'.forge_get_config('web_host'), '', _('FRS'));
 +			}
 +		}
 +		return true;
 +	}
 +
 +	/**
 +	 * getMonitoredUserEmailAddress - get the email addresses of users who monitor this file
 +	 *
 +	 * @return	string	The list of emails comma separated
 +	 */
 +	function getMonitoredUserEmailAddress() {
 +		$MonitorElementObject = new MonitorElement('frspackage');
 +		return $MonitorElementObject->getAllEmailsInCommatSeparated($this->getID());
 +	}
  }
  
  // Local Variables:

-----------------------------------------------------------------------

Summary of changes:
 src/common/frs/FRSPackage.class.php |    2 +-
 src/db/20141105-frs-ziplatest.php   |   84 +++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletion(-)
 create mode 100644 src/db/20141105-frs-ziplatest.php


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list