diff --git a/vas/rest/class/vmlib/phpUtil.inc b/vas/rest/class/vmlib/phpUtil.inc index 79de3bfc992d991535ee5930ad5956799aab1eb4..a2aeaefa9d45bd66848ceab1c489f16508206348 100755 --- a/vas/rest/class/vmlib/phpUtil.inc +++ b/vas/rest/class/vmlib/phpUtil.inc @@ -1444,67 +1444,6 @@ function copyFileInWsDataDir ($sModule, $sObject, $mId, $sField = '', $sFileName return $sErrorMsg; } - /** - *This method create an empty file in ws_data. - *@file vmlib/phpUtil.inc - *@param $sModule Name of the module. - *@param $sObject Name of the object. - *@param $mId Id of the current object. - *@param $sField field name (generally DB column name). - *@param $sFileName Name of the file to copy. - *@return $sErrorMsg The error message. - */ -function createEmptyFileInWsDataDir($sModule, $sObject, $mId, $sField = '', $sFileName) { - global $properties; - $sErrorMsg = ''; - $sDestDir = $properties['ws_data_dir'] . "/" . $sModule . "/" . $sObject . "/" . $mId; - if(!empty($sField)) - $sDestDir .= "/" . $sField; - if ($properties['fileS3Uploader'] === true) { - require_once ("aws_sdk/aws-autoloader.php"); - $s3 = new Aws\S3\S3Client(array( - 'version'=>'latest', - 'region'=> $properties['fileS3UploaderRegion'], - 'profile'=> $properties['fileS3UploaderProfil'], - 'debug' => false - )); - $sBucket = $properties['fileS3UploaderBucket']; - $sPrefix = ""; - if (strpos($sBucket, "/") > -1){ - $aBucket = explode("/", $sBucket ); - $sBucket = $aBucket[0]; - $sPrefix = implode("/", array_slice($aBucket, 1)); - } - $sServerPath = str_replace($properties["vas_home"], $sPrefix, $sDestDir); - // Suppression du slash de début de ligne (sinon création d'un répertoire vide sur S3). - if (strpos($sServerPath, '/') === 0) - $sServerPath = substr($sServerPath, 1); - // Création du fichier vide. - try { - $aResult = $s3->putObject(array( - 'Bucket' => $sBucket, - 'Key' => $sServerPath . '/' . $sFileName, - 'Body' => '' - )); - } - catch(Aws\S3\Exception\S3Exception $e) { - writeToErrorLog($e->getMessage()); - } - } - else { - $sFilePath = $sDestDir . '/' . $sFileName; - // Création du répertoire de destination si inexistant. - if (!file_exists($sDestDir)) { - if (!mkdir($sDestDir, 0777, true)) { - writeToErrorLog(ERROR_CREATING_DIRECTORY . $sDestDir); - return ERROR_CREATING_DIRECTORY . $sDestDir; - } - } - fclose(fopen($sFilePath, "w+")); - } - return $sErrorMsg; -} - /** *This method delete a directory in ws_data. *@file vmlib/phpUtil.inc