Bug 8665 3K issue:

Description: ./files directory cannot be up 32000 directories max at ext3 configuration.
Solution : split the uid case directory at 3 level to create a tree structure. Apply this new structure to all PM. Set a upgrade procedure at time to use processmaker upgrade <workspace> commnand as su.
This commit is contained in:
ralpheav
2013-04-29 16:48:29 -04:00
parent 1721f48782
commit 06466df921
21 changed files with 361 additions and 40 deletions

183
gulliver/system/class.g.php Normal file → Executable file
View File

@@ -314,12 +314,13 @@ class G
while ($parent_folder_path = array_pop( $folder_path )) {
if (! @is_dir( $parent_folder_path )) {
if (! @mkdir( $parent_folder_path, $rights)) {
//trigger_error ("Can't create folder \"$parent_folder_path\".", E_USER_WARNING);
error_log( "Can't create folder \"$parent_folder_path\"");
//umask( $oldumask );
}
}
}
umask($oldumask);
}
}
}
}
/**
* rm_dir
@@ -359,6 +360,53 @@ class G
}
}
/**
* Delete all the directory tree cotents.
* @param string $dir
* @return void
*/
public function delTree($dir)
{
$files = glob( $dir . '*', GLOB_MARK );
foreach ($files as $file ) {
if (substr( $file, -1 ) == '/' ) {
$this->delTree( $file );
} else {
unlink( $file );
}
}
if (is_dir($dir)) {
rmdir( $dir );
}
}
/**
* Recursive copy
* @param string $source
* @param string $destination
* @return boolean
*/
function recursive_copy ($source, $destination) {
if ($source == $destination) {
return false;
}
$dir = opendir($source);
if (! file_exists($destination)) {
@mkdir($destination);
}
while (false !== ( $file = readdir($dir))) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($source . '/' . $file) ) {
self::recursive_copy($source . '/' . $file, $destination . '/' . $file);
} else {
copy($source . '/' . $file, $destination . '/' . $file);
}
}
}
closedir($dir);
return true;
}
/**
* verify path
*
@@ -2414,6 +2462,133 @@ class G
return $new_val;
}
/**
* Extract the structure version value from serializated table field and check it.
* @return true if the version is bigger than 1
*/
public function gotDirectoryStructureVer2()
{
G::LoadClass( "configuration" );
$configuration = new Configurations();
if (defined('SYS_SYS') && $configuration->exists("ENVIRONMENT_SETTINGS")) {
return ($configuration->getDirectoryStructureVer() > 1);
}
return false;
}
/**
* Get the default blank directory 0 for external files
*/
public function getBlackHoleDir()
{
//len32:12345678901234567890123456789012
return "00000000000000000000000000000000";
}
/**
* Funtion used to fix 32K issue related to ext3 max subdirectory storage, but checking Version first.
* @param string $uid
* @param int $splitSize
* @param int $pieces
* @return string xxx/xxx/xxx/xxxxxxxxxxxxxxxxxxxxx
*/
public function getPathFromUID($uid, $splitSize = 3, $pieces = 3)
{
if (! G::gotDirectoryStructureVer2()) {
return $uid;
}
return G::getPathFromUIDPlain($uid, $splitSize, $pieces);
}
/**
* Funtion used to fix 32K issue related to ext3 max subdirectory storage.
* @param string $uid
* @param int $splitSize
* @param int $pieces
* @return string xxx/xxx/xxx/xxxxxxxxxxxxxxxxxxxxx
*/
public function getPathFromUIDPlain($uid, $splitSize = 3, $pieces = 3)
{
$dirArray = array();
if (is_string($uid) && strlen($uid) >= 32 && $uid != G::getBlackHoleDir()) {
for ($i = 0; $i < $pieces; $i++) {
$dirArray[] = substr($uid, 0, $splitSize);
$len = strlen($uid);
$uid = substr($uid, $splitSize, $len);
}
}
$dirArray[] = $uid;
$newfileStructure = implode($dirArray, '/');
return $newfileStructure;
}
/**
* Get the uid from the splitted directory + filename.
* @param string $path
* @return string
*/
public function getUIDfromPath($path)
{
$uid = '';
$item = explode($path, '/');
$len = sizeof($item);
for ($i = 0; $i < $len; $i++) {
$uid .= $item[$i];
}
if (strlen($uid) != 32){
return "invalid";
}
return $uid;
}
/**
* Get the file stored in '0' dir as splitted, but checking version first.
* @param string $appUid
* @param string $fileUid
* @param int $splitSize
* @param int $pieces
* @return array index:0 got the path, index:1 got the filename
*/
public function getPathFromFileUID($appUid, $fileUid, $splitSize = 3, $pieces = 3)
{
if (! G::gotDirectoryStructureVer2()) {
$response = array();
$response[] = '';
$response[] = $fileUid;
return $response;
}
return G::getPathFromFileUIDPlain($appUid, $fileUid, $splitSize, $pieces);
}
/**
* Get the file stored in '0' dir as splitted.
* @param string $appUid
* @param string $fileUid
* @param int $splitSize
* @param int $pieces
* @return array index:0 got the path, index:1 got the filename
*/
public function getPathFromFileUIDPlain($appUid, $fileUid, $splitSize = 3, $pieces = 3)
{
$response = array();
if ($appUid == G::getBlackHoleDir()) {
$dirArray = array();
if (is_string($fileUid) && strlen($fileUid) >= 32) {
for ($i = 0; $i < $pieces; $i++) {
$dirArray[] = substr($fileUid, 0, $splitSize);
$len = strlen($fileUid);
$fileUid = substr($fileUid, $splitSize, $len);
}
}
$response[] = implode($dirArray, '/') . '/';
$response[] = $fileUid;
} else {
$response[] = '';
$response[] = $fileUid;
}
return $response;
}
/**
* Upload a file and then copy to path+ nameToSave
*

View File

@@ -3602,7 +3602,7 @@ class Cases
$docVersion = $appDocument->getDocVersion();
$arrayInfo = pathinfo($appDocument->getAppDocFilename());
$extension = (isset($arrayInfo["extension"])) ? $arrayInfo["extension"] : null;
$strPathName = PATH_DOCUMENT . $applicationUid . PATH_SEP;
$strPathName = PATH_DOCUMENT . G::getPathFromUID($applicationUid) . PATH_SEP;
$strFileName = $appDocUid . "_" . $docVersion . "." . $extension;
switch ($option) {

View File

@@ -46,7 +46,15 @@ class CLI
public static function taskName ($name)
{
self::$currentTask = $name;
self::$tasks[$name] = array ('name' => $name,'description' => null,'args' => array (),'function' => null,'opt' => array ('short' => '','long' => array (),'descriptions' => array ()
self::$tasks[$name] = array (
'name' => $name,
'description' => null,
'args' => array (),
'function' => null,
'opt' => array (
'short' => '',
'long' => array (),
'descriptions' => array ()
)
);
}

View File

@@ -915,5 +915,29 @@ class Configurations // extends Configuration
return array("caseColumns" => $caseColumns, "caseReaderFields" => $caseReaderFields, "rowsperpage" => 20, "dateformat" => "M d, Y");
}
/**
* Set the current Directory structure version, default value 1.
* Note.- TAKE CARE for the version value, input/output couln't work at the wrong version.
* @param integer $version
*/
public function setDirectoryStructureVer($version = 1)
{
$obj = '';
$this->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
$this->aConfig['directoryStructure'] = $version;
$this->saveConfig('ENVIRONMENT_SETTINGS', $obj);
}
/**
* Get the current directory structure version if the array iten 'directoryStructure' doesn't exists it will returns 1.
* @return integer
*/
public function getDirectoryStructureVer()
{
$obj = '';
$this->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
$ver = isset($this->aConfig['directoryStructure']) ? $this->aConfig['directoryStructure'] : 1;
return $ver;
}
}

