Skip to content

Commit 85c870c

Browse files
authored
Merge pull request #157 from joomlatools/feature/156-chown
Add chown support to site:download and site:create
2 parents ec7146b + f86da16 commit 85c870c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/Joomlatools/Console/Command/Site/Create.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ protected function configure()
163163
'The full command for restarting Apache2',
164164
null
165165
)
166+
->addOption(
167+
'chown',
168+
null,
169+
InputOption::VALUE_OPTIONAL,
170+
'Change file owner as the passed user'
171+
)
166172
;
167173
}
168174

@@ -206,6 +212,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
206212
$command->run(new ArrayInput($arguments), $output);
207213
}
208214

215+
if ($input->hasOption('chown')) {
216+
$user = $input->getOption('chown');
217+
`chown -R $user:$user $this->target_dir`;
218+
}
219+
209220
/*
210221
* Run all site:create:* commands after site creation
211222
*/

src/Joomlatools/Console/Command/Site/Download.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ protected function configure()
7878
InputOption::VALUE_OPTIONAL,
7979
'Clone the Git repository instead of creating a copy in the target directory. Use --clone=shallow for a shallow clone or leave empty.',
8080
true
81-
);
81+
)
82+
->addOption(
83+
'chown',
84+
null,
85+
InputOption::VALUE_OPTIONAL,
86+
'Change file owner as the passed user'
87+
)
8288
;
8389
}
8490

@@ -126,6 +132,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
126132
`cp $directory/htaccess.txt $directory/.htaccess`;
127133
}
128134

135+
if ($input->hasOption('chown')) {
136+
$user = $input->getOption('chown');
137+
`chown -R $user:$user $this->target_dir`;
138+
}
139+
129140
return 0;
130141
}
131142

0 commit comments

Comments
 (0)