Code Duplication    Length = 5-12 lines in 2 locations

includes/MimeMagic.php 1 location

@@ 789-793 (lines=5) @@
786
		$gis = getimagesize( $file );
787
		MediaWiki\restoreWarnings();
788
789
		if ( $gis && isset( $gis['mime'] ) ) {
790
			$mime = $gis['mime'];
791
			wfDebug( __METHOD__ . ": getimagesize detected $file as $mime\n" );
792
			return $mime;
793
		}
794
795
		// Also test DjVu
796
		$deja = new DjVuImage( $file );

includes/filerepo/ForeignAPIRepo.php 1 location

@@ 349-360 (lines=12) @@
346
347
		/* Get the array of urls that we already know */
348
		$knownThumbUrls = $cache->get( $key );
349
		if ( !$knownThumbUrls ) {
350
			/* No knownThumbUrls for this file */
351
			$knownThumbUrls = [];
352
		} else {
353
			if ( isset( $knownThumbUrls[$sizekey] ) ) {
354
				wfDebug( __METHOD__ . ': Got thumburl from local cache: ' .
355
					"{$knownThumbUrls[$sizekey]} \n" );
356
357
				return $knownThumbUrls[$sizekey];
358
			}
359
			/* This size is not yet known */
360
		}
361
362
		$metadata = null;
363
		$foreignUrl = $this->getThumbUrl( $name, $width, $height, $metadata, $params );