* API/Admin: fixed SQL error on repairing filesystem, if one of required directories has wrong permissions

This commit is contained in:
Ralf Becker 2014-01-07 09:55:07 +00:00
parent a469a1254b
commit c5191e3e01
3 changed files with 31 additions and 1 deletions

View File

@ -136,7 +136,7 @@ class sqlfs_utils extends sqlfs_stream_wrapper
$msgs = array();
foreach($dirs as $path => $id)
{
if (!($stat = self::url_stat($path, STREAM_URL_STAT_LINK)) || ($stat['mode'] & 05) != 05)
if (!($stat = self::url_stat($path, STREAM_URL_STAT_LINK)))
{
if ($check_only)
{
@ -171,6 +171,30 @@ class sqlfs_utils extends sqlfs_stream_wrapper
}
}
}
// check if directory is at least world readable and executable (r-x), we allow more but not less
elseif (($stat['mode'] & 05) != 05)
{
if ($check_only)
{
$msgs[] = lang('Required directory "%1" has wrong mode %2 instead of %3!',
$path, egw_vfs::int2mode($stat['mode']), egw_vfs::int2mode(05|0x4000));
}
else
{
$stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_mode=:fs_mode WHERE fs_id=:fs_id');
if (($ok = $stmt->execute(array(
'fs_id' => $id,
'fs_mode' => 05,
))))
{
$msgs[] = lang('Mode of required directory "%1" changed to %2.', $path, egw_vfs::int2mode(05|0x4000));
}
else
{
$msgs[] = lang('Failed to change mode of required directory "%1" to %2!', $path, egw_vfs::int2mode(05|0x4000));
}
}
}
}
if (!$check_only && $msgs)
{

View File

@ -285,6 +285,7 @@ etag common de ETag
ethiopia common de ÄTHIOPIEN
everything common de Alles
exact common de exakt
failed to change mode of required directory "%1" to %2! admin de Ändern der Zugriffsrechte für benötigtes Verzeichnis "%1" zu %2 fehlgeschlagen!
failed to change password. common de Ändern des Passworts fehlgeschlagen.
failed to contact server or invalid response from server. try to relogin. contact admin in case of faliure. common de Konnte Server nicht erreichen oder ungültige Antwort vom Server. Versuchen Sie sich nochmals anzumelden. Benachrichtigen Sie Ihren Administrator wenn dies fehlschlägt.
failed to create required directory "%1"! admin de Anlegen des benötigten Verzeichnisses "%1" fehlgeschlagen!
@ -480,6 +481,7 @@ message common de Nachricht
mexico common de MEXICO
micronesia, federated states of common de MICRONESIEN, VEREINIGTE STAATEN VON
minute common de Minute
mode of required directory "%1" changed to %2. admin de Zugriffsrechte für benötigtes Verzeichnis "%1" geändert zu %2.
moldova, republic of common de MOLDAVIEN, REPUBLIK
monaco common de MONACO
monday common de Montag
@ -636,6 +638,7 @@ replace with common de Ersetzen durch
requests and full responses to files directory common de Anfragen und komplette Antworten in das Dateiverzeichnis
requests and truncated responses to apache error-log groupdav de Anfragen und gekürzte Antworten ins Apache error-log
required directory "%1" created. admin de Benötigtes Verzeichnis "%1" angelegt.
required directory "%1" has wrong mode %2 instead of %3! admin de Benötigtes Verzeichnis "%1" hat falsche Zugriffsrechte %2 statt %3!
required directory "%1" not found! admin de Benötigtes Verzeichnis "%1" nicht gefunden!
resource calendars groupdav de Kalender von Ressourcen
resource type common de Ressource Typ

View File

@ -285,6 +285,7 @@ etag common en ETag
ethiopia common en ETHIOPIA
everything common en Everything
exact common en Exact
failed to change mode of required directory "%1" to %2! admin en Failed to change mode of required directory "%1" to %2!
failed to change password. common en Failed to change password.
failed to contact server or invalid response from server. try to relogin. contact admin in case of faliure. common en Failed to contact server or invalid response from server. Try to re-login. Contact administrator in case of failure.
failed to create required directory "%1"! admin en Failed to create required directory "%1"!
@ -480,6 +481,7 @@ message common en Message
mexico common en MEXICO
micronesia, federated states of common en MICRONESIA, FEDERATED STATES OF
minute common en Minute
mode of required directory "%1" changed to %2. admin en Mode of required directory "%1" changed to %2.
moldova, republic of common en MOLDOVA, REPUBLIC OF
monaco common en MONACO
monday common en Monday
@ -636,6 +638,7 @@ replace with common en Replace with
requests and full responses to files directory common en Requests and full responses to files directory
requests and truncated responses to apache error-log groupdav en Requests and truncated responses to Apache error-log
required directory "%1" created. admin en Required directory "%1" created.
required directory "%1" has wrong mode %2 instead of %3! admin en Required directory "%1" has wrong mode %2 instead of %3!
required directory "%1" not found! admin en Required directory "%1" not found!
resource calendars groupdav en Resource calendars
resource type common en Resource type