2012-07-06 10:03:25 +00:00
|
|
|
<?php
|
|
|
|
// MyDMS. Document Management System
|
|
|
|
// Copyright (C) 2010 Matteo Lucarelli
|
2016-08-09 05:34:30 +00:00
|
|
|
// Copyright (C) 2010-2016 Uwe Steinmann
|
2012-07-06 10:03:25 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
include("../inc/inc.Settings.php");
|
2022-11-09 05:40:50 +00:00
|
|
|
include("../inc/inc.Utils.php");
|
2012-07-06 10:03:25 +00:00
|
|
|
include("../inc/inc.LogInit.php");
|
2014-12-08 13:47:32 +00:00
|
|
|
include("../inc/inc.Language.php");
|
|
|
|
include("../inc/inc.Init.php");
|
|
|
|
include("../inc/inc.Extension.php");
|
2010-10-29 13:19:51 +00:00
|
|
|
include("../inc/inc.DBInit.php");
|
2012-07-06 10:03:25 +00:00
|
|
|
include("../inc/inc.ClassUI.php");
|
2010-10-29 13:19:51 +00:00
|
|
|
include("../inc/inc.Authentication.php");
|
|
|
|
|
|
|
|
if (!$user->isAdmin()) {
|
2012-07-06 10:03:25 +00:00
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
|
|
|
|
2019-07-30 04:39:25 +00:00
|
|
|
if (!$settings->_backupDir) {
|
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("no_backup_dir"));
|
|
|
|
}
|
|
|
|
|
2015-12-09 20:20:43 +00:00
|
|
|
$v = new SeedDMS_Version;
|
2020-08-31 10:59:39 +00:00
|
|
|
$dump_name = addDirSep($settings->_backupDir).date('Y-m-d\TH-i-s')."_".$v->version().".sql";
|
2021-09-17 17:03:14 +00:00
|
|
|
$fp = fopen($dump_name, "w");
|
|
|
|
if(!$fp)
|
2010-10-29 13:19:51 +00:00
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
2021-09-17 17:03:14 +00:00
|
|
|
if(!$dms->getDb()->createDump($fp)) {
|
|
|
|
fclose($fp);
|
|
|
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
|
|
|
}
|
|
|
|
fclose($fp);
|
2010-10-29 13:19:51 +00:00
|
|
|
|
2013-02-14 11:10:53 +00:00
|
|
|
if (SeedDMS_Core_File::gzcompressfile($dump_name,9)) unlink($dump_name);
|
2010-10-29 13:19:51 +00:00
|
|
|
else UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
|
|
|
|
|
|
|
add_log_line();
|
|
|
|
|
2012-07-06 10:03:25 +00:00
|
|
|
header("Location:../out/out.BackupTools.php");
|
|
|
|
|
|
|
|
?>
|