Skip to content

Commit

Permalink
Fix checks for log path
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGrubb committed Jun 12, 2020
1 parent c5ba27c commit c50bbc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/CoolApi/Core/Checks.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ public function run () {
*/
if ($this->instance->config->logging['enabled'] === true) {

$logPath = $this->instance->config->logging['path'];

/**
* Check logs path existance and whether
* or not it is writable.
*/
if (!is_dir("{$this->root}/logs"))
throw new \Exception("{$this->root}/logs does not exist.");
if (!is_dir("{$logPath}"))
throw new \Exception("{$logPath} does not exist.");

if (!is_writable("{$this->root}/logs"))
throw new \Exception("{$this->root}/logs is not writable.");
if (!is_writable("{$logPath}"))
throw new \Exception("{$logPath} is not writable.");
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/CoolApi/Core/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public function status($status = null) {
* Sets the content type
*/
public function contentType($type) {

switch ($type) {

case 'json':
$this->contentType = 'json';
$this->contentTypeFormatted = 'application/json';
Expand Down

0 comments on commit c50bbc6

Please sign in to comment.