Browse Source

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
Laurent Destailleur 3 years ago
parent
commit
1ff6c33276
1 changed files with 5 additions and 1 deletions
  1. 5 1
      htdocs/core/lib/files.lib.php

+ 5 - 1
htdocs/core/lib/files.lib.php

@@ -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);