Code Duplication    Length = 28-29 lines in 2 locations

code/control/DNRoot.php 2 locations

@@ 884-911 (lines=28) @@
881
	}
882
883
884
	public function createenvlog(SS_HTTPRequest $request) {
885
		$this->setCurrentActionType(self::ACTION_SNAPSHOT);
886
887
		$params = $request->params();
888
		$env = DNCreateEnvironment::get()->byId($params['Identifier']);
889
890
		if(!$env || !$env->ID) {
891
			throw new SS_HTTPResponse_Exception('Log not found', 404);
892
		}
893
		if(!$env->canView()) {
894
			return Security::permissionFailure();
895
		}
896
897
		$project = $env->Project();
898
899
		if($project->Name != $params['Project']) {
900
			throw new LogicException("Project in URL doesn't match this deploy");
901
		}
902
903
		$log = $env->log();
904
		if($log->exists()) {
905
			$content = $log->content();
906
		} else {
907
			$content = 'Waiting for action to start';
908
		}
909
910
		return $this->sendResponse($env->ResqueStatus(), $content);
911
	}
912
913
	/**
914
	 * @param SS_HTTPRequest $request
@@ 1685-1713 (lines=29) @@
1682
	 * @return string
1683
	 * @throws SS_HTTPResponse_Exception
1684
	 */
1685
	public function transferlog(SS_HTTPRequest $request) {
1686
		$this->setCurrentActionType(self::ACTION_SNAPSHOT);
1687
1688
		$params = $request->params();
1689
		$transfer = DNDataTransfer::get()->byId($params['Identifier']);
1690
1691
		if(!$transfer || !$transfer->ID) {
1692
			throw new SS_HTTPResponse_Exception('Transfer not found', 404);
1693
		}
1694
		if(!$transfer->canView()) {
1695
			return Security::permissionFailure();
1696
		}
1697
1698
		$environment = $transfer->Environment();
1699
		$project = $environment->Project();
1700
1701
		if($project->Name != $params['Project']) {
1702
			throw new LogicException("Project in URL doesn't match this deploy");
1703
		}
1704
1705
		$log = $transfer->log();
1706
		if($log->exists()) {
1707
			$content = $log->content();
1708
		} else {
1709
			$content = 'Waiting for action to start';
1710
		}
1711
1712
		return $this->sendResponse($transfer->ResqueStatus(), $content);
1713
	}
1714
1715
	/**
1716
	 * Note: Submits to the same action as {@link getDataTransferForm()},