* @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 */ //require_once("class.Bootstrap.php"); /** * Class which outputs the html page for BackupTools view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_BackupTools extends SeedDMS_Theme_Style { function js() { /* {{{ */ header('Content-Type: application/javascript; charset=UTF-8'); // $this->printFolderChooserJs("form1"); // $this->printFolderChooserJs("form2"); // $this->printFolderChooserJs("form3"); } /* }}} */ function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $accessop = $this->params['accessobject']; $backupdir = $this->params['backupdir']; $this->htmlStartPage(getMLText("backup_tools")); $this->globalNavigation(); $this->contentStart(); $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->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")); print "

".getMLText("versioning_file_creation_warning")."

\n"; $this->contentContainerStart(); print "
"; $this->printFolderChooserHtml("form1",M_READWRITE); print ""; print "
\n"; $this->contentContainerEnd(); // archive creation //////////////////////////////////////////////////////////// if($this->params['hasbackupdir']) { $this->contentHeading(getMLText("archive_creation")); print "

".getMLText("archive_creation_warning")."

\n"; $this->contentContainerStart(); if($accessop->check_controller_access('CreateFolderArchive', array('action'=>'run'))) { print "
"; $this->printFolderChooserHtml("form2",M_READWRITE); print ""; print ""; print "
\n"; } // list backup files $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 "\n"; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n\n"; foreach ($entries as $entry){ $folderid=substr($entry,strpos($entry,"_")+1); $folder=$dms->getFolder((int)$folderid); print "\n"; print "\n"; if (is_object($folder)) print "\n"; else print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
".getMLText("folder")."".getMLText("creation_date")."".getMLText("filesize")."
"; if($accessop->check_controller_access('Download', array('action'=>'archive'))) print "".$entry.""; else print $entry; print "".htmlspecialchars($folder->getName())."".getMLText("unknown_id")."".getLongReadableDate(filectime($backupdir.$entry))."".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry)).""; if($accessop->check_controller_access('RemoveArchive', array('action'=>'run'))) print " ".getMLText("backup_remove").""; print "
\n"; } $this->contentContainerEnd(); // dump creation /////////////////////////////////////////////////////////////// $this->contentHeading(getMLText("dump_creation")); print "

".getMLText("dump_creation_warning")."

\n"; $this->contentContainerStart(); if($accessop->check_controller_access('CreateDump', array('action'=>'run'))) { print "
"; print ""; print "
\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 "\n"; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n\n"; foreach ($entries as $entry){ print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
".getMLText("creation_date")."".getMLText("filesize")."
"; if($accessop->check_controller_access('Download', array('action'=>'sqldump'))) print "".$entry.""; else print $entry; print "".getLongReadableDate(filectime($backupdir.$entry))."".SeedDMS_Core_File::format_filesize(filesize($backupdir.$entry)).""; if($accessop->check_controller_access('RemoveDump', array('action'=>'run'))) print " ".getMLText("dump_remove").""; print "
\n"; } $this->contentContainerEnd(); } else { $this->warningMsg(getMLText('no_backup_dir')); } // files deletion ////////////////////////////////////////////////////////////// /* $this->contentHeading(getMLText("files_deletion")); $this->contentContainerStart(); print "

".getMLText("files_deletion_warning")."

\n"; print "
"; $this->printFolderChooserHtml("form3",M_READWRITE); print ""; print "
\n"; $this->contentContainerEnd(); */ $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>