File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -271,9 +271,28 @@ protected function setupSourceData(array $conf)
271271 public function backup (Target $ target , Result $ result ) : Status
272272 {
273273 // create the writable dump directory for tables files
274- if ($ this ->filePerTable && !is_dir ($ this ->getDumpTarget ($ target ))) {
274+ $ dumpTarget = $ this ->getDumpTarget ($ target );
275+ if ($ this ->filePerTable && !is_dir ($ dumpTarget )) {
276+ $ fileMode = 0777 ;
277+
278+ if (PHP_OS !== 'WINNT ' ) {
279+ // get the permissions of the first directory that exists
280+ $ pathSegments = explode (DIRECTORY_SEPARATOR , $ dumpTarget );
281+
282+ do {
283+ $ filename = implode (DIRECTORY_SEPARATOR , $ pathSegments );
284+
285+ if (is_dir ($ filename ) === false ) {
286+ continue ;
287+ }
288+
289+ $ fileMode = substr (fileperms ($ filename ), -4 );
290+ break ;
291+ } while (array_pop ($ pathSegments ) !== null );
292+ }
293+
275294 $ old = umask (0 );
276- mkdir ($ this -> getDumpTarget ( $ target ), 0777 , true );
295+ mkdir ($ dumpTarget , $ fileMode , true );
277296 umask ($ old );
278297 }
279298
You can’t perform that action at this time.
0 commit comments