Skip to content

Commit 49c4d60

Browse files
committed
Merge branch 'release/3.6.1'
Removing sudo command
2 parents 3a98c71 + 28e2e0c commit 49c4d60

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

RoboFileBase.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ abstract class RoboFileBase extends \Robo\Tasks {
1414

1515
protected $drush_cmd;
1616
protected $local_user;
17-
protected $sudo_cmd;
1817

1918
protected $drush_bin = "bin/drush";
2019
protected $composer_bin = "composer";
@@ -90,7 +89,6 @@ abstract class RoboFileBase extends \Robo\Tasks {
9089
*/
9190
public function __construct() {
9291
$this->drush_cmd = $this->drush_bin;
93-
$this->sudo_cmd = posix_getuid() == 0 ? '' : 'sudo';
9492
$this->local_user = $this->getLocalUser();
9593

9694
// Read config from env vars.
@@ -203,9 +201,9 @@ public function buildMake($flags = '') {
203201
public function buildSetFilesOwner() {
204202
foreach ([$this->file_public_path, $this->file_private_path, $this->file_temporary_path] as $path) {
205203
$this->say("Ensuring all directories exist.");
206-
$this->_exec("$this->sudo_cmd mkdir -p $path");
204+
$this->_exec("mkdir -p $path");
207205
$this->say("Setting files directory owner.");
208-
$this->_exec("$this->sudo_cmd chown $this->web_server_user:$this->local_user -R $path");
206+
$this->_exec("chown $this->web_server_user:$this->local_user -R $path");
209207
$this->say("Setting directory permissions.");
210208
$this->setPermissions($path, '0775');
211209
}
@@ -260,13 +258,13 @@ public function setSitePath() {
260258
*/
261259
public function buildClean() {
262260
$this->setPermissions("$this->application_root/sites/default", '0755');
263-
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/core");
264-
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/modules/contrib");
265-
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/profiles/contrib");
266-
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/themes/contrib");
267-
$this->_exec("$this->sudo_cmd rm -fR $this->application_root/sites/all");
268-
$this->_exec("$this->sudo_cmd rm -fR bin");
269-
$this->_exec("$this->sudo_cmd rm -fR vendor");
261+
$this->_exec("rm -fR $this->application_root/core");
262+
$this->_exec("rm -fR $this->application_root/modules/contrib");
263+
$this->_exec("rm -fR $this->application_root/profiles/contrib");
264+
$this->_exec("rm -fR $this->application_root/themes/contrib");
265+
$this->_exec("rm -fR $this->application_root/sites/all");
266+
$this->_exec("rm -fR bin");
267+
$this->_exec("rm -fR vendor");
270268
}
271269

272270
/**
@@ -332,14 +330,20 @@ public function devInstallAdminer() {
332330
* CLI debug enable.
333331
*/
334332
public function devXdebugEnable() {
335-
$this->_exec("sudo $this->php_enable_module_command -s cli xdebug");
333+
// Only run this on environments configured with xdebug.
334+
if (getenv('XDEBUG_CONFIG')) {
335+
$this->_exec("sudo $this->php_enable_module_command -s cli xdebug");
336+
}
336337
}
337338

338339
/**
339340
* CLI debug disable.
340341
*/
341342
public function devXdebugDisable() {
342-
$this->_exec("sudo $this->php_disable_module_command -s cli xdebug");
343+
// Only run this on environments configured with xdebug.
344+
if (getenv('XDEBUG_CONFIG')) {
345+
$this->_exec("sudo $this->php_disable_module_command -s cli xdebug");
346+
}
343347
}
344348

345349
/**
@@ -636,7 +640,7 @@ public function lintFix($path = '') {
636640
*/
637641
protected function setPermissions($file, $permission) {
638642
if (file_exists($file)) {
639-
$this->_exec("$this->sudo_cmd chmod $permission $file");
643+
$this->_exec("chmod $permission $file");
640644
}
641645
}
642646

docker-compose.linux.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ services:
88
USER_ID: ${USER_ID:-1000}
99
GROUP_ID: ${GROUP_ID:-1000}
1010
image: uofa/s2i-shepherd-drupal-dev
11-
# Chrome webdriver requires this - used for tests.
12-
privileged: true
1311
hostname: ${PROJECT}
1412
ports:
1513
- "80:8080"

0 commit comments

Comments
 (0)