Completed
Branch develop (97ae92)
by
unknown
26:06
created
htdocs/core/lib/files.lib.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	$utf8_path = preg_replace('/([\\/]+)$/', '', $utf8_path);
106 106
 
107 107
 	if (preg_match('/\*/', $utf8_path)) {
108
-		$utf8_path_array = glob($utf8_path, GLOB_ONLYDIR);	// This scan dir for files. If file does not exists, return empty.
108
+		$utf8_path_array = glob($utf8_path, GLOB_ONLYDIR); // This scan dir for files. If file does not exists, return empty.
109 109
 		//$os_path_array = dol_dir_list($utf8_path);
110 110
 	} else {
111 111
 		$utf8_path_array = array($utf8_path);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				'types' => $types,
124 124
 				'recursive' => $recursive,
125 125
 				'filter' => $filter,
126
-				'excludefilter' => $exclude_array,  // Already converted to array.
126
+				'excludefilter' => $exclude_array, // Already converted to array.
127 127
 				'sortcriteria' => $sortcriteria,
128 128
 				'sortorder' => $sortorder,
129 129
 				'loaddate' => $loaddate,
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 				$qualified = 1;
160 160
 
161
-				$utf8_fullpathfile = $utf8_path_cursor."/".$utf8_file;  // Temp variable for speed
161
+				$utf8_fullpathfile = $utf8_path_cursor."/".$utf8_file; // Temp variable for speed
162 162
 
163 163
 				// Check if file is qualified
164 164
 				foreach ($excludefilterarray as $filt) {
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	// Recursive function to copy all subdirectories and contents:
964 964
 	if (is_dir($ossrcfile)) {
965 965
 		$dir_handle = opendir($ossrcfile);
966
-		$tmpresult = 0;  // Initialised before loop to keep old behavior, may be needed inside loop
966
+		$tmpresult = 0; // Initialised before loop to keep old behavior, may be needed inside loop
967 967
 		while ($file = readdir($dir_handle)) {
968 968
 			if ($file != "." && $file != ".." && !is_link($ossrcfile."/".$file)) {
969 969
 				if (is_dir($ossrcfile."/".$file)) {
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 					if (!empty($moreinfo) && !empty($moreinfo['gen_or_uploaded'])) {
1147 1147
 						$ecmfile->gen_or_uploaded = $moreinfo['gen_or_uploaded'];
1148 1148
 					} else {
1149
-						$ecmfile->gen_or_uploaded = 'undefined';	// or 'generated', 'uploaded'
1149
+						$ecmfile->gen_or_uploaded = 'undefined'; // or 'generated', 'uploaded'
1150 1150
 					}
1151 1151
 					if (!empty($moreinfo) && !empty($moreinfo['description'])) {
1152 1152
 						$ecmfile->description = $moreinfo['description']; // indexed content
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 
1500 1500
 		if ($return) {
1501 1501
 			dolChmod($file_name_osencoded);
1502
-			dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=" . getDolGlobalString('MAIN_UMASK'), LOG_DEBUG);
1502
+			dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".getDolGlobalString('MAIN_UMASK'), LOG_DEBUG);
1503 1503
 			return $successcode; // Success
1504 1504
 		} else {
1505 1505
 			dol_syslog("Files.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR);
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
 			$ok = true;
1566 1566
 			$globencoded = str_replace('[', '\[', $file_osencoded);
1567 1567
 			$globencoded = str_replace(']', '\]', $globencoded);
1568
-			$listofdir = glob($globencoded);	// This scan dir for files. If file does not exists, return empty.
1568
+			$listofdir = glob($globencoded); // This scan dir for files. If file does not exists, return empty.
1569 1569
 
1570 1570
 			if (!empty($listofdir) && is_array($listofdir)) {
1571 1571
 				foreach ($listofdir as $filename) {
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 					$maxwidthmini = $tmparraysize['maxwidthmini'];
2047 2047
 					$maxheightmini = $tmparraysize['maxheightmini'];
2048 2048
 					//$quality = $tmparraysize['quality'];
2049
-					$quality = 50;	// For thumbs, we force quality to 50
2049
+					$quality = 50; // For thumbs, we force quality to 50
2050 2050
 
2051 2051
 					// Generate thumbs.
2052 2052
 					if ($generatethumbs) {
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 			if (isset($object->table_element)) {
2241 2241
 				$ecmfile->src_object_type = $object->table_element;
2242 2242
 			} else {
2243
-				dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.');
2243
+				dol_syslog('Error: object '.get_class($object).' has no table_element attribute.');
2244 2244
 				return -1;
2245 2245
 			}
2246 2246
 			if (isset($object->src_object_description)) {
@@ -2537,9 +2537,9 @@  discard block
 block discarded – undo
2537 2537
 					// Skip directories (they would be added automatically)
2538 2538
 					if (!$file->isDir()) {
2539 2539
 						// Get real and relative path for current file
2540
-						$filePath = $file->getPath();				// the full path with filename using the $inputdir root.
2540
+						$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
2541 2541
 						$fileName = $file->getFilename();
2542
-						$fileFullRealPath = $file->getRealPath();	// the full path with name and transformed to use real path directory.
2542
+						$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
2543 2543
 
2544 2544
 						//$relativePath = substr($fileFullRealPath, strlen($rootPath) + 1);
2545 2545
 						$relativePath = substr(($filePath ? $filePath.'/' : '').$fileName, strlen($rootPath) + 1);
@@ -2811,9 +2811,9 @@  discard block
 block discarded – undo
2811 2811
 					// Skip directories (they would be added automatically)
2812 2812
 					if (!$file->isDir()) {
2813 2813
 						// Get real and relative path for current file
2814
-						$filePath = $file->getPath();				// the full path with filename using the $inputdir root.
2814
+						$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
2815 2815
 						$fileName = $file->getFilename();
2816
-						$fileFullRealPath = $file->getRealPath();	// the full path with name and transformed to use real path directory.
2816
+						$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
2817 2817
 
2818 2818
 						//$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($fileFullRealPath, strlen($inputdir) + 1);
2819 2819
 						$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr(($filePath ? $filePath.'/' : '').$fileName, strlen($inputdir) + 1);
@@ -3920,7 +3920,7 @@  discard block
 block discarded – undo
3920 3920
 function archiveOrBackupFile($srcfile, $max_versions = 5, $archivedir = '', $suffix = "v", $moveorcopy = 'move')
3921 3921
 {
3922 3922
 	$base_file_pattern = ($archivedir ? $archivedir : dirname($srcfile)).'/'.basename($srcfile).".".$suffix;
3923
-	$files_in_directory = glob($base_file_pattern . "*");
3923
+	$files_in_directory = glob($base_file_pattern."*");
3924 3924
 
3925 3925
 	// Extract the modification timestamps for each file
3926 3926
 	$files_with_timestamps = [];
@@ -3961,7 +3961,7 @@  discard block
 block discarded – undo
3961 3961
 	}
3962 3962
 
3963 3963
 	$timestamp = dol_now('gmt');
3964
-	$new_backup = $srcfile . ".v" . $timestamp;
3964
+	$new_backup = $srcfile.".v".$timestamp;
3965 3965
 
3966 3966
 	// Move or copy the original file to the new backup with the timestamp
3967 3967
 	if ($moveorcopy == 'move') {
Please login to merge, or discard this patch.