Code Duplication    Length = 9-10 lines in 2 locations

lib/private/Files/Type/Detection.php 1 location

@@ 245-253 (lines=9) @@
242
		if (function_exists('finfo_open') and function_exists('finfo_file')) {
243
			$finfo = finfo_open(FILEINFO_MIME);
244
			return finfo_buffer($finfo, $data);
245
		} else {
246
			$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
247
			$fh = fopen($tmpFile, 'wb');
248
			fwrite($fh, $data, 8024);
249
			fclose($fh);
250
			$mime = $this->detect($tmpFile);
251
			unset($tmpFile);
252
			return $mime;
253
		}
254
	}
255
256
	/**

lib/private/Preview/Movie.php 1 location

@@ 57-66 (lines=10) @@
54
55
		if ($useFileDirectly) {
56
			$absPath = $fileview->getLocalFile($path);
57
		} else {
58
			$absPath = \OC::$server->getTempManager()->getTemporaryFile();
59
60
			$handle = $fileview->fopen($path, 'rb');
61
62
			// we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB.
63
			// in some cases 1MB was no enough to generate thumbnail
64
			$firstmb = stream_get_contents($handle, 5242880);
65
			file_put_contents($absPath, $firstmb);
66
		}
67
68
		$result = $this->generateThumbNail($maxX, $maxY, $absPath, 5);
69
		if ($result === false) {