2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of BackupTools view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for BackupTools view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
class SeedDMS_View_BackupTools extends SeedDMS_Theme_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2015-12-14 08:48:25 +00:00
|
|
|
function js() { /* {{{ */
|
2021-03-10 14:58:22 +00:00
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2015-12-16 06:14:04 +00:00
|
|
|
|
2020-08-28 09:54:52 +00:00
|
|
|
// $this->printFolderChooserJs("form1");
|
|
|
|
// $this->printFolderChooserJs("form2");
|
|
|
|
// $this->printFolderChooserJs("form3");
|
2015-12-14 08:48:25 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2016-08-12 11:14:34 +00:00
|
|
|
$accessop = $this->params['accessobject'];
|
2015-07-28 05:50:02 +00:00
|
|
|
$backupdir = $this->params['backupdir'];
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
$this->htmlStartPage(getMLText("backup_tools"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
|
|
|
|
2016-08-12 11:14:34 +00:00
|
|
|
/* 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();
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
// versioning file creation ////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
$this->contentHeading(getMLText("versioning_file_creation"));
|
|
|
|
print "<p>".getMLText("versioning_file_creation_warning")."</p>\n";
|
2016-08-12 11:14:34 +00:00
|
|
|
$this->contentContainerStart();
|
2014-02-21 10:27:03 +00:00
|
|
|
print "<form class=\"form-inline\" action=\"../op/op.CreateVersioningFiles.php\" name=\"form1\">";
|
2015-12-14 08:48:25 +00:00
|
|
|
$this->printFolderChooserHtml("form1",M_READWRITE);
|
2021-04-18 05:08:00 +00:00
|
|
|
print "<input type='submit' class='btn btn-primary' name='' value='".getMLText("versioning_file_creation")."'/>";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "</form>\n";
|
|
|
|
|
|
|
|
$this->contentContainerEnd();
|
|
|
|
|
|
|
|
// archive creation ////////////////////////////////////////////////////////////
|
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
if($this->params['hasbackupdir']) {
|
|
|
|
$this->contentHeading(getMLText("archive_creation"));
|
|
|
|
print "<p>".getMLText("archive_creation_warning")."</p>\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>";
|
2021-04-18 06:05:07 +00:00
|
|
|
print "<input type='submit' class='btn btn-primary' name='' value='".getMLText("archive_creation")."'/>";
|
2019-09-06 12:32:14 +00:00
|
|
|
print "</form>\n";
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
// list backup files
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
$handle = opendir($backupdir);
|
|
|
|
$entries = array();
|
|
|
|
while ($e = readdir($handle)){
|
|
|
|
if (is_dir($backupdir.$e)) continue;
|
|
|
|
if (strpos($e,".tar.gz")==FALSE) continue;
|
|
|
|
$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>";
|
|
|
|
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>";
|
|
|
|
if($accessop->check_controller_access('RemoveArchive', array('action'=>'run')))
|
2020-08-27 06:27:19 +00:00
|
|
|
print "<a href=\"out.RemoveArchive.php?arkname=".$entry."\" class=\"btn btn-mini\"><i class=\"fa fa-remove\"></i> ".getMLText("backup_remove")."</a>";
|
2019-09-06 12:32:14 +00:00
|
|
|
print "</td>\n";
|
|
|
|
print "</tr>\n";
|
|
|
|
}
|
|
|
|
print "</table>\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
$this->contentContainerEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
// dump creation ///////////////////////////////////////////////////////////////
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
$this->contentHeading(getMLText("dump_creation"));
|
|
|
|
print "<p>".getMLText("dump_creation_warning")."</p>\n";
|
|
|
|
$this->contentContainerStart();
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
if($accessop->check_controller_access('CreateDump', array('action'=>'run'))) {
|
2016-08-12 11:14:34 +00:00
|
|
|
print "<form action=\"../op/op.CreateDump.php\" name=\"form4\">";
|
2021-04-18 05:08:00 +00:00
|
|
|
print "<input type='submit' class='btn btn-primary' name='' value='".getMLText("dump_creation")."'/>";
|
2016-08-12 11:14:34 +00:00
|
|
|
print "</form>\n";
|
2019-09-06 12:32:14 +00:00
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
// 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>";
|
|
|
|
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>";
|
|
|
|
if($accessop->check_controller_access('RemoveDump', array('action'=>'run')))
|
2020-08-27 06:27:19 +00:00
|
|
|
print "<a href=\"out.RemoveDump.php?dumpname=".$entry."\" class=\"btn btn-mini\"><i class=\"fa fa-remove\"></i> ".getMLText("dump_remove")."</a>";
|
2019-09-06 12:32:14 +00:00
|
|
|
print "</td>\n";
|
|
|
|
print "</tr>\n";
|
|
|
|
}
|
|
|
|
print "</table>\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
|
2019-09-06 12:32:14 +00:00
|
|
|
$this->contentContainerEnd();
|
|
|
|
} else {
|
|
|
|
$this->warningMsg(getMLText('no_backup_dir'));
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
// files deletion //////////////////////////////////////////////////////////////
|
2016-03-08 16:23:45 +00:00
|
|
|
/*
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->contentHeading(getMLText("files_deletion"));
|
|
|
|
$this->contentContainerStart();
|
|
|
|
print "<p>".getMLText("files_deletion_warning")."</p>\n";
|
|
|
|
|
2014-02-21 10:27:03 +00:00
|
|
|
print "<form class=\"form-inline\" action=\"../out/out.RemoveFolderFiles.php\" name=\"form3\">";
|
2015-12-14 08:48:25 +00:00
|
|
|
$this->printFolderChooserHtml("form3",M_READWRITE);
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<input type='submit' class='btn' name='' value='".getMLText("files_deletion")."'/>";
|
|
|
|
print "</form>\n";
|
|
|
|
|
|
|
|
$this->contentContainerEnd();
|
2016-03-08 16:23:45 +00:00
|
|
|
*/
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|