* Admin/Filemanager: added filesystem check and repair for missing or broken required directories /, /apps and /home

This commit is contained in:
Ralf Becker 2013-08-01 07:53:20 +00:00
parent 8ce9969ece
commit 05765db6ca
3 changed files with 104 additions and 35 deletions

View File

@ -7,7 +7,7 @@
* @package api
* @subpackage vfs
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2008-12 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @version $Id$
*/
@ -105,7 +105,8 @@ class sqlfs_utils extends sqlfs_stream_wrapper
{
self::_pdo();
}
$msgs = self::fsck_fix_multiple_active($check_only);
$msgs = self::fsck_fix_required_nodes($check_only);
$msgs = array_merge($msgs, self::fsck_fix_multiple_active($check_only));
$msgs = array_merge($msgs, self::fsck_fix_unconnected($check_only));
$msgs = array_merge($msgs, self::fsck_fix_no_content($check_only));
@ -119,6 +120,68 @@ class sqlfs_utils extends sqlfs_stream_wrapper
return $msgs;
}
/**
* Check and optionally create required nodes: /, /home, /apps
*
* @param boolean $check_only=true
* @return array with messages / found problems
*/
private static function fsck_fix_required_nodes($check_only=true)
{
static $dirs = array(
'/' => 1,
'/home' => 2,
'/apps' => 3,
);
$msgs = array();
foreach($dirs as $path => $id)
{
if (!($stat = self::url_stat($path, STREAM_URL_STAT_LINK)) || ($stat['mode'] & 05) != 05)
{
if ($check_only)
{
$msgs[] = lang('Required directory "%1" not found!', $path);
}
else
{
if (!isset($stmt))
{
$stmt = self::$pdo->prepare('INSERT INTO '.self::TABLE.' (fs_id,fs_name,fs_dir,fs_mode,fs_uid,fs_gid,fs_size,fs_mime,fs_created,fs_modified,fs_creator'.
') VALUES (:fs_id,:fs_name,:fs_dir,:fs_mode,:fs_uid,:fs_gid,:fs_size,:fs_mime,:fs_created,:fs_modified,:fs_creator)');
}
if (($ok = $stmt->execute(array(
'fs_id' => $id,
'fs_name' => substr($path,1),
'fs_dir' => $path == '/' ? 0 : $dirs['/'],
'fs_mode' => 05,
'fs_uid' => 0,
'fs_gid' => 0,
'fs_size' => 0,
'fs_mime' => 'httpd/unix-directory',
'fs_created' => self::_pdo_timestamp(time()),
'fs_modified' => self::_pdo_timestamp(time()),
'fs_creator' => 0,
))))
{
$msgs[] = lang('Required directory "%1" created.', $path);
}
else
{
$msgs[] = lang('Failed to create required directory "%1"!', $path);
}
}
}
}
if (!$check_only && $msgs)
{
global $oProc;
if (!isset($oProc)) $oProc = new schema_proc();
// PostgreSQL seems to require to update the sequenz, after manually inserting id's
$oProc->UpdateSequence('egw_sqlfs', 'fs_id');
}
return $msgs;
}
/**
* Check and optionally remove files without content part in physical filesystem
*
@ -233,7 +296,7 @@ class sqlfs_utils extends sqlfs_stream_wrapper
}
else
{
$msgs[] = lang('Faild to move unconnected %1 %2 to %3!',
$msgs[] = lang('Failed to move unconnected %1 %2 to %3!',
mime_magic::mime2label($row['fs_mime']), egw_vfs::decodePath($row['fs_name']), self::LOST_N_FOUND);
}
}

View File

@ -1,5 +1,5 @@
%1 active file(s) with same name as directory inactivated! common de %1 aktive Dateien mit dem selben Verzeichnisnamen wurden deaktiviert!
%1 directories %2 found! common de %1 Verzeichnisse %2 gefunden!
%1 active file(s) with same name as directory inactivated! admin de %1 aktive Dateien mit dem selben Verzeichnisnamen wurden deaktiviert!
%1 directories %2 found! admin de %1 Verzeichnisse %2 gefunden!
%1 email addresses inserted common de %1 E-Mail-Adressen eingefügt
%1 file common de %1 Datei
%1 is not executable by the webserver !!! common de %1 ist nicht ausführbar durch den Webserver !!!
@ -128,7 +128,7 @@ calendar common de Kalender
calendars to sync in addition to personal calendar groupdav de Kalender die zusätzlich zum persönlichen synchronisiert werden sollen.
cambodia common de KAMBODSCHA
cameroon common de KAMERUN
can't create directory %1 to connect found unconnected nodes to it! common de Das Verzeichnis %1 konnte nicht erstellt werden, da es nicht verbundene Knoten (nodes) für dieses Objekt gibt
can't create directory %1 to connect found unconnected nodes to it! admin de Das Verzeichnis %1 konnte nicht erstellt werden, da es nicht verbundene Knoten (nodes) für dieses Objekt gibt
canada common de KANADA
cancel common de Abbrechen
cannot replace %1 because it is a directory common de Kann %1 nicht ersetzen, da es ein Verzeichnis ist
@ -284,8 +284,9 @@ etag common de ETag
ethiopia common de ÄTHIOPIEN
everything common de Alles
exact common de exakt
faild to move unconnected %1 %2 to %3! common de Verschiebung nicht möglich %1 %2 nach %3!
failed to move unconnected %1 %2 to %3! admin de Verschiebung nicht möglich %1 %2 nach %3!
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!
falkland islands (malvinas) common de FALKLAND INSELN (MALVINAS)
faroe islands common de FAROE INSELN
fax number common de Fax Nummer
@ -293,11 +294,11 @@ features of the editor? common de Funktionen des Editors?
february common de Februar
fields common de Felder
fiji common de FIJI
file %1 has no content in physical filesystem %2 --> failed to remove file! common de Datei %1 ist im Dateisystem nicht verfügbar %2 -> Löschen nicht möglich
file %1 has no content in physical filesystem %2 --> file removed! common de Datei %1 ist im Dateisystem nicht verfügbar %2 -> Dateieintrag gelöscht
file %1 has no content in physical filesystem %2! common de Datei %1 ist im Dateisystem nicht vorhanden
file %1 has no content in physical filesystem %2 --> failed to remove file! admin de Datei %1 ist im Dateisystem nicht verfügbar %2 -> Löschen nicht möglich
file %1 has no content in physical filesystem %2 --> file removed! admin de Datei %1 ist im Dateisystem nicht verfügbar %2 -> Dateieintrag gelöscht
file %1 has no content in physical filesystem %2! admin de Datei %1 ist im Dateisystem nicht vorhanden
files common de Dateien
files without content in physical filesystem will be removed. common de Dateien ohne Inhalt in dem Dateisystem werden gelöscht
files without content in physical filesystem will be removed. admin de Dateien ohne Inhalt in dem Dateisystem werden gelöscht
filter common de Filter
finland common de FINNLAND
first name common de Vorname
@ -308,7 +309,7 @@ fixme! common de KORREGIER MICH!
folder already exists. common de Verzeichnis existiert bereits.
force selectbox common de Auswahlfeld erzwingen
forever common de Für immer
found unconnected %1 %2! common de Nicht verbundenen Einträge gefunden %1 %2
found unconnected %1 %2! admin de Nicht verbundenen Einträge gefunden %1 %2
france common de FRANKREICH
french guiana common de FRANZÖSISCH GUYANA
french polynesia common de FRANZÖSISCH POLYNESIEN
@ -481,10 +482,10 @@ monday common de Montag
mongolia common de MONGOLEI
montenegro common de MONTENEGRO
montserrat common de MONTSERRA
more then one active file %1 found, inactivating %2 older revisions! common de Mehr als eine Datei %1 verfügbar, %2 ältere Revisionen werden deaktiviert
more then one active file %1 found, inactivating %2 older revisions! admin de Mehr als eine Datei %1 verfügbar, %2 ältere Revisionen werden deaktiviert
morocco common de MAROKKO
moved %1 children from directory fs_id=%2 to %3 common de verschoben %1 Kinderelemente vom Verzeichnis fs_id=%2 nach %3
moved unconnected %1 %2 to %3. common de nicht verbundene Einträge verschoben %1 %2 nach %3.
moved %1 children from directory fs_id=%2 to %3 admin de verschoben %1 Kinderelemente vom Verzeichnis fs_id=%2 nach %3
moved unconnected %1 %2 to %3. admin de nicht verbundene Einträge verschoben %1 %2 nach %3.
mozambique common de MOZAMBIQUE
multiple common de mehrere
myanmar common de MYANMAR
@ -619,12 +620,14 @@ reject common de Zurückweisen
remember me common de Mich erinnern
remove selected accounts common de Ausgewählte Benutzer entfernen
remove shortcut common de Abkürzung entfernen
removed (now) empty directory fs_id=%1 common de Leeres Verzeichnis fs_id=%1 wurde jetzt gelöscht
removed (now) empty directory fs_id=%1 admin de Leeres Verzeichnis fs_id=%1 wurde jetzt gelöscht
rename common de Umbenennen
replace common de Ersetzen
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" not found! admin de Benötigtes Verzeichnis "%1" nicht gefunden!
resource calendars groupdav de Kalender von Ressourcen
resource type common de Ressource Typ
resources common de Ressourcen
@ -730,7 +733,7 @@ stretched common de ausgedehnt
subject common de Betreff
submit common de Absenden
substitutions and their meanings: common de Ersetzungen und ihre Bedeutung
successful created new directory %1 for unconnected nods. common de Verzeichnis %1 wurde erfolgreich erstellt für nicht verbundene Knoten (nods).
successful created new directory %1 for unconnected nods. admin de Verzeichnis %1 wurde erfolgreich erstellt für nicht verbundene Knoten (nods).
sudan common de SUDAN
sunday common de Sonntag
suriname common de SURINAME
@ -766,7 +769,7 @@ time zone offset common de Zeitzonendifferenz
title common de Titel
to common de An
to correct this error for the future you will need to properly set the common de Um diesen Fehler in der Zukunft zu verhindern, müssen sie folgendes setzen:
to examine or reinstate inactived files, you might need to turn versioning on. common de Um inaktive Dateien zu begutachten, sollten die Sie Versionierung von Dateien aktivieren.
to examine or reinstate inactived files, you might need to turn versioning on. admin de Um inaktive Dateien zu begutachten, sollten die Sie Versionierung von Dateien aktivieren.
to go back to the msg list, click <a href= %1 >here</a> common de Um zur Liste der Meldungen zurück zu gehen, <a href="%1">hier</a> anklicken
today common de Heute
todays date, eg. "%1" common de heutiges Datum, z.B. "%1"
@ -788,7 +791,7 @@ tuvalu common de TUVALU
type common de Typ
uganda common de UGANDA
ukraine common de UKRAINE
unconnected nodes will be moved to %1. common de Nicht Verbundene Knoten werden nach %1 verschoben.
unconnected nodes will be moved to %1. admin de Nicht Verbundene Knoten werden nach %1 verschoben.
underline common de Unterstrichen
unicode common de Unicode
united arab emirates common de VEREINIGTEN ARABISCHEN EMIRATE

View File

@ -1,5 +1,5 @@
%1 active file(s) with same name as directory inactivated! common en %1 active file(s) with same name as directory inactivated!
%1 directories %2 found! common en %1 directories %2 found!
%1 active file(s) with same name as directory inactivated! admin en %1 active file(s) with same name as directory inactivated!
%1 directories %2 found! admin en %1 directories %2 found!
%1 email addresses inserted common en %1 email addresses inserted.
%1 file common en %1 file
%1 is not executable by the webserver !!! common en %1 is not executable by the web server!
@ -128,7 +128,7 @@ calendar common en Calendar
calendars to sync in addition to personal calendar groupdav en Calendars to sync in addition to personal calendar
cambodia common en CAMBODIA
cameroon common en CAMEROON
can't create directory %1 to connect found unconnected nodes to it! common en Can't create directory %1 to connect found unconnected nodes to it!
can't create directory %1 to connect found unconnected nodes to it! admin en Can't create directory %1 to connect found unconnected nodes to it!
canada common en CANADA
cancel common en Cancel
cannot replace %1 because it is a directory common en Cannot replace %1 because it is a directory.
@ -284,8 +284,9 @@ etag common en ETag
ethiopia common en ETHIOPIA
everything common en Everything
exact common en Exact
faild to move unconnected %1 %2 to %3! common en Faild to move unconnected %1 %2 to %3!
failed to move unconnected %1 %2 to %3! admin en Faild to move unconnected %1 %2 to %3!
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"!
falkland islands (malvinas) common en FALKLAND ISLANDS (MALVINAS)
faroe islands common en FAROE ISLANDS
fax number common en Fax number
@ -293,11 +294,11 @@ features of the editor? common en Features of the editor
february common en February
fields common en Fields
fiji common en FIJI
file %1 has no content in physical filesystem %2 --> failed to remove file! common en File %1 has no content in physical filesystem %2 --> failed to remove file!
file %1 has no content in physical filesystem %2 --> file removed! common en File %1 has no content in physical filesystem %2 --> file removed!
file %1 has no content in physical filesystem %2! common en File %1 has no content in physical filesystem %2!
file %1 has no content in physical filesystem %2 --> failed to remove file! admin en File %1 has no content in physical filesystem %2 --> failed to remove file!
file %1 has no content in physical filesystem %2 --> file removed! admin en File %1 has no content in physical filesystem %2 --> file removed!
file %1 has no content in physical filesystem %2! admin en File %1 has no content in physical filesystem %2!
files common en Files
files without content in physical filesystem will be removed. common en Files without content in physical filesystem will be removed.
files without content in physical filesystem will be removed. admin en Files without content in physical filesystem will be removed.
filter common en Filter
finland common en FINLAND
first name common en First name
@ -308,7 +309,7 @@ fixme! common en FIXME!
folder already exists. common en Folder already exists!
force selectbox common en Force select box
forever common en Forever
found unconnected %1 %2! common en Found unconnected %1 %2!
found unconnected %1 %2! admin en Found unconnected %1 %2!
france common en FRANCE
french guiana common en FRENCH GUIANA
french polynesia common en FRENCH POLYNESIA
@ -481,10 +482,10 @@ monday common en Monday
mongolia common en MONGOLIA
montenegro common en MONTENEGRO
montserrat common en MONTSERRAT
more then one active file %1 found, inactivating %2 older revisions! common en More then one active file %1 found, inactivating %2 older revisions!
more then one active file %1 found, inactivating %2 older revisions! admin en More then one active file %1 found, inactivating %2 older revisions!
morocco common en MOROCCO
moved %1 children from directory fs_id=%2 to %3 common en Moved %1 children from directory fs_id=%2 to %3
moved unconnected %1 %2 to %3. common en Moved unconnected %1 %2 to %3.
moved %1 children from directory fs_id=%2 to %3 admin en Moved %1 children from directory fs_id=%2 to %3
moved unconnected %1 %2 to %3. admin en Moved unconnected %1 %2 to %3.
mozambique common en MOZAMBIQUE
multiple common en Multiple
myanmar common en MYANMAR
@ -619,12 +620,14 @@ reject common en Reject
remember me common en Remember me
remove selected accounts common en Remove selected accounts
remove shortcut common en Remove shortcut
removed (now) empty directory fs_id=%1 common en Removed (now) empty directory fs_id=%1
removed (now) empty directory fs_id=%1 admin en Removed (now) empty directory fs_id=%1
rename common en Rename
replace common en Replace
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" not found! admin en Required directory "%1" not found!
resource calendars groupdav en Resource calendars
resource type common en Resource type
resources common en Resources
@ -730,7 +733,7 @@ stretched common en Stretched
subject common en Subject
submit common en Submit
substitutions and their meanings: common en Substitutions and their meanings:
successful created new directory %1 for unconnected nods. common en Successful created new directory %1 for unconnected nods.
successful created new directory %1 for unconnected nods. admin en Successful created new directory %1 for unconnected nods.
sudan common en SUDAN
sunday common en Sunday
suriname common en SURINAME
@ -766,7 +769,7 @@ time zone offset common en Time zone offset
title common en Title
to common en To
to correct this error for the future you will need to properly set the common en To correct this error for the future you will need to properly set the
to examine or reinstate inactived files, you might need to turn versioning on. common en To examine or reinstate inactived files, you might need to turn versioning on.
to examine or reinstate inactived files, you might need to turn versioning on. admin en To examine or reinstate inactived files, you might need to turn versioning on.
to go back to the msg list, click <a href= %1 >here</a> common en To go back to the msg list, click <a href="%1">here</a>
today common en Today
todays date, eg. "%1" common en Todays date, eg. "%1"
@ -788,7 +791,7 @@ tuvalu common en TUVALU
type common en Type
uganda common en UGANDA
ukraine common en UKRAINE
unconnected nodes will be moved to %1. common en Unconnected nodes will be moved to %1.
unconnected nodes will be moved to %1. admin en Unconnected nodes will be moved to %1.
underline common en Underline
unicode common en Unicode
united arab emirates common en UNITED ARAB EMIRATES