Code Duplication    Length = 28-29 lines in 2 locations

code/control/DNRoot.php 2 locations

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