View File

@@ -1708,7 +1708,7 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
}
$sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
$pathOutput = PATH_DOCUMENT . $sApplication . PATH_SEP . 'outdocs' . PATH_SEP; //G::pr($sFilename);die;
$pathOutput = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP; //G::pr($sFilename);die;
G::mk_dir( $pathOutput );
$aProperties = array ();
@@ -1747,7 +1747,7 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
$oAppDocument1 = new AppDocument();
$oAppDocument1->update( $aFields );
$sPathName = PATH_DOCUMENT . $sApplication . PATH_SEP;
$sPathName = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP;
$oData['APP_UID'] = $sApplication;
$oData['ATTACHMENT_FOLDER'] = true;

View File

@@ -4424,6 +4424,7 @@ class processMap
$aDirectories[] = array('PATH' => ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : '') . $sObject, 'DIRECTORY' => $sObject );
} else {
$aAux = pathinfo($sPath);
$aAux['extension'] = (isset($aAux['extension'])?$aAux['extension']:'');
$aFiles[] = array('FILE' => $sObject, 'EXT' => $aAux['extension'] );
}
}

View File

@@ -89,6 +89,13 @@ class workspaceTools
$stop = microtime(true);
$final = $stop - $start;
CLI::logging("<*> Process Updating cache view carried out in $final seconds.\n");
$start = microtime(true);
CLI::logging("> Updating cases directories structure...\n");
$this->upgradeCasesDirectoryStructure($workSpace);
$stop = microtime(true);
$final = $stop - $start;
CLI::logging("<*> Process Updating directories structure carried out in $final seconds.\n");
}
/**
@@ -482,6 +489,97 @@ class workspaceTools
// end of reset
}
/**
* fix the 32K issue, by migrating /files directory structure to an uid tree structure based.
* @param $workspace got the site(s) the manager wants to upgrade
*/
public function upgradeCasesDirectoryStructure ($workspace)
{
define('PATH_DOCUMENT', PATH_DATA . 'sites/' . $workspace . '/' . 'files/');
$doclevel = explode('/', PATH_DOCUMENT);
$length = sizeof(PATH_DOCUMENT);
$filesDir = $doclevel[$length - 1];
if (is_dir(PATH_DOCUMENT) && is_writable($filesDir)) {
CLI::logging("Error:" . PATH_DOCUMENT . " is not writable... please check the su permissions.\n");
return;
}
$directory = array();
$blackHoleDir = G::getBlackHoleDir();
$directory = glob(PATH_DOCUMENT . "*", GLOB_ONLYDIR);
$dirslength = sizeof($directory);
if (! @chdir(PATH_DOCUMENT)) {
CLI::logging("Cannot use Document directory. The upgrade must be done as root.\n");
return;
}
//Start migration
for ($index = 0; $index < $dirslength; $index++) {
$depthdirlevel = explode('/', $directory[$index]);
$lastlength = sizeof($depthdirlevel);
$UIdDir = $depthdirlevel[$lastlength - 1];
$lenDir = strlen($UIdDir);
if ($lenDir == 32 && $UIdDir != $blackHoleDir) {
$len = count(scandir($UIdDir));
if ($len > 2) {
//lenght = 2, because the function check . and .. dir links
$newDiretory = G::getPathFromUIDPlain($UIdDir);
CLI::logging("Migrating $UIdDir to $newDiretory\n");
G::mk_dir($newDiretory);
//echo `cp -R $UIdDir/* $newDiretory/`;
if (G::recursive_copy($UIdDir, $newDiretory)) {
CLI::logging("Removing $UIdDir...\n");
G::rm_dir($UIdDir);
rmdir($UIdDir);//remove the diretory itself, G::rm_dir cannot do it
} else {
CLI::logging("Error: Failure at coping from $UIdDir...\n");
}
} else {
CLI::logging("$UIdDir is empty, removing it\n");
rmdir($UIdDir);//remove the diretory itself
}
}
}
//Start '0' directory migration
$black = PATH_DOCUMENT . $blackHoleDir . '/';
if (is_dir($black)) {
$newpattern = array();
$file = glob($black . '*.*');//files only
$dirlen = count($file);
for ($index = 0; $index < $dirlen; $index++) {
$levelfile = explode('/', $file[$index]);
$lastlevel = sizeof($levelfile);
$goalFile = $levelfile[$lastlevel - 1];
$newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile);
CLI::logging("Migrating $blackHoleDir file: $goalFile\n");
G::mk_dir($blackHoleDir . '/' . $newpattern[0]);
//echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`;
if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) {
unlink($file[$index]);
} else {
CLI::logging("Error: Failure at copy $file[$index] files...\n");
}
}
}
//Set value of 2 to the directory structure version.
$this->initPropel(true);
G::LoadClass("configuration");
$conf = new Configurations();
if ($conf->exists("ENVIRONMENT_SETTINGS")) {
$conf->setDirectoryStructureVer(2);
CLI::logging("Please notice Version Directory Structure is 2 now.\n");
} else {
CLI::logging("Error: Issue found at try to use ENVIRONMENT_SETTINGS row.\n");
return;
}
}
/**
* Upgrade this workspace database to the latest plugins schema
*/

