Skip to content

Commit

Permalink
Merge pull request #22 from universityofadelaide/feature/add-tmp-dir-…
Browse files Browse the repository at this point in the history
…support

add tmp dir support
  • Loading branch information
singularo authored Oct 18, 2017
2 parents 0b5ae3f + dbe8261 commit 9781509
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions RoboFileBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ abstract class RoboFileBase extends \Robo\Tasks {
protected $application_root = "web";
protected $file_public_path = '/shared/public';
protected $file_private_path = '/shared/private';
protected $file_temporary_path = '/shared/tmp';
protected $services_yml = "web/sites/default/services.yml";
protected $settings_php = "web/sites/default/settings.php";

Expand Down Expand Up @@ -178,8 +179,10 @@ 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');
}

/**
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
DATABASE_USER: user
DATABASE_PASSWORD: password
PRIVATE_DIR: /shared/private
TMP_DIR: /shared/tmp
PUBLIC_DIR: web/sites/default/files
HASH_SALT: random-hash
CONFIG_SYNC_DIRECTORY: /shared/private/random-hash/sync
Expand Down
3 changes: 2 additions & 1 deletion src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public function modifySettingsFile()
" 'collation' => getenv('DATABASE_COLLATION') ?: 'utf8mb4_general_ci',\n" .
" 'namespace' => getenv('DATABASE_NAMESPACE') ?: 'Drupal\\\\Core\\\\Database\\\\Driver\\\\mysql',\n" .
");\n" .
"\$settings['file_private_path'] = getenv('PRIVATE_DIR');\n" .
"\$settings['file_private_path'] = getenv('PRIVATE_DIR') ?: '/shared/private';\n" .
"\$settings['file_temporary_path'] = getenv('TMP_DIR') ?: '/shared/tmp';\n" .
"\$settings['hash_salt'] = getenv('HASH_SALT') ?: '" . str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(random_bytes(55))) . "';\n" .
"\$config_directories['sync'] = getenv('CONFIG_SYNC_DIRECTORY') ?: 'sites/default/files/config_".str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(random_bytes(55))) . "/sync';\n" .
"if (! is_dir(\$app_root . '/' . \$config_directories['sync'])) mkdir(\$app_root . '/' . \$config_directories['sync'], 0777, true);\n" .
Expand Down

0 comments on commit 9781509

Please sign in to comment.