mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
major overhaul
do not show backup space required, if backup is stored in content direcotry. Add various role based access checks.
This commit is contained in:
parent
bf7a63bf5a
commit
b90c9a379a
|
@ -34,10 +34,13 @@ if (!$accessop->check_view_access($view, $_GET)) {
|
|||
}
|
||||
|
||||
if($view) {
|
||||
if($settings->_backupDir && file_exists($settings->_backupDir))
|
||||
if($settings->_backupDir && file_exists($settings->_backupDir)) {
|
||||
$view->setParam('backupdir', $settings->_backupDir);
|
||||
else
|
||||
$view->setParam('hasbackupdir', true);
|
||||
} else {
|
||||
$view->setParam('backupdir', $settings->_contentDir);
|
||||
$view->setParam('hasbackupdir', false);
|
||||
}
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view($_GET);
|
||||
exit;
|
||||
|
|
|
@ -42,6 +42,7 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
|||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$accessop = $this->params['accessobject'];
|
||||
$backupdir = $this->params['backupdir'];
|
||||
|
||||
$this->htmlStartPage(getMLText("backup_tools"));
|
||||
|
@ -49,17 +50,22 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
|||
$this->contentStart();
|
||||
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
||||
|
||||
$this->contentHeading(getMLText("backup_tools"));
|
||||
$this->contentContainerStart();
|
||||
print getMLText("space_used_on_data_folder")." : ".SeedDMS_Core_File::format_filesize(dskspace($backupdir));
|
||||
$this->contentContainerEnd();
|
||||
/* Calculating the size of the backup dir is only reasonable if
|
||||
* it is not part of the content dir. Otherwise the content will
|
||||
* be counted as well.
|
||||
*/
|
||||
if($this->params['hasbackupdir']) {
|
||||
$this->contentHeading(getMLText("backup_tools"));
|
||||
$this->contentContainerStart();
|
||||
print getMLText("space_used_on_data_folder")." : ".SeedDMS_Core_File::format_filesize(dskspace($backupdir));
|
||||
$this->contentContainerEnd();
|
||||
}
|
||||
|
||||
// versioning file creation ////////////////////////////////////////////////////
|
||||
|
||||
$this->contentHeading(getMLText("versioning_file_creation"));
|
||||
$this->contentContainerStart();
|
||||
print "<p>".getMLText("versioning_file_creation_warning")."</p>\n";
|
||||
|
||||
$this->contentContainerStart();
|
||||
print "<form class=\"form-inline\" action=\"../op/op.CreateVersioningFiles.php\" name=\"form1\">";
|
||||
$this->printFolderChooserHtml("form1",M_READWRITE);
|
||||
print "<input type='submit' class='btn' name='' value='".getMLText("versioning_file_creation")."'/>";
|
||||
|
@ -70,14 +76,15 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
|||
// archive creation ////////////////////////////////////////////////////////////
|
||||
|
||||
$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->printFolderChooserHtml("form2",M_READWRITE);
|
||||
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
|
||||
print "<input type='submit' class='btn' name='' value='".getMLText("archive_creation")."'/>";
|
||||
print "</form>\n";
|
||||
$this->contentContainerStart();
|
||||
if($accessop->check_controller_access('CreateFolderArchive', array('action'=>'run'))) {
|
||||
print "<form action=\"../op/op.CreateFolderArchive.php\" name=\"form2\">";
|
||||
$this->printFolderChooserHtml("form2",M_READWRITE);
|
||||
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
|
||||
print "<input type='submit' class='btn' name='' value='".getMLText("archive_creation")."'/>";
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
// list backup files
|
||||
|
||||
|
@ -110,13 +117,19 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
|||
$folder=$dms->getFolder((int)$folderid);
|
||||
|
||||
print "<tr>\n";
|
||||
print "<td><a href=\"../op/op.Download.php?arkname=".$entry."\">".$entry."</a></td>\n";
|
||||
print "<td>";
|
||||
if($accessop->check_controller_access('Download', array('action'=>'archive')))
|
||||
print "<a href=\"../op/op.Download.php?arkname=".$entry."\">".$entry."</a>";
|
||||
else
|
||||
print $entry;
|
||||
print "</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>";
|
||||
if($accessop->check_controller_access('RemoveArchive', array('action'=>'run')))
|
||||
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";
|
||||
}
|
||||
|
@ -128,12 +141,14 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
|||
// dump creation ///////////////////////////////////////////////////////////////
|
||||
|
||||
$this->contentHeading(getMLText("dump_creation"));
|
||||
$this->contentContainerStart();
|
||||
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";
|
||||
if($accessop->check_controller_access('CreateDump', array('action'=>'run'))) {
|
||||
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);
|
||||
|
@ -160,11 +175,17 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
|||
|
||||
foreach ($entries as $entry){
|
||||
print "<tr>\n";
|
||||
print "<td><a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a></td>\n";
|
||||
print "<td>";
|
||||
if($accessop->check_controller_access('Download', array('action'=>'sqldump')))
|
||||
print "<a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a>";
|
||||
else
|
||||
print $entry;
|
||||
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>";
|
||||
if($accessop->check_controller_access('RemoveDump', array('action'=>'run')))
|
||||
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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user