Code Duplication    Length = 20-24 lines in 2 locations

Sources/Subs-Package.php 2 locations

@@ 2463-2486 (lines=24) @@
2460
		if ($code_match[1] == 'file' || $code_match[1] == 'edit file')
2461
		{
2462
			// Backup the old file.
2463
			if ($working_file !== null)
2464
			{
2465
				package_chmod($working_file);
2466
2467
				// Don't even dare.
2468
				if (basename($working_file) == 'Settings_bak.php')
2469
					continue;
2470
2471
				if (!is_writable($working_file))
2472
					$actions[] = array(
2473
						'type' => 'chmod',
2474
						'filename' => $working_file
2475
					);
2476
2477
				if (!$testing && !empty($modSettings['package_make_backups']) && file_exists($working_file))
2478
				{
2479
					if (basename($working_file) == 'Settings.php')
2480
						@copy($working_file, dirname($working_file) . '/Settings_bak.php');
2481
					else
2482
						@copy($working_file, $working_file . '~');
2483
				}
2484
2485
				package_put_contents($working_file, $working_data, $testing);
2486
			}
2487
2488
			if ($working_file !== null)
2489
				$actions[] = array(
@@ 2629-2648 (lines=20) @@
2626
	}
2627
2628
	// Backup the old file.
2629
	if ($working_file !== null)
2630
	{
2631
		package_chmod($working_file);
2632
2633
		if (!is_writable($working_file))
2634
			$actions[] = array(
2635
				'type' => 'chmod',
2636
				'filename' => $working_file
2637
			);
2638
2639
		if (!$testing && !empty($modSettings['package_make_backups']) && file_exists($working_file))
2640
		{
2641
			if (basename($working_file) == 'Settings.php')
2642
				@copy($working_file, dirname($working_file) . '/Settings_bak.php');
2643
			else
2644
				@copy($working_file, $working_file . '~');
2645
		}
2646
2647
		package_put_contents($working_file, $working_data, $testing);
2648
	}
2649
2650
	if ($working_file !== null)
2651
		$actions[] = array(