mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-15 14:11:35 +00:00
backup dir can be set in configuration
This commit is contained in:
parent
78f4d62e36
commit
545cdb4e32
|
@ -89,6 +89,8 @@ class Settings { /* {{{ */
|
||||||
var $_luceneDir = null;
|
var $_luceneDir = null;
|
||||||
// Where the drop folders are located
|
// Where the drop folders are located
|
||||||
var $_dropFolderDir = null;
|
var $_dropFolderDir = null;
|
||||||
|
// Where the backup directory is located
|
||||||
|
var $_backupDir = null;
|
||||||
// enable removal of file from dropfolder after success import
|
// enable removal of file from dropfolder after success import
|
||||||
var $_removeFromDropFolder = false;
|
var $_removeFromDropFolder = false;
|
||||||
// Where the stop word file is located
|
// Where the stop word file is located
|
||||||
|
@ -467,6 +469,7 @@ class Settings { /* {{{ */
|
||||||
$this->_stagingDir = strval($tab["stagingDir"]);
|
$this->_stagingDir = strval($tab["stagingDir"]);
|
||||||
$this->_luceneDir = strval($tab["luceneDir"]);
|
$this->_luceneDir = strval($tab["luceneDir"]);
|
||||||
$this->_dropFolderDir = strval($tab["dropFolderDir"]);
|
$this->_dropFolderDir = strval($tab["dropFolderDir"]);
|
||||||
|
$this->_backupDir = strval($tab["backupDir"]);
|
||||||
$this->_logFileEnable = Settings::boolVal($tab["logFileEnable"]);
|
$this->_logFileEnable = Settings::boolVal($tab["logFileEnable"]);
|
||||||
$this->_logFileRotation = strval($tab["logFileRotation"]);
|
$this->_logFileRotation = strval($tab["logFileRotation"]);
|
||||||
$this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]);
|
$this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]);
|
||||||
|
@ -779,6 +782,7 @@ class Settings { /* {{{ */
|
||||||
$this->setXMLAttributValue($node, "stagingDir", $this->_stagingDir);
|
$this->setXMLAttributValue($node, "stagingDir", $this->_stagingDir);
|
||||||
$this->setXMLAttributValue($node, "luceneDir", $this->_luceneDir);
|
$this->setXMLAttributValue($node, "luceneDir", $this->_luceneDir);
|
||||||
$this->setXMLAttributValue($node, "dropFolderDir", $this->_dropFolderDir);
|
$this->setXMLAttributValue($node, "dropFolderDir", $this->_dropFolderDir);
|
||||||
|
$this->setXMLAttributValue($node, "backupDir", $this->_backupDir);
|
||||||
$this->setXMLAttributValue($node, "logFileEnable", $this->_logFileEnable);
|
$this->setXMLAttributValue($node, "logFileEnable", $this->_logFileEnable);
|
||||||
$this->setXMLAttributValue($node, "logFileRotation", $this->_logFileRotation);
|
$this->setXMLAttributValue($node, "logFileRotation", $this->_logFileRotation);
|
||||||
$this->setXMLAttributValue($node, "enableLargeFileUpload", $this->_enableLargeFileUpload);
|
$this->setXMLAttributValue($node, "enableLargeFileUpload", $this->_enableLargeFileUpload);
|
||||||
|
|
|
@ -114,6 +114,7 @@ if ($action == "saveSettings")
|
||||||
$settings->_luceneDir = addDirSep($_POST["luceneDir"]);
|
$settings->_luceneDir = addDirSep($_POST["luceneDir"]);
|
||||||
$settings->_extraPath = addDirSep($_POST["extraPath"]);
|
$settings->_extraPath = addDirSep($_POST["extraPath"]);
|
||||||
$settings->_dropFolderDir = addDirSep($_POST["dropFolderDir"]);
|
$settings->_dropFolderDir = addDirSep($_POST["dropFolderDir"]);
|
||||||
|
$settings->_backupDir = addDirSep($_POST["backupDir"]);
|
||||||
$settings->_logFileEnable = getBoolValue("logFileEnable");
|
$settings->_logFileEnable = getBoolValue("logFileEnable");
|
||||||
$settings->_logFileRotation = $_POST["logFileRotation"];
|
$settings->_logFileRotation = $_POST["logFileRotation"];
|
||||||
$settings->_enableLargeFileUpload = getBoolValue("enableLargeFileUpload");
|
$settings->_enableLargeFileUpload = getBoolValue("enableLargeFileUpload");
|
||||||
|
|
|
@ -34,6 +34,13 @@ if (!$user->isAdmin()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($view) {
|
if($view) {
|
||||||
|
if($settings->_backupDir && file_exists($settings->_backupDir)) {
|
||||||
|
$view->setParam('backupdir', $settings->_backupDir);
|
||||||
|
$view->setParam('hasbackupdir', true);
|
||||||
|
} else {
|
||||||
|
$view->setParam('backupdir', $settings->_contentDir);
|
||||||
|
$view->setParam('hasbackupdir', false);
|
||||||
|
}
|
||||||
$view($_GET);
|
$view($_GET);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,24 +42,29 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
function show() { /* {{{ */
|
function show() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
$contentdir = $this->params['contentdir'];
|
$backupdir = $this->params['backupdir'];
|
||||||
|
|
||||||
$this->htmlStartPage(getMLText("backup_tools"));
|
$this->htmlStartPage(getMLText("backup_tools"));
|
||||||
$this->globalNavigation();
|
$this->globalNavigation();
|
||||||
$this->contentStart();
|
$this->contentStart();
|
||||||
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
||||||
|
|
||||||
|
/* 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->contentHeading(getMLText("backup_tools"));
|
||||||
$this->contentContainerStart();
|
$this->contentContainerStart();
|
||||||
print getMLText("space_used_on_data_folder")." : ".SeedDMS_Core_File::format_filesize(dskspace($contentdir));
|
print getMLText("space_used_on_data_folder")." : ".SeedDMS_Core_File::format_filesize(dskspace($backupdir));
|
||||||
$this->contentContainerEnd();
|
$this->contentContainerEnd();
|
||||||
|
}
|
||||||
|
|
||||||
// versioning file creation ////////////////////////////////////////////////////
|
// versioning file creation ////////////////////////////////////////////////////
|
||||||
|
|
||||||
$this->contentHeading(getMLText("versioning_file_creation"));
|
$this->contentHeading(getMLText("versioning_file_creation"));
|
||||||
$this->contentContainerStart();
|
|
||||||
print "<p>".getMLText("versioning_file_creation_warning")."</p>\n";
|
print "<p>".getMLText("versioning_file_creation_warning")."</p>\n";
|
||||||
|
$this->contentContainerStart();
|
||||||
print "<form class=\"form-inline\" action=\"../op/op.CreateVersioningFiles.php\" name=\"form1\">";
|
print "<form class=\"form-inline\" action=\"../op/op.CreateVersioningFiles.php\" name=\"form1\">";
|
||||||
$this->printFolderChooserHtml("form1",M_READWRITE);
|
$this->printFolderChooserHtml("form1",M_READWRITE);
|
||||||
print "<input type='submit' class='btn' name='' value='".getMLText("versioning_file_creation")."'/>";
|
print "<input type='submit' class='btn' name='' value='".getMLText("versioning_file_creation")."'/>";
|
||||||
|
@ -70,9 +75,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
// archive creation ////////////////////////////////////////////////////////////
|
// archive creation ////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$this->contentHeading(getMLText("archive_creation"));
|
$this->contentHeading(getMLText("archive_creation"));
|
||||||
$this->contentContainerStart();
|
|
||||||
print "<p>".getMLText("archive_creation_warning")."</p>\n";
|
print "<p>".getMLText("archive_creation_warning")."</p>\n";
|
||||||
|
$this->contentContainerStart();
|
||||||
print "<form action=\"../op/op.CreateFolderArchive.php\" name=\"form2\">";
|
print "<form action=\"../op/op.CreateFolderArchive.php\" name=\"form2\">";
|
||||||
$this->printFolderChooserHtml("form2",M_READWRITE);
|
$this->printFolderChooserHtml("form2",M_READWRITE);
|
||||||
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
|
print "<label class=\"checkbox\"><input type=\"checkbox\" name=\"human_readable\" value=\"1\">".getMLText("human_readable")."</label>";
|
||||||
|
@ -81,10 +85,10 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
// list backup files
|
// list backup files
|
||||||
|
|
||||||
$handle = opendir($contentdir);
|
$handle = opendir($backupdir);
|
||||||
$entries = array();
|
$entries = array();
|
||||||
while ($e = readdir($handle)){
|
while ($e = readdir($handle)){
|
||||||
if (is_dir($contentdir.$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;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +117,8 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
print "<td><a href=\"../op/op.Download.php?arkname=".$entry."\">".$entry."</a></td>\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";
|
if (is_object($folder)) print "<td>".htmlspecialchars($folder->getName())."</td>\n";
|
||||||
else print "<td>".getMLText("unknown_id")."</td>\n";
|
else print "<td>".getMLText("unknown_id")."</td>\n";
|
||||||
print "<td>".getLongReadableDate(filectime($contentdir.$entry))."</td>\n";
|
print "<td>".getLongReadableDate(filectime($backupdir.$entry))."</td>\n";
|
||||||
print "<td>".SeedDMS_Core_File::format_filesize(filesize($contentdir.$entry))."</td>\n";
|
print "<td>".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry))."</td>\n";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print "<a href=\"out.RemoveArchive.php?arkname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("backup_remove")."</a>";
|
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 "</td>\n";
|
||||||
|
@ -128,18 +132,18 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
// dump creation ///////////////////////////////////////////////////////////////
|
// dump creation ///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$this->contentHeading(getMLText("dump_creation"));
|
$this->contentHeading(getMLText("dump_creation"));
|
||||||
$this->contentContainerStart();
|
|
||||||
print "<p>".getMLText("dump_creation_warning")."</p>\n";
|
print "<p>".getMLText("dump_creation_warning")."</p>\n";
|
||||||
|
$this->contentContainerStart();
|
||||||
|
|
||||||
print "<form action=\"../op/op.CreateDump.php\" name=\"form4\">";
|
print "<form action=\"../op/op.CreateDump.php\" name=\"form4\">";
|
||||||
print "<input type='submit' class='btn' name='' value='".getMLText("dump_creation")."'/>";
|
print "<input type='submit' class='btn' name='' value='".getMLText("dump_creation")."'/>";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
// list backup files
|
// list backup files
|
||||||
$handle = opendir($contentdir);
|
$handle = opendir($backupdir);
|
||||||
$entries = array();
|
$entries = array();
|
||||||
while ($e = readdir($handle)){
|
while ($e = readdir($handle)){
|
||||||
if (is_dir($contentdir.$e)) continue;
|
if (is_dir($backupdir.$e)) continue;
|
||||||
if (strpos($e,".sql.gz")==FALSE) continue;
|
if (strpos($e,".sql.gz")==FALSE) continue;
|
||||||
$entries[] = $e;
|
$entries[] = $e;
|
||||||
}
|
}
|
||||||
|
@ -160,9 +164,11 @@ class SeedDMS_View_BackupTools extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
foreach ($entries as $entry){
|
foreach ($entries as $entry){
|
||||||
print "<tr>\n";
|
print "<tr>\n";
|
||||||
print "<td><a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a></td>\n";
|
print "<td>";
|
||||||
print "<td>".getLongReadableDate(filectime($contentdir.$entry))."</td>\n";
|
print "<a href=\"../op/op.Download.php?dumpname=".$entry."\">".$entry."</a>";
|
||||||
print "<td>".SeedDMS_Core_File::format_filesize(filesize($contentdir.$entry))."</td>\n";
|
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 "<td>";
|
||||||
print "<a href=\"out.RemoveDump.php?dumpname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("dump_remove")."</a>";
|
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 "</td>\n";
|
||||||
|
|
|
@ -398,6 +398,10 @@ if(!is_writeable($settings->_configFilePath)) {
|
||||||
<td><?php printMLText("settings_contentDir");?>:</td>
|
<td><?php printMLText("settings_contentDir");?>:</td>
|
||||||
<td><?php $this->showTextField("contentDir", $settings->_contentDir); ?></td>
|
<td><?php $this->showTextField("contentDir", $settings->_contentDir); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr title="<?php printMLText("settings_backupDir_desc");?>">
|
||||||
|
<td><?php printMLText("settings_backupDir");?>:</td>
|
||||||
|
<td><?php $this->showTextField("backupDir", $settings->_backupDir); ?></td>
|
||||||
|
</tr>
|
||||||
<tr title="<?php printMLText("settings_cacheDir_desc");?>">
|
<tr title="<?php printMLText("settings_cacheDir_desc");?>">
|
||||||
<td><?php printMLText("settings_cacheDir");?>:</td>
|
<td><?php printMLText("settings_cacheDir");?>:</td>
|
||||||
<td><?php $this->showTextField("cacheDir", $settings->_cacheDir); ?></td>
|
<td><?php $this->showTextField("cacheDir", $settings->_cacheDir); ?></td>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user