Code Duplication    Length = 4-7 lines in 3 locations

Sources/Subs-Package.php 3 locations

@@ 633-639 (lines=7) @@
630
				{
631
					// Use FTP if we have it.
632
					// @todo where does $package_ftp get set?
633
					if (!empty($package_ftp))
634
					{
635
						$ftp_file = strtr($file, array($_SESSION['pack_ftp']['root'] => ''));
636
						$package_ftp->chmod($ftp_file, $perms);
637
					}
638
					else
639
						smf_chmod($file, $perms);
640
641
					$new_permissions = @fileperms($file);
642
					$result = $new_permissions == $perms ? 'success' : 'failure';
@@ 1831-1834 (lines=4) @@
1828
	{
1829
		if (!is_writable($strPath) && $mode !== false)
1830
		{
1831
			if (isset($package_ftp))
1832
				$package_ftp->chmod(strtr($strPath, array($_SESSION['pack_ftp']['root'] => '')), $mode);
1833
			else
1834
				smf_chmod($strPath, $mode);
1835
		}
1836
1837
		$test = @opendir($strPath);
@@ 1852-1855 (lines=4) @@
1849
1850
	if (!is_writable(dirname($strPath)) && $mode !== false)
1851
	{
1852
		if (isset($package_ftp))
1853
			$package_ftp->chmod(dirname(strtr($strPath, array($_SESSION['pack_ftp']['root'] => ''))), $mode);
1854
		else
1855
			smf_chmod(dirname($strPath), $mode);
1856
	}
1857
1858
	if ($mode !== false && isset($package_ftp))