Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Nov 9, 2018
1 parent 80cf6ce commit 2e3331f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"authors": [
{
"name": "Mohamed Said",
"email": "themsaid@gmail.com"
"email": "mohamed@laravel.com"
}
],
"require": {
Expand Down
20 changes: 19 additions & 1 deletion src/Actions/ManagesServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ public function server($serverId)
*/
public function createServer(array $data)
{
return new Server($this->post('servers', $data)['server'], $this);
$response = $this->post('servers', $data);

$output = $response['server'];
$output['sudo_password'] = @$response['sudo_password'];
$output['database_password'] = @$response['database_password'];
$output['provision_command'] = @$response['provision_command'];

return new Server($output, $this);
}

/**
Expand Down Expand Up @@ -173,6 +180,17 @@ public function stopNginx($serverId)
$this->post("servers/$serverId/nginx/stop");
}

/**
* Reboot PHP on the server.
*
* @param string $serverId
* @return void
*/
public function rebootPHP($serverId)
{
$this->post("servers/$serverId/php/reboot");
}

/**
* Install Blackfire on the server.
*
Expand Down
9 changes: 3 additions & 6 deletions src/Actions/ManagesSites.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ public function installGitRepositoryOnSite($serverId, $siteId, array $data, $wai

if ($wait) {
$this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
$site = $this->site($serverId, $siteId);
return $site->repositoryStatus === 'installed';
return $this->site($serverId, $siteId)->repositoryStatus === 'installed';
});
}
}
Expand Down Expand Up @@ -196,8 +195,7 @@ public function destroySiteGitRepository($serverId, $siteId, $wait = false)

if ($wait) {
$this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
$site = $this->site($serverId, $siteId);
return is_null($site->repositoryStatus);
return is_null($this->site($serverId, $siteId)->repositoryStatus);
});
}
}
Expand Down Expand Up @@ -265,8 +263,7 @@ public function deploySite($serverId, $siteId, $wait = false)

if ($wait) {
$this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
$site = $this->site($serverId, $siteId);
return is_null($site->deploymentStatus);
return is_null($this->site($serverId, $siteId)->deploymentStatus);
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public function __construct($apiKey = null, HttpClient $guzzle = null)
if (! is_null($apiKey)) {
$this->setApiKey($apiKey, $guzzle);
}

if (! is_null($guzzle)) {
$this->guzzle = $guzzle;
}
}

/**
Expand Down
31 changes: 31 additions & 0 deletions src/Resources/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ class Server extends Resource
*/
public $network = [];

/**
* The sudo password of the new server.
*
* @var string
*/
public $sudoPassword;

/**
* The database password of the new server.
*
* @var string
*/
public $databasePassword;

/**
* The provision command of the new server.
*
* @var string
*/
public $provisionCommand;

/**
* Update the given server.
*
Expand Down Expand Up @@ -223,6 +244,16 @@ public function stopNginx()
return $this->forge->stopNginx($this->id);
}

/**
* Reboot PHP on the server.
*
* @return void
*/
public function rebootPHP()
{
return $this->forge->rebootPHP($this->id);
}

/**
* Install Blackfire on the server.
*
Expand Down

0 comments on commit 2e3331f

Please sign in to comment.