View File

@@ -434,7 +434,7 @@ class AppFolder extends BaseAppFolder
$info = pathinfo($oAppDocument->getAppDocFilename());
$version = (!empty($docVersion))? "_" . $docVersion : "_1";
$outDocPath = PATH_DOCUMENT . $row1["APP_UID"] . PATH_SEP . "outdocs" . PATH_SEP;
$outDocPath = PATH_DOCUMENT . G::getPathFromUID($row1["APP_UID"]) . PATH_SEP . "outdocs" . PATH_SEP;
if (file_exists($outDocPath . $appDocUid . $version . ".pdf") ||
file_exists($outDocPath . $info["basename"] . $version . ".pdf") ||

View File

@@ -177,8 +177,12 @@ class Translation extends BaseTranslation
//$json = new Services_JSON(); DEPRECATED
$f = fopen( $cacheFileJS, 'w' );
if ($f==false) {
echo "Error: Cannot write into cachefilejs: $cacheFileJS\n";
} else {
fwrite( $f, "var G_STRINGS =" . Bootstrap::json_encode( $translationJS ) . ";\n" );
fclose( $f );
}
$res['cacheFile'] = $cacheFile;
$res['cacheFileJS'] = $cacheFileJS;

View File

@@ -1258,7 +1258,7 @@ function uploadExternalDocument()
$aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']);
}
$oAppDocument = new AppDocument();
//Get the Custom Folder ID (create if necessary)
$oFolder=new AppFolder();
@@ -1272,6 +1272,7 @@ function uploadExternalDocument()
$fileTags="EXTERNAL";
}
foreach ($quequeUpload as $key => $fileObj) {
$oAppDocument = new AppDocument();
switch ($actionType) {
case "R":
//replace
@@ -1333,15 +1334,18 @@ function uploadExternalDocument()
}
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = (isset($info['extension']) ? $info['extension'] : '');
//save the file
//if (!empty($_FILES['form'])) {
//if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . $appId . PATH_SEP;
$sFileName = $sAppDocUid . "_".$iDocVersion. '.' . $ext;
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName);
$sPathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
$file = G::getPathFromFileUID($appId, $sAppDocUid);
$sPathName .= $file[0];
$sFileName = $file[1] . "_" . $iDocVersion . '.' . $ext;
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton();

