diff --git a/src/vitis/.gitignore b/src/vitis/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/vitis/client/modules/vitis/less/versionConfiguration.less b/src/vitis/client/modules/vitis/less/versionConfiguration.less index 2e25f12659d0d2fbf64268e39b7e4b21ceb8cd9e..f3c030ddfbb72a23943920385c3f1fae246f069d 100755 --- a/src/vitis/client/modules/vitis/less/versionConfiguration.less +++ b/src/vitis/client/modules/vitis/less/versionConfiguration.less @@ -29,26 +29,22 @@ .panel-default>.panel-heading{ background-color: @application-lighen-color-theme; } -// Bouton vert. +// .install-state-ok { - background: url("../images/button_green.gif") 15px center no-repeat; + background: url("../images/button_green.gif") 190px center no-repeat; } -// Bouton rouge. .install-state-error { - background: url("../images/button_red.gif") 15px center no-repeat; -} -// Libellé de chaque état d'installation. -.install-state-ok > span, .install-state-error > span { - padding-left: 20px; + background: url("../images/button_red.gif") 190px center no-repeat; } + .version-update { height:20px; padding-top:0; font-weight:bold; } .version-needed-update { - color:#d94d0a !important; + color:#d94d0a !important; } .version-no-needed-update { - color:white !important; -} + color:white !important; +} \ No newline at end of file diff --git a/src/vitis/vas/rest/class/vmlib/files/Files.interface.inc b/src/vitis/vas/rest/class/vmlib/files/Files.interface.inc deleted file mode 100644 index 261396886ebae7c4dbd9833619fbd9acb2bd8951..0000000000000000000000000000000000000000 --- a/src/vitis/vas/rest/class/vmlib/files/Files.interface.inc +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -interface Files{ - // PHP native functions - public function file_exists ($sFilePath); - public function file_put_contents ($sFilePath, $sData, $iFlags = 0, $mContext = null); - public function file_get_contents ($sFilePath, $bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1); - public function file_get_contents_with_etag ($sFilePath, $sEtag ,$bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1); - public function copy ($sSourceFilePath, $sDestFilePath); - public function filesize ($sFilePath); - public function readfile ($sFilePath, $bUseIncludePath = FALSE, $mContext = null); - public function rename ($sSourceFilePath, $sDestFilePath, $mContext = null); - public function unlink ($sFilePath, $mContext = null); - public function filemtime ($sFilePath); - public function filemtime_formated ($sFilePath, $sFormat); - // Veremes functions - public function getFileInfos ($sFilePath); - public function getProxyPassUrl ($sFilePath); - public function getFileEtag($sFilePath); -} -?> diff --git a/src/vitis/vas/rest/class/vmlib/files/Files_manager.class.inc b/src/vitis/vas/rest/class/vmlib/files/Files_manager.class.inc deleted file mode 100644 index 715e18bf3224bfe6be2447251347241dbe0e0d72..0000000000000000000000000000000000000000 --- a/src/vitis/vas/rest/class/vmlib/files/Files_manager.class.inc +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -require_once ("S3_files.class.inc"); -require_once ("Local_files.class.inc"); - -class Files_manager{ - - public $oFileInterface; - - function __construct($oProperties){ - switch ($oProperties["filesystem"]) { - case 'fs': - $this->oFileInterface = new Local_files ($oProperties); - break; - case 's3': - $this->oFileInterface = new S3_files ($oProperties); - break; - default: - writeToErrorLog("The file system " . $oProperties["filesystem"] . " is not available on this server"); - break; - } - // create - } - - /*private upload_file($sNomObjet, $sFileType, $sServerPath, $sMaxSize, $aFileValues){ - - }*/ - - /** - *This method return the extension of a file. - *@file vmlib/phpUtil.inc - *@param $sString Full name of a file. - *@return Retourne une chaine. - */ - public function extension($sPath) { - $aTemp = explode(".", $sString); - $sString = strtolower($aTemp[count($aTemp) - 1]); - - return $sString; - } - - /** - *This method return the name of a file from its full path. - *@file vmlib/phpUtil.inc - *@param $sFullFileName Full path of a file. - *@return $aTemp2 The file name. - */ - public function getFileName($sFullFileName) { - $aTemp = explode("/", $sFullFileName); - $aTemp2 = explode("\\", $aTemp[(count($aTemp) - 1)]); - - return $aTemp2[(count($aTemp2) - 1)]; - } - - public function uploadInLocalFs ($sFilePath) { - - } -} - -?> diff --git a/src/vitis/vas/rest/class/vmlib/files/Local_files.class.inc b/src/vitis/vas/rest/class/vmlib/files/Local_files.class.inc deleted file mode 100644 index 37f99882d54fc3c313c72114c8dddd3b480f2db4..0000000000000000000000000000000000000000 --- a/src/vitis/vas/rest/class/vmlib/files/Local_files.class.inc +++ /dev/null @@ -1,193 +0,0 @@ -<?php - -require_once ("Files.interface.inc"); - -class Local_files implements Files{ - - var $oProperties; - - function __construct($properties){ - $this->oProperties = $properties; - } - - /** - *This method return the extension of a file. - *@param string $sFilePath File's path. - *@return string|boolean hash sha1 of file content or false if the file doesn't exist. - */ - public function getFileEtag($sFilePath){ - if(file_exists($sFilePath)){ - return sha1(file_get_contents($sFilePath), false); - } else { - return false; - } - - } - - /** - *verify if a file exists. - *@param string $sFilePath File's path. - *@return boolean true if file exists, false else. - */ - public function file_exists ($sFilePath){ - return file_exists($sFilePath); - } - /** - *Write a string in a file. - *@param string $sFilePath File's path. - *@param string $sData string to write in this file. - *@param integer $iFlags flags to write in file (http://php.net/manual/fr/function.file-put-contents.php) Default : 0. - *@param resource $mContext result de stream_context_create(). - *@return integer|boolean number of byte written, or false if the process encounter an error. - */ - public function file_put_contents ($sFilePath, $sData, $iFlags = 0, $mContext = null){ - return file_put_contents($sFilePath, $sData, $iFlags, $mContext); - } - /** - *read a file and return content in a string. - *@param string $sFilePath File's path. - *@param boolean $bUseIncludePath use include var to resolve a relative path. - *@param resource $mContext result de stream_context_create(). - *@param integer $iOffset offset in bytes to begin file reading, Default : 0. - *@param integer $iMaxLen Number of byte to read from the file, Default : -1 = read until the file's end. - *@return string|boolean file content, or false if the process encounter an error. - */ - public function file_get_contents ($sFilePath, $bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1){ - if ($iMaxLen == -1){ - return file_get_contents ($sFilePath, $bUseIncludePath, null, $iOffset); - } else { - return file_get_contents ($sFilePath, $bUseIncludePath, null, $iOffset, $iMaxLen); - } - } - /** - *read a file and return content in a string if eTag matches. - *@param string $sFilePath File's path. - *@param string $sEtag Hash Sha1 of file's content. - *@param boolean $bUseIncludePath use include var to resolve a relative path. - *@param resource $mContext result de stream_context_create(). - *@param integer $iOffset offset in bytes to begin file reading, Default : 0. - *@param integer $iMaxLen Number of byte to read from the file, Default : -1 = read until the file's end. - *@return string|boolean file content, or false if the process encounter an error. - */ - public function file_get_contents_with_etag ($sFilePath, $sEtag ,$bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1){ - $sProcessedEtag = $this->getFileEtag($sFilePath); - if ($sEtag == $sProcessedEtag){ - return $this->file_get_contents($sFilePath, $bUseIncludePath, $mContext, $iOffset, $iMaxLen); - } else { - return false; - } - } - /** - *copy a file. - *@param string $sSourceFilePath File's path to copy. - *@param string $sDestFilePath File's destination. - *@return boolean true on sucess or false if the process encounter an error. - */ - public function copy ($sSourceFilePath, $sDestFilePath){ - return copy ($sSourceFilePath, $sDestFilePath); - } - /** - *return the size of a file in bytes. - *@param string $sFilePath File's path. - *@return integer|boolean File's size in bytes or false if the process encounter an error. - */ - public function filesize ($sFilePath){ - return filesize($sFilePath); - } - /** - *send file's content into stdout. - *@param string $sFilePath File's path. - *@param boolean $bUseIncludePath use include var to resolve a relative path. - *@param resource $mContext result de stream_context_create(). - *@return integer|boolean File's size in bytes or false if the process encounter an error. - */ - public function readfile ($sFilePath, $bUseIncludePath = FALSE, $mContext = null){ - return readfile($sFilePath, $bUseIncludePath, $mContext); - } - /** - *move a file. - *@param string $sSourceFilePath File's path to copy. - *@param string $sDestFilePath File's destination. - *@param resource $mContext result de stream_context_create(). - *@return boolean true on sucess or false if the process encounter an error. - */ - public function rename ($sSourceFilePath, $sDestFilePath, $mContext = null){ - if(empty($mContext)){ - return rename($sSourceFilePath, $sDestFilePath); - }else{ - return rename($sSourceFilePath, $sDestFilePath, $mContext); - } - } - /** - *remove a file. - *@param string $sFilePath File's path. - *@param resource $mContext result de stream_context_create(). - *@return boolean true on sucess or false if the process encounter an error. - */ - public function unlink ($sFilePath, $mContext = null){ - if(empty($mContext)){ - return unlink($sFilePath); - } else { - return unlink($sFilePath, $mContext); - } - } - /** - *return the number of second UNIX of the last modification on a file. - *@param string $sFilePath File's path. - *@return integer|boolean timestamp on sucess or false if the process encounter an error. - */ - public function filemtime ($sFilePath){ - return filemtime($sFilePath); - } - /** - *return the fomrated date of the last modification on a file. - *@param string $sFilePath File's path. - *@param string $sFormat Format to convert the timestamp. - *@return string|boolean date string on sucess or false if the process encounter an error. - */ - public function filemtime_formated($sFilePath, $sFormat){ - return date ($sFormat, $this->filemtime($sFilePath)); - } - /** - *return the metadata structure of a file. - *@param string $sFilePath File's path. - *@return array filename, size, lastModification, href. - */ - public function getFileInfos ($sFilePath){ - $iFileSize = $this->filesize($sFilePath); - - $sFileSize = $iFileSize . " octets"; - if($iFileSize > 1024){ - if($iFileSize > 1024*1024){ - if($iFileSize > 1024*1024*1024){ - $sFileSize = "-"; - } else { - $sFileSize = (ceil($iFileSize/(1024*1024))) . "Mo"; - } - }else{ - $sFileSize = (ceil($iFileSize/1024)) . "Ko"; - } - } - - $aFileName = explode("/", $sFilePath); - - return array("filename"=>$aFileName[count($aFileName) - 1], "size"=>$sFileSize, "lastModification"=> $this->filemtime_formated ($sFilePath, "d/m/Y H:i:s"), "href" => $this->getProxyPassUrl($sFilePath)); - } - /** - *return an url to download the file through Vitis API . - *@param string $sFilePath File's path. - *@return string url. - */ - public function getProxyPassUrl ($sFilePath){ - $date = new DateTime(); - $sDataUrl = $this->oProperties['web_server_name'] . "/rest/vitis/file_downloader?key=[KEY]&eTag=[ETAG]&d=" . $date->getTimestamp(); - - $sFileUrl = str_replace("[KEY]", str_replace($this->oProperties['ws_data_dir'], "ws_data" , $sFilePath), $sDataUrl); - $sFileUrl = str_replace("[ETAG]", sha1(file_get_contents($sFilePath), false), $sFileUrl); - - return $sFileUrl; - } -} - - -?> diff --git a/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc b/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc deleted file mode 100644 index ec03d5ab58e6f4ff417ff937882c590d77413908..0000000000000000000000000000000000000000 --- a/src/vitis/vas/rest/class/vmlib/files/S3_files.class.inc +++ /dev/null @@ -1,411 +0,0 @@ -<?php - -require_once ("Files.interface.inc"); -require_once ("vmlib/phpUtil.inc"); -require_once ("vmlib/logUtil.inc"); -require_once ("aws_sdk/aws-autoloader.php"); - -class S3_files implements Files{ - - var $oProperties; - var $oS3Client; - - function __construct($properties){ - $this->oProperties = $properties; - // create client s3 - $this->oS3Client = new Aws\S3\S3Client(array( - 'version'=>'latest', - 'region'=> $properties['fileS3UploaderRegion'], - 'profile'=> $properties['fileS3UploaderProfil'], - 'debug' => false - )); - } - /** - *parse vitis properties ti extract bucket name and bucket prefix. - *@private - *@return array bucket'name, prefix. - */ - private function getBucketConst(){ - $sBucket = $this->oProperties['fileS3UploaderBucket']; - $sPrefix = ""; - - if (strpos($sBucket, "/") > -1){ - $aBucket = explode("/", $sBucket ); - $sBucket = $aBucket[0]; - $sPrefix = implode("/", array_slice($aBucket, 1)); - } - - return array($sBucket, $sPrefix); - } - /** - *This method return the extension of a file. - *@param string $sFilePath File's path. - *@return string|boolean hash md5 of file content or false if the file doesn't exist. - */ - public function getFileEtag($sFilePath){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - try { - $oResult = $this->oS3Client->headObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath) - ); - - return str_replace('"', '', $oResult["ETag"]); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - } - /** - *verify if a file exists. - *@param string $sFilePath File's path. - *@return boolean true if file exists, false else. - */ - public function file_exists ($sFilePath){ - - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - try { - $this->oS3Client->headObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath) - ); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - return true; - } - /** - *Write a string in a file. - *@param string $sFilePath File's path. - *@param string $sData string to write in this file. - *@param integer $iFlags flags to write in file (http://php.net/manual/fr/function.file-put-contents.php) Default : 0. - *@param resource $mContext result de stream_context_create(). - *@return integer|boolean number of byte written, or false if the process encounter an error. - */ - public function file_put_contents ($sFilePath, $sData, $iFlags = 0, $mContext = null){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - try { - $this->oS3Client->putObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath, - 'Body' => $sData, - ) - ); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - return strlen($sData); - } - /** - *read a file and return content in a string. - *@param string $sFilePath File's path. - *@param boolean $bUseIncludePath use include var to resolve a relative path. - *@param resource $mContext result de stream_context_create(). - *@param integer $iOffset offset in bytes to begin file reading, Default : 0. - *@param integer $iMaxLen Number of byte to read from the file, Default : -1 = read until the file's end. - *@return string|boolean file content, or false if the process encounter an error. - */ - public function file_get_contents ($sFilePath, $bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1){ - - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - $sPath = $this->oProperties['extract_dir'] . "/" . getUniqRandomId(); - - try{ - $this->oS3Client->getObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath, - 'SaveAs' => $sPath - )); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - unlink($sPath); - return false; - } - - $sFile = ""; - - if ($iMaxLen == -1){ - $sFile = file_get_contents ($sPath, $bUseIncludePath, null, $iOffset); - } else { - $sFile = file_get_contents ($sPath, $bUseIncludePath, null, $iOffset, $iMaxLen); - } - unlink($sPath); - return $sFile; - } - /** - *read a file and return content in a string if eTag matches. - *@param string $sFilePath File's path. - *@param string $sEtag Hash Sha1 of file's content. - *@param boolean $bUseIncludePath use include var to resolve a relative path. - *@param resource $mContext result de stream_context_create(). - *@param integer $iOffset offset in bytes to begin file reading, Default : 0. - *@param integer $iMaxLen Number of byte to read from the file, Default : -1 = read until the file's end. - *@return string|boolean file content, or false if the process encounter an error. - */ - public function file_get_contents_with_etag ($sFilePath, $sEtag ,$bUseIncludePath = FALSE, $mContext = null, $iOffset = 0, $iMaxLen = -1){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - $sPath = $this->oProperties['extract_dir'] . "/" . getUniqRandomId(); - - try{ - $this->oS3Client->getObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath, - 'IfMatch' => $sEtag, - 'SaveAs' => $sPath - )); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - unlink($sPath); - return false; - } - $sFile = ""; - - if ($iMaxLen == -1){ - $sFile = file_get_contents ($sPath, $bUseIncludePath, null, $iOffset); - } else { - $sFile = file_get_contents ($sPath, $bUseIncludePath, null, $iOffset, $iMaxLen); - } - unlink($sPath); - return $sFile; - } - /** - *copy a file in the same bucket. - *@param string $sSourceFilePath Object's key to copy. - *@param string $sDestFilePath Object's destination key. - *@return boolean true on sucess or false if the process encounter an error. - */ - public function copy ($sSourceFilePath, $sDestFilePath){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sDestFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sDestFilePath); - $sSourceFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sSourceFilePath); - - try{ - $this->oS3Client->copyObject(array( - 'Bucket' => $sBucket, - 'Key' => $sDestFilePath, - 'CopySource' => $sBucket . "/" . $sSourceFilePath - )); - return true; - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - } - /** - *copy a file in another bucket. - *@param string $sSourceFilePath Object's key to copy. - *@param string $sDests3Key Object's destination key. - *@param string $sDestBucket Object's destination bucket. - *@return boolean true on sucess or false if the process encounter an error. - */ - public function copyInAnotherBucket ($sSourceFilePath, $sDests3Key, $sDestBucket){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sSourceFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sSourceFilePath); - - try{ - $this->oS3Client->copyObject(array( - 'Bucket' => $sDestBucket, - 'Key' => $sDests3Key, - 'CopySource' => $sBucket . "/" . $sSourceFilePath - )); - return true; - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - } - /** - *send a local file to S3. - *@param string $sSourceFilePath File's path to copy. - *@param string $sDestFilePath Object's destination key. - *@return boolean true on sucess or false if the process encounter an error. - */ - public function copyLocalToS3 ($sSourceFilePath, $sDestFilePath){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sDestFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sDestFilePath); - - try { - $this->oS3Client->putObject(array( - 'Bucket' => $sBucket, - 'Key' => $sDestFilePath, - 'Body' => file_get_contents($sSourceFilePath), - ) - ); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - return true; - } - /** - *return the size of a file in bytes. - *@param string $sFilePath File's path. - *@return integer|boolean File's size in bytes or false if the process encounter an error. - */ - public function filesize ($sFilePath){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - try { - $oResult = $this->oS3Client->headObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath) - ); - - return $oResult["ContentLength"]; - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - } - /** - *send file's content into stdout. - *@param string $sFilePath File's path. - *@param boolean $bUseIncludePath use include var to resolve a relative path. - *@param resource $mContext result de stream_context_create(). - *@return integer|boolean File's size in bytes or false if the process encounter an error. - */ - public function readfile ($sFilePath, $bUseIncludePath = FALSE, $mContext = null){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - $sPath = $this->oProperties['extract_dir'] . "/" . getUniqRandomId(); - - try{ - $this->oS3Client->getObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath, - 'SaveAs' => $sPath - )); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - unlink($sPath); - return false; - } - - $iLength = readfile($sPath, $bUseIncludePath, $mContext); - unlink($sPath); - return $iLength; - } - /** - *move a file. - *@param string $sSourceFilePath File's path to copy. - *@param string $sDestFilePath File's destination. - *@param resource $mContext result de stream_context_create(). - *@return boolean true on sucess or false if the process encounter an error. - */ - public function rename ($sSourceFilePath, $sDestFilePath, $mContext = null){ - $bReturn = $this->copy($sSourceFilePath, $sDestFilePath); - if ($bReturn) - $bReturn = $this->unlink($sSourceFilePath, $mContext); - return $bReturn; - } - /** - *remove a file. - *@param string $sFilePath File's path. - *@param resource $mContext result de stream_context_create(). - *@return boolean true on sucess or false if the process encounter an error. - */ - public function unlink ($sFilePath, $mContext = null){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - try{ - $this->oS3Client->deleteObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath - )); - return true; - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - } - /** - *return the number of second UNIX of the last modification on a file. - *@param string $sFilePath File's path. - *@return integer|boolean timestamp on sucess or false if the process encounter an error. - */ - public function filemtime ($sFilePath){ - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - - try { - $oResult = $this->oS3Client->headObject(array( - 'Bucket' => $sBucket, - 'Key' => $sFilePath) - ); - - return $oResult["LastModified"]->format("U"); - }catch (Aws\S3\Exception\S3Exception $e){ - writeToErrorLog($e->getMessage()); - return false; - } - } - /** - *return the fomrated date of the last modification on a file. - *@param string $sFilePath File's path. - *@param string $sFormat Format to convert the timestamp. - *@return string|boolean date string on sucess or false if the process encounter an error. - */ - public function filemtime_formated ($sFilePath, $sFormat){ - return date ($sFormat, $this->filemtime($sFilePath)); - } - /** - *return the metadata structure of a file. - *@param string $sFilePath File's path. - *@return array filename, size, lastModification, href. - */ - public function getFileInfos ($sFilePath){ - $iFileSize = $this->filesize($sFilePath); - - $sFileSize = $iFileSize . " octets"; - if($iFileSize > 1024){ - if($iFileSize > 1024*1024){ - if($iFileSize > 1024*1024*1024){ - $sFileSize = "-"; - } else { - $sFileSize = (ceil($iFileSize/(1024*1024))) . "Mo"; - } - }else{ - $sFileSize = (ceil($iFileSize/1024)) . "Ko"; - } - } - - $aFileName = explode("/", $sFilePath); - - return array("filename"=>$aFileName[count($aFileName) - 1], "size"=>$sFileSize, "lastModification"=> $this->filemtime_formated ($sFilePath, "d/m/Y H:i:s"), "href" => $this->getProxyPassUrl($sFilePath)); - } - /** - *return an url to download the file through Vitis API . - *@param string $sFilePath File's path. - *@return string url. - */ - public function getProxyPassUrl ($sFilePath){ - $sEtag = $this->getFileEtag($sFilePath); - list($sBucket, $sPrefix) = $this->getBucketConst(); - $sFilePath = str_replace($this->oProperties["vas_home"], $sPrefix , $sFilePath); - $date = new DateTime(); - $sDataUrl = $this->oProperties['web_server_name'] . "/rest/vitis/file_downloader?key=[KEY]&eTag=[ETAG]&d=" . $date->getTimestamp(); - - $sFileUrl = str_replace("[KEY]", str_replace($this->oProperties['ws_data_dir'], "ws_data" , $sFilePath), $sDataUrl); - $sFileUrl = str_replace("[ETAG]", $sEtag, $sFileUrl); - - return $sFileUrl; - } -} - - -?> diff --git a/src/vitis/vas/rest/conf/properties_server.inc b/src/vitis/vas/rest/conf/properties_server.inc index a78168ab45101fad2c124f631e4f3b81867c94f9..7401ea9ce6beeddfbc43a53226b2bcbff2ce3c19 100644 --- a/src/vitis/vas/rest/conf/properties_server.inc +++ b/src/vitis/vas/rest/conf/properties_server.inc @@ -48,8 +48,7 @@ $properties["notifierDeploymentName"] = "test"; $properties["notifierAccessKeyAccount"] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $properties["notifierSecretKeyAccount"] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // utilisation de s3 pour remplacer le système de Fichier -$properties['filesystem'] = "fs"; // s3 -$properties['AWSCredentialsFilePath'] = ""; // .../.aws/credentials +$properties['fileS3Uploader'] = false; $properties["fileS3UploaderProfil"] = ""; $properties["fileS3UploaderBucket"] = ""; $properties['fileS3UploaderRegion'] = ""; diff --git a/src/vitis/vas/rest/ws/vitis/Properties.class.inc b/src/vitis/vas/rest/ws/vitis/Properties.class.inc index ce27585e1c49466434259ff0711e3deee8c6ae1e..c7f65b413b16534d0349e47a7b9a0a420d1ba76a 100755 --- a/src/vitis/vas/rest/ws/vitis/Properties.class.inc +++ b/src/vitis/vas/rest/ws/vitis/Properties.class.inc @@ -87,8 +87,6 @@ class Properties extends Vitis { } require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/conf/version.inc"; - require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/conf/version.inc"; - if (VM_STATUS != "STABLE") { $this->aFields['VM_STATUS'] = "UNSTABLE"; } else {