mirror of
https://github.com/friendica/friendica
synced 2024-11-18 17:03:41 +00:00
Improved logging for avatar storing
This commit is contained in:
parent
22da88b43f
commit
945f5c6db2
1 changed files with 15 additions and 12 deletions
|
@ -123,20 +123,20 @@ class Avatar
|
||||||
// Check directory permissions of all parts of the path
|
// Check directory permissions of all parts of the path
|
||||||
foreach (explode('/', dirname($filename)) as $part) {
|
foreach (explode('/', dirname($filename)) as $part) {
|
||||||
$dirpath .= $part . '/';
|
$dirpath .= $part . '/';
|
||||||
|
|
||||||
|
$old_perm = fileperms($dirpath) & 0777;
|
||||||
|
$old_group = filegroup($dirpath);
|
||||||
|
|
||||||
if (!file_exists($dirpath)) {
|
if (!file_exists($dirpath)) {
|
||||||
if (!mkdir($dirpath, $dir_perm)) {
|
if (!mkdir($dirpath, $dir_perm)) {
|
||||||
Logger::warning('Directory could not be created', ['directory' => $dirpath]);
|
Logger::warning('Directory could not be created', ['directory' => $dirpath]);
|
||||||
}
|
}
|
||||||
} elseif (fileperms($dirpath) & 0777 != $dir_perm) {
|
} elseif (($old_perm != $dir_perm) && !chmod($dirpath, $dir_perm)) {
|
||||||
if (!chmod($dirpath, $dir_perm)) {
|
Logger::notice('Directory permissions could not be changed', ['directory' => $dirpath, 'old' => $old_perm, 'new' => $dir_perm]);
|
||||||
Logger::info('Directory permissions could not be changed', ['directory' => $dirpath]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filegroup($dirpath) != $group) {
|
if (($old_group != $group) && !chgrp($dirpath, $group)) {
|
||||||
if (!chgrp($dirpath, $group)) {
|
Logger::notice('Directory group could not be changed', ['directory' => $dirpath, 'old' => $old_group, 'new' => $group]);
|
||||||
Logger::info('Directory group could not be changed', ['directory' => $dirpath]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +144,15 @@ class Avatar
|
||||||
Logger::warning('File could not be created', ['file' => $filepath]);
|
Logger::warning('File could not be created', ['file' => $filepath]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chmod($filepath, $file_perm)) {
|
$old_perm = fileperms($filepath) & 0666;
|
||||||
Logger::warning('File permissions could not be changed', ['file' => $filepath]);
|
$old_group = filegroup($filepath);
|
||||||
|
|
||||||
|
if (($old_perm != $file_perm) && !chmod($filepath, $file_perm)) {
|
||||||
|
Logger::notice('File permissions could not be changed', ['file' => $filepath, 'old' => $old_perm, 'new' => $file_perm]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chgrp($filepath, $group)) {
|
if (($old_group != $group) && !chgrp($filepath, $group)) {
|
||||||
Logger::warning('File group could not be changed', ['file' => $filepath]);
|
Logger::notice('File group could not be changed', ['file' => $filepath, 'old' => $old_group, 'new' => $group]);
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::profiler()->stopRecording();
|
DI::profiler()->stopRecording();
|
||||||
|
|
Loading…
Reference in a new issue