Skip to content

Commit 2e3331f

Browse files
committed
2.0
1 parent 80cf6ce commit 2e3331f

File tree

5 files changed

+58
-8
lines changed

5 files changed

+58
-8
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"authors": [
77
{
88
"name": "Mohamed Said",
9-
"email": "themsaid@gmail.com"
9+
"email": "mohamed@laravel.com"
1010
}
1111
],
1212
"require": {

src/Actions/ManagesServers.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ public function server($serverId)
3737
*/
3838
public function createServer(array $data)
3939
{
40-
return new Server($this->post('servers', $data)['server'], $this);
40+
$response = $this->post('servers', $data);
41+
42+
$output = $response['server'];
43+
$output['sudo_password'] = @$response['sudo_password'];
44+
$output['database_password'] = @$response['database_password'];
45+
$output['provision_command'] = @$response['provision_command'];
46+
47+
return new Server($output, $this);
4148
}
4249

4350
/**
@@ -173,6 +180,17 @@ public function stopNginx($serverId)
173180
$this->post("servers/$serverId/nginx/stop");
174181
}
175182

183+
/**
184+
* Reboot PHP on the server.
185+
*
186+
* @param string $serverId
187+
* @return void
188+
*/
189+
public function rebootPHP($serverId)
190+
{
191+
$this->post("servers/$serverId/php/reboot");
192+
}
193+
176194
/**
177195
* Install Blackfire on the server.
178196
*

src/Actions/ManagesSites.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ public function installGitRepositoryOnSite($serverId, $siteId, array $data, $wai
163163

164164
if ($wait) {
165165
$this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
166-
$site = $this->site($serverId, $siteId);
167-
return $site->repositoryStatus === 'installed';
166+
return $this->site($serverId, $siteId)->repositoryStatus === 'installed';
168167
});
169168
}
170169
}
@@ -196,8 +195,7 @@ public function destroySiteGitRepository($serverId, $siteId, $wait = false)
196195

197196
if ($wait) {
198197
$this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
199-
$site = $this->site($serverId, $siteId);
200-
return is_null($site->repositoryStatus);
198+
return is_null($this->site($serverId, $siteId)->repositoryStatus);
201199
});
202200
}
203201
}
@@ -265,8 +263,7 @@ public function deploySite($serverId, $siteId, $wait = false)
265263

266264
if ($wait) {
267265
$this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
268-
$site = $this->site($serverId, $siteId);
269-
return is_null($site->deploymentStatus);
266+
return is_null($this->site($serverId, $siteId)->deploymentStatus);
270267
});
271268
}
272269
}

src/Forge.php

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public function __construct($apiKey = null, HttpClient $guzzle = null)
5353
if (! is_null($apiKey)) {
5454
$this->setApiKey($apiKey, $guzzle);
5555
}
56+
57+
if (! is_null($guzzle)) {
58+
$this->guzzle = $guzzle;
59+
}
5660
}
5761

5862
/**

src/Resources/Server.php

+31
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,27 @@ class Server extends Resource
102102
*/
103103
public $network = [];
104104

105+
/**
106+
* The sudo password of the new server.
107+
*
108+
* @var string
109+
*/
110+
public $sudoPassword;
111+
112+
/**
113+
* The database password of the new server.
114+
*
115+
* @var string
116+
*/
117+
public $databasePassword;
118+
119+
/**
120+
* The provision command of the new server.
121+
*
122+
* @var string
123+
*/
124+
public $provisionCommand;
125+
105126
/**
106127
* Update the given server.
107128
*
@@ -223,6 +244,16 @@ public function stopNginx()
223244
return $this->forge->stopNginx($this->id);
224245
}
225246

247+
/**
248+
* Reboot PHP on the server.
249+
*
250+
* @return void
251+
*/
252+
public function rebootPHP()
253+
{
254+
return $this->forge->rebootPHP($this->id);
255+
}
256+
226257
/**
227258
* Install Blackfire on the server.
228259
*

0 commit comments

Comments
 (0)