Code Duplication    Length = 28-29 lines in 2 locations

code/control/DNRoot.php 2 locations

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