Code Duplication    Length = 28-29 lines in 2 locations

code/control/DNRoot.php 2 locations

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