@@ -89,7 +89,9 @@ protected function createFolders(SSH2 $ssh, ApplicationEnvironment $applicationE
8989 2
9090 );
9191
92- $ this ->executeSshCommand ($ ssh , 'mkdir -p -m 750 ' . escapeshellarg ($ path ), 3 );
92+ $ path = escapeshellarg ($ path );
93+ $ cmd = 'mkdir -p ' . $ path . ' && chmod ' . $ capistranoFolder ->getChmod () . ' ' . $ path ;
94+ $ this ->executeSshCommand ($ ssh , $ cmd , 3 );
9395 }
9496
9597 $ this ->taskLoggerService ->addSuccessLogMessage ($ this ->task , 'Directories created. ' , 2 );
@@ -204,7 +206,7 @@ protected function createFiles(SSH2 $ssh, ApplicationEnvironment $applicationEnv
204206 $ command = 'echo ' . ($ i === $ maxI ? '' : '-n ' ) . $ part . ($ i ? ' >> ' : ' > ' ) . $ tmpPath ;
205207
206208 if ($ i === $ maxI ) {
207- $ command .= " && ([[ ! -f $ path ]] || chmod \$ (stat --format '%a' $ path ) $ tmpPath) " ;
209+ $ command .= ' && chmod ' . $ capistranoFile -> getChmod () . ' ' . $ tmpPath ;
208210 $ command .= ' && mv -f ' . $ tmpPath . ' ' . $ path ;
209211 }
210212
@@ -216,7 +218,7 @@ protected function createFiles(SSH2 $ssh, ApplicationEnvironment $applicationEnv
216218
217219 $ content = escapeshellarg ($ content );
218220 $ command = 'echo ' . $ content . ' > ' . $ tmpPath ;
219- $ command .= " && ([[ ! -f $ path ]] || chmod \$ (stat --format '%a' $ path ) $ tmpPath) " ;
221+ $ command .= ' && chmod ' . $ capistranoFile -> getChmod () . ' ' . $ tmpPath ;
220222 $ command .= ' && mv -f ' . $ tmpPath . ' ' . $ path ;
221223
222224 $ this ->executeSshCommand ($ ssh , $ command , 3 );
0 commit comments