Merge pull request #17537 from kastoras/create_share_on_file_upload_with_other_setup

New Add option MAIN_FORCE_SHARING_ON_ANY_UPLOADED_FILE to share file on any file upload
This commit is contained in:
Laurent Destailleur 2021-08-17 20:11:54 +02:00 committed by GitHub
commit 1ff6c33276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1766,7 +1766,7 @@ function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletef
*/
function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uploaded', $setsharekey = 0, $object = null)
{
global $db, $user;
global $db, $user, $conf;
$result = 0;
@ -1799,6 +1799,10 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords;
}
if (!empty($conf->global->MAIN_FORCE_SHARING_ON_ANY_UPLOADED_FILE)) {
$setsharekey = 1;
}
if ($setsharekey) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$ecmfile->share = getRandomPassword(true);