Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hj Ahmad Rasyid Hj Ismail
ISPConfig 3
Commits
2e299c54
Commit
2e299c54
authored
Dec 10, 2020
by
Jesse Norell
Browse files
restoreFileOwnership() excludes system paths
parent
1adea00f
Changes
1
Show whitespace changes
Inline
Side-by-side
server/lib/classes/backup.inc.php
View file @
2e299c54
...
...
@@ -100,12 +100,21 @@ class backup
* @param string $web_user
* @author Ramil Valitov <ramilvalitov@gmail.com>
*/
protected
static
function
restoreFileOwnership
(
$web_document_root
,
$web_user
)
protected
static
function
restoreFileOwnership
(
$web_document_root
,
$web_user
,
$web_group
)
{
global
$app
;
$blacklist
=
array
(
'bin'
,
'dev'
,
'etc'
,
'home'
,
'lib'
,
'lib32'
,
'lib64'
,
'log'
,
'opt'
,
'proc'
,
'net'
,
'run'
,
'sbin'
,
'ssl'
,
'srv'
,
'sys'
,
'usr'
,
'var'
);
$find_excludes
=
'-not -path "." -and -not -path "./web/stats/*"'
;
foreach
(
$blacklist
as
$dir
)
{
$find_excludes
.
=
' -and -not -path "./'
.
$dir
.
'" -and -not -path "./'
.
$dir
.
'/*"'
;
}
$app
->
log
(
'Restoring permissions for '
.
$web_document_root
,
LOGLEVEL_DEBUG
);
$app
->
system
->
exec_safe
(
'cd ? && find . -not -path "./web/stats/*" -and -not -path "./log" -and -not -path "./log/*" -and -not -path "./ssl" -and -not -path "./ssl/*" -and -not -path "." -exec chown ?:? {} \;'
,
$web_document_root
,
$web_user
,
$web_user
);
$app
->
system
->
exec_safe
(
'cd ? && find . '
.
$find_excludes
.
' -exec chown ?:? {} \;'
,
$web_document_root
,
$web_user
,
$web_group
);
}
/**
...
...
@@ -290,7 +299,7 @@ class backup
*/
$success
=
(
$retval
==
0
||
$retval
==
50
);
if
(
$success
)
{
self
::
restoreFileOwnership
(
$web_root
,
$web_user
);
self
::
restoreFileOwnership
(
$web_root
,
$web_user
,
$web_group
);
}
break
;
case
'rar'
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment