Completed
Push — master ( 0e2358...5e7c93 )
by Sean
06:29 queued 02:57
created
code/api/nouns/APIProject.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 	 * @return SS_HTTPResponse
16 16
 	 */
17 17
 	public function index(SS_HTTPRequest $request) {
18
-		if(!$this->record->canView($this->getMember())) {
18
+		if (!$this->record->canView($this->getMember())) {
19 19
 			return $this->message('You are not authorized to this environment', 403);
20 20
 		}
21 21
 
22
-		switch($request->httpMethod()) {
22
+		switch ($request->httpMethod()) {
23 23
 			case 'GET':
24 24
 				$response = array(
25 25
 					"name" => $this->record->Name,
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 					"disk-quota-mb" => $this->record->DiskQuotaMB,
30 30
 					"environments" => array(),
31 31
 				);
32
-				foreach($this->record->DNEnvironmentList() as $environment) {
32
+				foreach ($this->record->DNEnvironmentList() as $environment) {
33 33
 					$response['environments'][] = array(
34 34
 						'name' => $environment->Name,
35 35
 						'href' => Director::absoluteURL($this->record->APILink($environment->Name)),
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 * @return SS_HTTPResponse
48 48
 	 */
49 49
 	public function fetch(SS_HTTPRequest $request) {
50
-		if(!$this->record->canView($this->getMember())) {
50
+		if (!$this->record->canView($this->getMember())) {
51 51
 			return $this->message('You are not authorized to do that on this environment', 403);
52 52
 		}
53
-		switch($request->httpMethod()) {
53
+		switch ($request->httpMethod()) {
54 54
 			case 'GET':
55 55
 				return $this->getFetch($this->getRequest()->param('ID'));
56 56
 			case 'POST':
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	protected function getFetch($ID) {
68 68
 		$ping = DNGitFetch::get()->byID($ID);
69
-		if(!$ping) {
69
+		if (!$ping) {
70 70
 			return $this->message('Fetch not found', 404);
71 71
 		}
72 72
 		$output = array(
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 		$fetch->write();
88 88
 		$fetch->start();
89 89
 
90
-		$location = Director::absoluteBaseURL() . $this->Link() . '/fetch/' . $fetch->ID;
90
+		$location = Director::absoluteBaseURL().$this->Link().'/fetch/'.$fetch->ID;
91 91
 		$output = array(
92
-			'message' => 'Fetch queued as job ' . $fetch->ResqueToken,
92
+			'message' => 'Fetch queued as job '.$fetch->ResqueToken,
93 93
 			'href' => $location,
94 94
 		);
95 95
 
Please login to merge, or discard this patch.
code/api/nouns/APIEnvironment.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 	 * @return SS_HTTPResponse
16 16
 	 */
17 17
 	public function index(SS_HTTPRequest $request) {
18
-		if(!$this->record->canView($this->getMember())) {
18
+		if (!$this->record->canView($this->getMember())) {
19 19
 			return $this->message('You are not authorized to view this environment', 403);
20 20
 		}
21
-		switch($request->httpMethod()) {
21
+		switch ($request->httpMethod()) {
22 22
 			case 'GET':
23 23
 				$href = Director::absoluteURL($this->record->Project()->APILink($this->record->Name));
24 24
 				return $this->getAPIResponse(array(
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @return SS_HTTPResponse
52 52
 	 */
53 53
 	public function ping(SS_HTTPRequest $request) {
54
-		if(!$this->record->canView($this->getMember())) {
54
+		if (!$this->record->canView($this->getMember())) {
55 55
 			return $this->message('You are not authorized to do that on this environment', 403);
56 56
 		}
57
-		switch($request->httpMethod()) {
57
+		switch ($request->httpMethod()) {
58 58
 			case 'GET':
59 59
 				return $this->getPing($this->getRequest()->param('ID'));
60 60
 			case 'POST':
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 	 * @return SS_HTTPResponse
72 72
 	 */
73 73
 	public function deploy(SS_HTTPRequest $request) {
74
-		if(!$this->record->canView($this->getMember())) {
74
+		if (!$this->record->canView($this->getMember())) {
75 75
 			return $this->message('You are not authorized to do that on this environment', 403);
76 76
 		}
77
-		switch($request->httpMethod()) {
77
+		switch ($request->httpMethod()) {
78 78
 			case 'GET':
79 79
 				return $this->getDeploy($this->getRequest()->param('ID'));
80 80
 			case 'POST':
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @return SS_HTTPResponse
107 107
 	 */
108 108
 	protected function createPing() {
109
-		if(!$this->record->canDeploy($this->getMember())) {
109
+		if (!$this->record->canDeploy($this->getMember())) {
110 110
 			return $this->message('You are not authorized to do that on this environment', 403);
111 111
 		}
112 112
 		$ping = DNPing::create();
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 		$ping->write();
115 115
 		$ping->start();
116 116
 
117
-		$location = Director::absoluteBaseURL() . $this->Link() . '/ping/' . $ping->ID;
117
+		$location = Director::absoluteBaseURL().$this->Link().'/ping/'.$ping->ID;
118 118
 		$output = array(
119
-			'message' => 'Ping queued as job ' . $ping->ResqueToken,
119
+			'message' => 'Ping queued as job '.$ping->ResqueToken,
120 120
 			'href' => $location,
121 121
 		);
122 122
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	protected function getPing($ID) {
134 134
 		$ping = DNPing::get()->byID($ID);
135
-		if(!$ping) {
135
+		if (!$ping) {
136 136
 			return $this->message('Ping not found', 404);
137 137
 		}
138 138
 		$output = array(
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 	 * @return SS_HTTPResponse
150 150
 	 */
151 151
 	protected function createDeploy() {
152
-		if(!$this->record->canDeploy($this->getMember())) {
152
+		if (!$this->record->canDeploy($this->getMember())) {
153 153
 			return $this->message('You are not authorized to do that on this environment', 403);
154 154
 		}
155 155
 
156 156
 		$reqBody = $this->getRequestBody();
157 157
 
158
-		if($reqBody === null) {
158
+		if ($reqBody === null) {
159 159
 			return $this->message('the request body did not contain a valid JSON object.', 400);
160 160
 		}
161 161
 
162
-		if(empty($reqBody['release'])) {
162
+		if (empty($reqBody['release'])) {
163 163
 			return $this->message('deploy requires a {"release": "sha1"} in the body of the request.', 400);
164 164
 		}
165 165
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
 		));
169 169
 		$deploy = $strategy->createDeployment();
170 170
 		$deploy->start();
171
-		$location = Director::absoluteBaseURL() . $this->Link() . '/deploy/' . $deploy->ID;
171
+		$location = Director::absoluteBaseURL().$this->Link().'/deploy/'.$deploy->ID;
172 172
 		$output = array(
173
-			'message' => 'Deploy queued as job ' . $deploy->ResqueToken,
173
+			'message' => 'Deploy queued as job '.$deploy->ResqueToken,
174 174
 			'href' => $location,
175 175
 		);
176 176
 		$response = $this->getAPIResponse($output);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	protected function getDeploy($id) {
189 189
 		$deploy = DNDeployment::get()->byID($id);
190
-		if(!$deploy) {
190
+		if (!$deploy) {
191 191
 			return $this->message('Deploy not found', 404);
192 192
 		}
193 193
 		$output = array(
Please login to merge, or discard this patch.
code/api/DeploynautAPI.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 			'projects' => array(),
52 52
 		);
53 53
 
54
-		if($request->httpMethod() != 'GET') {
54
+		if ($request->httpMethod() != 'GET') {
55 55
 			return $this->message('API not found', 404);
56 56
 		}
57 57
 
58
-		foreach(DNProject::get() as $item) {
59
-			if($item->canView($this->getMember())) {
58
+		foreach (DNProject::get() as $item) {
59
+			if ($item->canView($this->getMember())) {
60 60
 				$response['projects'][] = array(
61 61
 					"name" => $item->Name,
62 62
 					"href" => Director::absoluteURL($item->APILink("")),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function project(SS_HTTPRequest $request) {
77 77
 		$project = $this->getProject();
78
-		if(!$project) {
78
+		if (!$project) {
79 79
 			return $this->project404Response();
80 80
 		}
81 81
 		return new APIProject($this, $project);
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function environment(SS_HTTPRequest $request) {
91 91
 		$project = $this->getProject();
92
-		if(!$project) {
92
+		if (!$project) {
93 93
 			return $this->project404Response();
94 94
 		}
95 95
 
96 96
 		$environment = $this->getEnvironment();
97
-		if(!$environment) {
97
+		if (!$environment) {
98 98
 			return $this->environment404Response();
99 99
 		}
100 100
 		return new APIEnvironment($this, $environment);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function project404Response() {
107 107
 		$projectName = Convert::raw2xml($this->getRequest()->latestParam('Project'));
108
-		return new SS_HTTPResponse('Project "' . $projectName . '" not found.', 404);
108
+		return new SS_HTTPResponse('Project "'.$projectName.'" not found.', 404);
109 109
 	}
110 110
 
111 111
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	protected function environment404Response() {
115 115
 		$envName = Convert::raw2xml($this->getRequest()->latestParam('Environment'));
116
-		return new SS_HTTPResponse('Environment "' . $envName . '" not found.', 404);
116
+		return new SS_HTTPResponse('Environment "'.$envName.'" not found.', 404);
117 117
 	}
118 118
 
119 119
 	/**
Please login to merge, or discard this patch.
code/tasks/MigrateDeploymentStatusTask.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 	public function run($request) {
6 6
 		$log = function($message) {
7
-			$message = sprintf('[%s] ', date('Y-m-d H:i:s')) . $message;
8
-			echo $message . PHP_EOL;
7
+			$message = sprintf('[%s] ', date('Y-m-d H:i:s')).$message;
8
+			echo $message.PHP_EOL;
9 9
 		};
10 10
 
11 11
 		if (!Director::is_cli()) {
Please login to merge, or discard this patch.
code/model/GitonomyCache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
 	public static $cache = array();
8 8
 
9 9
 	public static function getIncludingBranches($commit) {
10
-		$cacheKey = 'getIncludingBranches-' . $commit->getRepository()->getPath() . '-' . $commit->gethash();
11
-		if(!isset(self::$cache[$cacheKey])) {
10
+		$cacheKey = 'getIncludingBranches-'.$commit->getRepository()->getPath().'-'.$commit->gethash();
11
+		if (!isset(self::$cache[$cacheKey])) {
12 12
 			self::$cache[$cacheKey] = $commit->getIncludingBranches();
13 13
 		}
14 14
 		return self::$cache[$cacheKey];
Please login to merge, or discard this patch.
code/model/DNBranchList.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
 
59 59
 		try {
60 60
 			$repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath());
61
-		} catch(Exception $e) {
61
+		} catch (Exception $e) {
62 62
 			return $branches;
63 63
 		}
64 64
 
65
-		foreach($repository->getReferences()->getBranches() as $branch) {
65
+		foreach ($repository->getReferences()->getBranches() as $branch) {
66 66
 			/** @var DNBranch $obj */
67 67
 			$obj = DNBranch::create($branch, $this->project, $this->data);
68
-			if($branch->getName() == 'master') {
68
+			if ($branch->getName() == 'master') {
69 69
 				$firstBranch = array($branch->getName() => $obj);
70 70
 			} else {
71 71
 				$branches[$branch->getName()] = $obj;
72 72
 			}
73 73
 		}
74
-		if($firstBranch) {
74
+		if ($firstBranch) {
75 75
 			$branches = $firstBranch + $branches;
76 76
 		}
77 77
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	 * @return string
87 87
 	 */
88 88
 	public function byName($name) {
89
-		if($this->loaded === false) {
89
+		if ($this->loaded === false) {
90 90
 			$this->getIterator();
91 91
 		}
92 92
 
93
-		if(isset($this->items[$name])) {
93
+		if (isset($this->items[$name])) {
94 94
 			return $this->items[$name];
95 95
 		}
96 96
 
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	 * @return ArrayIterator
105 105
 	 */
106 106
 	public function getIterator() {
107
-		if($this->loaded === false) {
107
+		if ($this->loaded === false) {
108 108
 			$this->items = $this->getReferences();
109 109
 			$this->loaded = true;
110 110
 		}
111
-		foreach($this->items as $i => $item) {
112
-			if(is_array($item)) {
111
+		foreach ($this->items as $i => $item) {
112
+			if (is_array($item)) {
113 113
 				$this->items[$i] = new ArrayData($item);
114 114
 			}
115 115
 		}
Please login to merge, or discard this patch.
code/model/jobs/DNCreateEnvironment.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return string
69 69
 	 */
70 70
 	public function LogLink() {
71
-		return $this->Link() . '/log';
71
+		return $this->Link().'/log';
72 72
 	}
73 73
 
74 74
 	/**
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 		$status = new Resque_Job_Status($this->ResqueToken);
111 111
 		$statusCode = $status->get();
112 112
 		// The Resque job can no longer be found, fallback to the DNDeployment.Status
113
-		if($statusCode === false) {
113
+		if ($statusCode === false) {
114 114
 			// Translate from the DNDeployment.Status to the Resque job status for UI purposes
115
-			switch($this->Status) {
115
+			switch ($this->Status) {
116 116
 				case 'Finished':
117 117
 					return 'Complete';
118 118
 				case 'Started':
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 			'projectName' => $project->Name
140 140
 		);
141 141
 
142
-		if(!$this->CreatorID) {
142
+		if (!$this->CreatorID) {
143 143
 			$this->CreatorID = Member::currentUserID();
144 144
 		}
145 145
 
146
-		if($this->CreatorID) {
146
+		if ($this->CreatorID) {
147 147
 			$creator = $this->Creator();
148 148
 			$message = sprintf(
149 149
 				'Environment creation for project %s initiated by %s (%s), with IP address %s',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 	public function createEnvironment() {
173 173
 		$backend = $this->getBackend();
174
-		if($backend) {
174
+		if ($backend) {
175 175
 			return $backend->createEnvironment($this);
176 176
 		}
177 177
 		throw new Exception("Unable to find backend.");
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function getBackend() {
187 187
 		$data = unserialize($this->Data);
188
-		if(isset($data['EnvironmentType']) && class_exists($data['EnvironmentType'])) {
188
+		if (isset($data['EnvironmentType']) && class_exists($data['EnvironmentType'])) {
189 189
 			$env = Injector::inst()->get($data['EnvironmentType']);
190
-			if($env instanceof EnvironmentCreateBackend) {
190
+			if ($env instanceof EnvironmentCreateBackend) {
191 191
 				return $env;
192 192
 			} else {
193
-				throw new Exception("Invalid backend: " . $data['EnvironmentType']);
193
+				throw new Exception("Invalid backend: ".$data['EnvironmentType']);
194 194
 			}
195 195
 		}
196 196
 		return null;
Please login to merge, or discard this patch.
code/model/jobs/DNDataTransfer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	public function getTitle() {
115
-		return $this->dbObject('Created')->Nice() . " (Status: {$this->Status})";
115
+		return $this->dbObject('Created')->Nice()." (Status: {$this->Status})";
116 116
 	}
117 117
 
118 118
 	public function Link() {
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 			'backupBeforePush' => $this->backupBeforePush
170 170
 		);
171 171
 
172
-		if(!$this->AuthorID) {
172
+		if (!$this->AuthorID) {
173 173
 			$this->AuthorID = Member::currentUserID();
174 174
 		}
175 175
 
176
-		if($this->AuthorID) {
176
+		if ($this->AuthorID) {
177 177
 			$author = $this->Author();
178 178
 			$message = sprintf(
179 179
 				'Data transfer on %s (%s, %s) initiated by %s (%s), with IP address %s',
@@ -231,23 +231,23 @@  discard block
 block discarded – undo
231 231
 
232 232
 	public function getDescription() {
233 233
 		$envName = $this->Environment()->getFullName();
234
-		if($this->Direction == 'get') {
235
-			if($this->Origin == 'ManualUpload') {
236
-				$description = 'Manual upload of ' . $this->getModeNice() . ' to ' . $envName;
237
-			} elseif($this->IsBackupDataTransfer()) {
238
-				$description = 'Automated backup of ' . $this->getModeNice() . ' from ' . $envName;
234
+		if ($this->Direction == 'get') {
235
+			if ($this->Origin == 'ManualUpload') {
236
+				$description = 'Manual upload of '.$this->getModeNice().' to '.$envName;
237
+			} elseif ($this->IsBackupDataTransfer()) {
238
+				$description = 'Automated backup of '.$this->getModeNice().' from '.$envName;
239 239
 			} else {
240
-				$description = 'Backup of ' . $this->getModeNice() . ' to ' . $envName;
240
+				$description = 'Backup of '.$this->getModeNice().' to '.$envName;
241 241
 			}
242 242
 		} else {
243
-			$description = 'Restore ' . $this->getModeNice() . ' to ' . $envName;
243
+			$description = 'Restore '.$this->getModeNice().' to '.$envName;
244 244
 		}
245 245
 
246 246
 		return $description;
247 247
 	}
248 248
 
249 249
 	public function getModeNice() {
250
-		if($this->Mode == 'all') {
250
+		if ($this->Mode == 'all') {
251 251
 			return 'database and assets';
252 252
 		} else {
253 253
 			return $this->Mode;
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 		$status = new Resque_Job_Status($this->ResqueToken);
288 288
 		$statusCode = $status->get();
289 289
 		// The Resque job can no longer be found, fallback to the DNDataTransfer.Status
290
-		if($statusCode === false) {
290
+		if ($statusCode === false) {
291 291
 			// Translate from the DNDataTransfer.Status to the Resque job status for UI purposes
292
-			switch($this->Status) {
292
+			switch ($this->Status) {
293 293
 				case 'Finished':
294 294
 					return 'Complete';
295 295
 				case 'Started':
Please login to merge, or discard this patch.
code/model/jobs/DNGitFetch.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 		$project = $this->Project();
55 55
 		$log = $this->log();
56 56
 
57
-		if(!$this->DeployerID) {
57
+		if (!$this->DeployerID) {
58 58
 			$this->DeployerID = Member::currentUserID();
59 59
 		}
60 60
 
61
-		if($this->DeployerID) {
61
+		if ($this->DeployerID) {
62 62
 			$deployer = $this->Deployer();
63 63
 			$message = sprintf(
64 64
 				'Update repository job for %s initiated by %s (%s)',
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 		$status = new Resque_Job_Status($this->ResqueToken);
132 132
 		$statusCode = $status->get();
133 133
 		// The Resque job can no longer be found, fallback to the DNDeployment.Status
134
-		if($statusCode === false) {
134
+		if ($statusCode === false) {
135 135
 			// Translate from the DNDeployment.Status to the Resque job status for UI purposes
136
-			switch($this->Status) {
136
+			switch ($this->Status) {
137 137
 				case 'Finished':
138 138
 					return 'Complete';
139 139
 				case 'Started':
Please login to merge, or discard this patch.