File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,15 @@ protected function getSiteRoot() {
241241 return $ this ->siteRoot ;
242242 }
243243
244+ /**
245+ * Check if the current build has a site root directory.
246+ *
247+ * @return bool
248+ */
249+ protected function hasSiteRoot () {
250+ return !is_null ($ this ->siteRoot );
251+ }
252+
244253 /**
245254 * Helper to check that the config file exits and load the configuration.
246255 *
Original file line number Diff line number Diff line change @@ -192,13 +192,20 @@ protected function gitClone() {
192192 * @throws CommandException
193193 */
194194 protected function gitCheckout () {
195- $ commands = [
196- sprintf ('cd %s ' , $ this ->shellPath ($ this ->getRoot ())),
197- 'git fetch --all ' ,
198- sprintf ('chmod 777 %ssites/default ' , $ this ->getWebRoot ()),
199- sprintf ('chmod 777 %ssites/default/settings.php ' , $ this ->getWebRoot ()),
200- sprintf ('git checkout %s --force ' , $ this ->ref ),
201- ];
195+
196+ $ commands = [];
197+
198+ // Fix site folder permissions.
199+ if ($ this ->hasSiteRoot ()) {
200+ $ commands [] = sprintf ('chmod 777 %s ' , $ this ->getSiteRoot ());
201+ $ commands [] = sprintf ('chmod 777 %ssettings.php ' , $ this ->getSiteRoot ());
202+ }
203+
204+ // Checkout commands.
205+ $ commands [] = sprintf ('cd %s ' , $ this ->shellPath ($ this ->getRoot ()));
206+ $ commands [] = 'git fetch --all ' ;
207+ $ commands [] = sprintf ('git checkout %s --force ' , $ this ->ref );
208+
202209 $ command = implode (' && ' , $ commands );
203210
204211 $ shellProcess = $ this ->getShellProcess ();
You can’t perform that action at this time.
0 commit comments