Skip to content

Commit

Permalink
Make sure directories exist and have permission. (#30)
Browse files Browse the repository at this point in the history
* Make sure directories exist and have permission.

* Fix the indenting and make it a bit more readable.

* Ugh, silly space.
  • Loading branch information
singularo authored and pingers committed May 20, 2018
1 parent f81489d commit 8bf64a3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions RoboFileBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,22 @@ public function buildCreateConfigSyncDir() {
if (isset($this->config['environment']['config_sync_dir'])) {
// Only do this if we have a config sync dir setting available.
$this->say("Creating config sync directory.");
$this->_exec("mkdir -p " . $this->application_root . "/" . $this->config['environment']['config_sync_dir']);
$this->_exec("$this->sudo_cmd mkdir -p " . $this->config['environment']['config_sync_dir']);
}
}

/**
* Set the owner and group of all files in the files dir to the web user.
*/
public function buildSetFilesOwner() {
$this->say("Setting files directory owner.");
$this->_exec("$this->sudo_cmd chown $this->web_server_user:$this->local_user -R $this->file_public_path");
$this->_exec("$this->sudo_cmd chown $this->web_server_user:$this->local_user -R $this->file_private_path");
$this->_exec("$this->sudo_cmd chown $this->web_server_user:$this->local_user -R $this->file_temporary_path");
$this->setPermissions($this->file_public_path, '0775');
$this->setPermissions($this->file_private_path, '0775');
$this->setPermissions($this->file_temporary_path, '0775');
foreach ([$this->file_public_path, $this->file_private_path, $this->file_temporary_path] as $path) {
$this->say("Ensuring all directories exist.");
$this->_exec("$this->sudo_cmd mkdir -p $path");
$this->say("Setting files directory owner.");
$this->_exec("$this->sudo_cmd chown $this->web_server_user:$this->local_user -R $path");
$this->say("Setting directory permissions.");
$this->setPermissions($path, '0775');
}
}

/**
Expand Down

0 comments on commit 8bf64a3

Please sign in to comment.