View File

@@ -123,7 +123,7 @@ try {
//save the file
if (!empty($_FILES['form'])) {
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . $appId . PATH_SEP;
$sPathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
$sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext;
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName);

View File

@@ -53,9 +53,9 @@ function casesShowOuputDocumentExist ($url)
$ver = '_1';
}
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . '.' . $ext;
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . '.' . $ext;
$sw_file_exists = false;
if (file_exists( $realPath )) {
$sw_file_exists = true;

View File

@@ -225,6 +225,7 @@ try {
//Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder();
$documentFileStructure = $oFolder->getFolderStructure();
$aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName
);
@@ -240,9 +241,9 @@ try {
$sAppDocUid = $oAppDocument->getAppDocUid();
$aInfo = pathinfo( $oAppDocument->getAppDocFilename() );
$sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : "");
$sPathName = PATH_DOCUMENT . $_SESSION["APPLICATION"] . PATH_SEP;
$pathUID = G::getPathFromUID($_SESSION["APPLICATION"]);
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;// . $documentFileStructure;
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document

View File

@@ -29,6 +29,9 @@
require_once ("classes/model/AppDocumentPeer.php");
//v = Version
//a = Case UID
$oAppDocument = new AppDocument();
if (! isset( $_GET['v'] )) {
//Load last version of the document
@@ -42,7 +45,7 @@ $oAppDocument->Fields = $oAppDocument->load( $_GET['a'], $docVersion );
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo( $oAppDocument->getAppDocFilename() );
$ext = $info['extension'];
$ext = (isset($info['extension'])?$info['extension']:'');//BUG fix: must handle files without any extension
if (isset( $_GET['b'] )) {
if ($_GET['b'] == '0') {
@@ -54,8 +57,11 @@ if (isset( $_GET['b'] )) {
$bDownload = true;
}
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '.' . $ext;
$app_uid = G::getPathFromUID($oAppDocument->Fields['APP_UID']);
$file = G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext;
$sw_file_exists = false;
if (file_exists( $realPath )) {
$sw_file_exists = true;
@@ -65,7 +71,7 @@ if (file_exists( $realPath )) {
}
if (! $sw_file_exists) {
$error_message = "'" . $oAppDocument->Fields['APP_DOC_FILENAME'] . "' " . G::LoadTranslation( 'ID_ERROR_STREAMING_FILE' );
$error_message = "'" .$realPath." " .$realPath1." ". $oAppDocument->Fields['APP_DOC_FILENAME'] . "' " . G::LoadTranslation( 'ID_ERROR_STREAMING_FILE' );
if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) {
$res['success'] = 'failure';
$res['message'] = $error_message;
@@ -83,7 +89,7 @@ if (! $sw_file_exists) {
$res['message'] = $oAppDocument->Fields['APP_DOC_FILENAME'];
print G::json_encode( $res );
} else {
G::streamFile( $realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME'] );
G::streamFile( $realPath, $bDownload, $oAppDocument->Fields['APP_DOC_FILENAME'] ); //download
}
}

View File

@@ -48,9 +48,9 @@ $ver = (isset( $_GET['v'] ) && $_GET['v'] != '') ? '_' . $_GET['v'] : '';
if (! $ver) //This code is in the case the outputdocument won't be versioned
$ver = '_1';
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . '.' . $ext;
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . '.' . $ext;
$sw_file_exists = false;
if (file_exists( $realPath )) {

View File

@@ -57,6 +57,6 @@ if (! isset( $_GET['ext'] )) {
}
}
$realPath = PATH_DOCUMENT . $_SESSION['APPLICATION'] . '/outdocs/' . $info['basename'] . '.' . $ext;
$realPath = PATH_DOCUMENT . G::getPathFromUID($_SESSION['APPLICATION']) . '/outdocs/' . $info['basename'] . '.' . $ext;
G::streamFile( $realPath, true );

View File

@@ -411,7 +411,7 @@ try {
$sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
$pathOutput = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs' . PATH_SEP;
$pathOutput = PATH_DOCUMENT . G::getPathFromUID($_SESSION['APPLICATION']) . PATH_SEP . 'outdocs' . PATH_SEP;
G::mk_dir( $pathOutput );
switch ($aOD['OUT_DOC_TYPE']) {
case 'HTML':
@@ -518,7 +518,7 @@ try {
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
$sPathName = PATH_DOCUMENT . G::getPathFromUID($_SESSION['APPLICATION']) . PATH_SEP;
$oData['APP_UID'] = $_SESSION['APPLICATION'];
$oData['ATTACHMENT_FOLDER'] = true;

View File

@@ -36,7 +36,7 @@ try {
//save the file
if (! empty( $_FILES['form'] )) {
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
$sPathName = PATH_DOCUMENT . $_GET['APP_UID'] . PATH_SEP;
$sPathName = PATH_DOCUMENT . G::getPathFromUID($_GET['APP_UID']) . PATH_SEP;
$sFileName = $sAppDocUid . '.' . $ext;
G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );

View File

@@ -106,7 +106,7 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
$ext = (isset( $info["extension"] )) ? $info["extension"] : "";
//Save the file
echo $sPathName = PATH_DOCUMENT . $sAppUid . PATH_SEP;
echo $sPathName = PATH_DOCUMENT . G::getPathFromUID($sAppUid) . PATH_SEP;
echo $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $ext;
print G::uploadFile( $_FILES["ATTACH_FILE"]["tmp_name"], $sPathName, $sFileName );
print ("* The file " . $_FILES["ATTACH_FILE"]["name"] . " was uploaded successfully in case " . $sAppUid . " as input document..\n") ;

View File

@@ -47,8 +47,8 @@ if (isset( $_GET['b'] )) {
$bDownload = true;
}
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/' . $sAppDocUid . '.' . $ext;
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/' . $sAppDocUid . '.' . $ext;
$sw_file_exists = false;
if (file_exists( $realPath )) {
$sw_file_exists = true;

View File

@@ -47,9 +47,9 @@ $ver = (isset( $_GET['v'] ) && $_GET['v'] != '') ? '_' . $_GET['v'] : '';
if (! $ver) //This code is in the case the outputdocument won't be versioned
$ver = '_1';
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] . '.' . $ext;
$realPath = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $sAppDocUid . $ver . '.' . $ext;
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . $ver . '.' . $ext;
$realPath2 = PATH_DOCUMENT . G::getPathFromUID($oAppDocument->Fields['APP_UID']) . '/outdocs/' . $info['basename'] . '.' . $ext;
$sw_file_exists = false;
if (file_exists( $realPath )) {
$sw_file_exists = true;