preparations for dynamic data directories

This commit is contained in:
Chris
2023-11-02 23:20:05 +01:00
parent 3fe84a63a4
commit 2388f68d5d
17 changed files with 93 additions and 55 deletions

View File

@@ -21,7 +21,7 @@ loadAllContentControllers();
executeUploadPermission();
// check write permissions first
if(!isFolderWritable(ROOT.DS.'data'))
if(!isFolderWritable(getDataDir()))
exit(json_encode(array('status'=>'err','reason'=>'Data directory not writable')));
else if(!isFolderWritable(ROOT.DS.'tmp'))
exit(json_encode(array('status'=>'err','reason'=>'Temp directory not writable')));
@@ -45,8 +45,8 @@ if($_REQUEST['base64'])
//check for duplicates
$sha1 = sha1_file($tmpfile);
$ehash = sha1Exists($sha1);
if($ehash && file_exists(ROOT.DS.'data'.DS.$ehash.DS.$ehash))
exit(json_encode(array('status'=>'ok','hash'=>$ehash,'filetype'=>$type,'url'=>URL.$ehash)));
if($ehash && file_exists(getDataDir().DS.$ehash.DS.$ehash))
exit(json_encode(array('status'=>'ok','hash'=>$ehash,'filetype'=>$type,'url'=>getURL().$ehash)));
@@ -80,7 +80,7 @@ if($_REQUEST['base64'])
if(getDeleteCodeOfHash($answer['hash']))
{
$answer['delete_code'] = getDeleteCodeOfHash($answer['hash']);
$answer['delete_url'] = URL.'delete_'.getDeleteCodeOfHash($answer['hash']).'/'.$answer['hash'];
$answer['delete_url'] = getURL().'delete_'.getDeleteCodeOfHash($answer['hash']).'/'.$answer['hash'];
}
storageControllerUpload($answer['hash']);