mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
do not provide backup tools if backup dir is not set
This commit is contained in:
parent
ce420a78eb
commit
5997717099
|
@ -74,110 +74,114 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
// archive creation ////////////////////////////////////////////////////////////
|
// archive creation ////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$this->contentHeading(getMLText("archive_creation"));
|
if($this->params['hasbackupdir']) {
|
||||||
print "<p>".getMLText("archive_creation_warning")."</p>\n";
|
$this->contentHeading(getMLText("archive_creation"));
|
||||||
$this->contentContainerStart();
|
print "<p>".getMLText("archive_creation_warning")."</p>\n";
|
||||||
print "<form action=\"../op/op.CreateFolderArchive.php\" name=\"form2\">";
|
$this->contentContainerStart();
|
||||||
$this->printFolderChooserHtml("form2",M_READWRITE);
|
print "<form action=\"../op/op.CreateFolderArchive.php\" name=\"form2\">";
|
||||||
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
|
$this->printFolderChooserHtml("form2",M_READWRITE);
|
||||||
print "<input type='submit' class='btn' name='' value='".getMLText("archive_creation")."'/>";
|
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
|
||||||
print "</form>\n";
|
print "<input type='submit' class='btn' name='' value='".getMLText("archive_creation")."'/>";
|
||||||
|
print "</form>\n";
|
||||||
|
|
||||||
// list backup files
|
// list backup files
|
||||||
|
|
||||||
$handle = opendir($backupdir);
|
$handle = opendir($backupdir);
|
||||||
$entries = array();
|
$entries = array();
|
||||||
while ($e = readdir($handle)){
|
while ($e = readdir($handle)){
|
||||||
if (is_dir($backupdir.$e)) continue;
|
if (is_dir($backupdir.$e)) continue;
|
||||||
if (strpos($e,".tar.gz")==FALSE) continue;
|
if (strpos($e,".tar.gz")==FALSE) continue;
|
||||||
$entries[] = $e;
|
$entries[] = $e;
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
|
|
||||||
sort($entries);
|
|
||||||
$entries = array_reverse($entries);
|
|
||||||
|
|
||||||
if($entries) {
|
|
||||||
$this->contentSubHeading(getMLText("backup_list"));
|
|
||||||
print "<table class=\"table-condensed\">\n";
|
|
||||||
print "<thead>\n<tr>\n";
|
|
||||||
print "<th></th>\n";
|
|
||||||
print "<th>".getMLText("folder")."</th>\n";
|
|
||||||
print "<th>".getMLText("creation_date")."</th>\n";
|
|
||||||
print "<th>".getMLText("file_size")."</th>\n";
|
|
||||||
print "<th></th>\n";
|
|
||||||
print "</tr>\n</thead>\n<tbody>\n";
|
|
||||||
|
|
||||||
foreach ($entries as $entry){
|
|
||||||
|
|
||||||
$folderid=substr($entry,strpos($entry,"_")+1);
|
|
||||||
$folder=$dms->getFolder((int)$folderid);
|
|
||||||
|
|
||||||
print "<tr>\n";
|
|
||||||
print "<td><a href=\"../op/op.Download.php?arkname=".$entry."\">".$entry."</a></td>\n";
|
|
||||||
if (is_object($folder)) print "<td>".htmlspecialchars($folder->getName())."</td>\n";
|
|
||||||
else print "<td>".getMLText("unknown_id")."</td>\n";
|
|
||||||
print "<td>".getLongReadableDate(filectime($backupdir.$entry))."</td>\n";
|
|
||||||
print "<td>".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."</td>\n";
|
|
||||||
print "<td>";
|
|
||||||
print "<a href=\"out.RemoveArchive.php?arkname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("backup_remove")."</a>";
|
|
||||||
print "</td>\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
closedir($handle);
|
||||||
}
|
|
||||||
|
|
||||||
$this->contentContainerEnd();
|
sort($entries);
|
||||||
|
$entries = array_reverse($entries);
|
||||||
|
|
||||||
// dump creation ///////////////////////////////////////////////////////////////
|
if($entries) {
|
||||||
|
$this->contentSubHeading(getMLText("backup_list"));
|
||||||
|
print "<table class=\"table-condensed\">\n";
|
||||||
|
print "<thead>\n<tr>\n";
|
||||||
|
print "<th></th>\n";
|
||||||
|
print "<th>".getMLText("folder")."</th>\n";
|
||||||
|
print "<th>".getMLText("creation_date")."</th>\n";
|
||||||
|
print "<th>".getMLText("file_size")."</th>\n";
|
||||||
|
print "<th></th>\n";
|
||||||
|
print "</tr>\n</thead>\n<tbody>\n";
|
||||||
|
|
||||||
$this->contentHeading(getMLText("dump_creation"));
|
foreach ($entries as $entry){
|
||||||
print "<p>".getMLText("dump_creation_warning")."</p>\n";
|
|
||||||
$this->contentContainerStart();
|
|
||||||
|
|
||||||
print "<form action=\"../op/op.CreateDump.php\" name=\"form4\">";
|
$folderid=substr($entry,strpos($entry,"_")+1);
|
||||||
print "<input type='submit' class='btn' name='' value='".getMLText("dump_creation")."'/>";
|
$folder=$dms->getFolder((int)$folderid);
|
||||||
print "</form>\n";
|
|
||||||
|
print "<tr>\n";
|
||||||
// list backup files
|
print "<td><a href=\"../op/op.Download.php?arkname=".$entry."\">".$entry."</a></td>\n";
|
||||||
$handle = opendir($backupdir);
|
if (is_object($folder)) print "<td>".htmlspecialchars($folder->getName())."</td>\n";
|
||||||
$entries = array();
|
else print "<td>".getMLText("unknown_id")."</td>\n";
|
||||||
while ($e = readdir($handle)){
|
print "<td>".getLongReadableDate(filectime($backupdir.$entry))."</td>\n";
|
||||||
if (is_dir($backupdir.$e)) continue;
|
print "<td>".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."</td>\n";
|
||||||
if (strpos($e,".sql.gz")==FALSE) continue;
|
print "<td>";
|
||||||
$entries[] = $e;
|
print "<a href=\"out.RemoveArchive.php?arkname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("backup_remove")."</a>";
|
||||||
}
|
print "</td>\n";
|
||||||
closedir($handle);
|
print "</tr>\n";
|
||||||
|
}
|
||||||
sort($entries);
|
print "</table>\n";
|
||||||
$entries = array_reverse($entries);
|
|
||||||
|
|
||||||
if($entries) {
|
|
||||||
$this->contentSubHeading(getMLText("dump_list"));
|
|
||||||
print "<table class=\"table-condensed\">\n";
|
|
||||||
print "<thead>\n<tr>\n";
|
|
||||||
print "<th></th>\n";
|
|
||||||
print "<th>".getMLText("creation_date")."</th>\n";
|
|
||||||
print "<th>".getMLText("file_size")."</th>\n";
|
|
||||||
print "<th></th>\n";
|
|
||||||
print "</tr>\n</thead>\n<tbody>\n";
|
|
||||||
|
|
||||||
foreach ($entries as $entry){
|
|
||||||
print "<tr>\n";
|
|
||||||
print "<td>";
|
|
||||||
print "<a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a>";
|
|
||||||
print "</td>\n";
|
|
||||||
print "<td>".getLongReadableDate(filectime($backupdir.$entry))."</td>\n";
|
|
||||||
print "<td>".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."</td>\n";
|
|
||||||
print "<td>";
|
|
||||||
print "<a href=\"out.RemoveDump.php?dumpname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("dump_remove")."</a>";
|
|
||||||
print "</td>\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->contentContainerEnd();
|
$this->contentContainerEnd();
|
||||||
|
|
||||||
|
// dump creation ///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
$this->contentHeading(getMLText("dump_creation"));
|
||||||
|
print "<p>".getMLText("dump_creation_warning")."</p>\n";
|
||||||
|
$this->contentContainerStart();
|
||||||
|
|
||||||
|
print "<form action=\"../op/op.CreateDump.php\" name=\"form4\">";
|
||||||
|
print "<input type='submit' class='btn' name='' value='".getMLText("dump_creation")."'/>";
|
||||||
|
print "</form>\n";
|
||||||
|
|
||||||
|
// list backup files
|
||||||
|
$handle = opendir($backupdir);
|
||||||
|
$entries = array();
|
||||||
|
while ($e = readdir($handle)){
|
||||||
|
if (is_dir($backupdir.$e)) continue;
|
||||||
|
if (strpos($e,".sql.gz")==FALSE) continue;
|
||||||
|
$entries[] = $e;
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
|
||||||
|
sort($entries);
|
||||||
|
$entries = array_reverse($entries);
|
||||||
|
|
||||||
|
if($entries) {
|
||||||
|
$this->contentSubHeading(getMLText("dump_list"));
|
||||||
|
print "<table class=\"table-condensed\">\n";
|
||||||
|
print "<thead>\n<tr>\n";
|
||||||
|
print "<th></th>\n";
|
||||||
|
print "<th>".getMLText("creation_date")."</th>\n";
|
||||||
|
print "<th>".getMLText("file_size")."</th>\n";
|
||||||
|
print "<th></th>\n";
|
||||||
|
print "</tr>\n</thead>\n<tbody>\n";
|
||||||
|
|
||||||
|
foreach ($entries as $entry){
|
||||||
|
print "<tr>\n";
|
||||||
|
print "<td>";
|
||||||
|
print "<a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a>";
|
||||||
|
print "</td>\n";
|
||||||
|
print "<td>".getLongReadableDate(filectime($backupdir.$entry))."</td>\n";
|
||||||
|
print "<td>".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."</td>\n";
|
||||||
|
print "<td>";
|
||||||
|
print "<a href=\"out.RemoveDump.php?dumpname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("dump_remove")."</a>";
|
||||||
|
print "</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->contentContainerEnd();
|
||||||
|
} else {
|
||||||
|
$this->warningMsg(getMLText('no_backup_dir'));
|
||||||
|
}
|
||||||
|
|
||||||
// files deletion //////////////////////////////////////////////////////////////
|
// files deletion //////////////////////////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user