Struggeling with relocating
Dieser Commit ist enthalten in:
Commit
89ea01c429
301 geänderte Dateien mit 59926 neuen und 0 gelöschten Zeilen
77
inc/filemanagement/converter.php
Normale Datei
77
inc/filemanagement/converter.php
Normale Datei
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
@ini_set('max_execution_time', 0);
|
||||
|
||||
// first output menu to show it while converting.
|
||||
// Otherwise it would only be shwon after the conversion is finished
|
||||
include ('./inc/menu.php');
|
||||
$tplGlobalHeader->pparse('tplGlobalHeader');
|
||||
$tplMenu->pparse('tplMenu');
|
||||
|
||||
// Konverter
|
||||
$selectfile = (isset($_POST['selectfile'])) ? $_POST['selectfile'] : '';
|
||||
$destfile = (isset($_POST['destfile'])) ? $_POST['destfile'] : '';
|
||||
$compressed = (isset($_POST['compressed'])) ? $_POST['compressed'] : '';
|
||||
include ('./inc/define_icons.php');
|
||||
$doConversion = false;
|
||||
if ($selectfile != '' & file_exists($config['paths']['backup'] . $selectfile)
|
||||
&& strlen($destfile) > 2) {
|
||||
$doConversion = true;
|
||||
}
|
||||
|
||||
$tpl = new MSDTemplate();
|
||||
$tpl->set_filenames(array('show' => 'tpl/filemanagement/converter.tpl'));
|
||||
|
||||
$tpl->assign_vars(
|
||||
array(
|
||||
'SELECTBOX_FILE_LIST' => getFilelisteCombo($selectfile),
|
||||
'NEW_FILE' => Html::replaceQuotes($destfile),
|
||||
'NEW_FILE_COMPRESED' => $compressed == 1 ? ' checked="checked"' : '',
|
||||
'ICON_GZ' => $icon['gz']
|
||||
)
|
||||
);
|
||||
|
||||
if ($doConversion) {
|
||||
$tpl->assign_block_vars('AUTOSCROLL', array());
|
||||
}
|
||||
|
||||
$tpl->pparse('show');
|
||||
flush();
|
||||
if (isset($_POST['startconvert'])) {
|
||||
echo $lang['L_CONVERTING'] . ' ' . $selectfile
|
||||
. ' ==> ' . $destfile . '.sql';
|
||||
if ($compressed == 1) {
|
||||
echo '.gz';
|
||||
}
|
||||
if ($doConversion) {
|
||||
convert($selectfile, $destfile, $compressed);
|
||||
} else {
|
||||
echo '<br /><p class="error">' . $lang['L_CONVERT_WRONG_PARAMETERS']
|
||||
. '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($doConversion) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
setTimeout('clearTimeout(scrolldelay)',2000);
|
||||
/*]]>*/
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
die(); // menu is shown - nothing more to do;
|
||||
68
inc/filemanagement/file_delete.php
Normale Datei
68
inc/filemanagement/file_delete.php
Normale Datei
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
$del = array();
|
||||
if (isset($_POST['delete'])) {
|
||||
if (isset($_POST['file'])) {
|
||||
$delfiles = Array();
|
||||
for ($i = 0; $i < count($_POST['file']); $i++) {
|
||||
if (!strpos($_POST['file'][$i], '_part_') === false) {
|
||||
$pos = strpos($_POST['file'][$i], '_part_');
|
||||
$delfiles[] = substr($_POST['file'][$i], 0, $pos + 6);
|
||||
} else {
|
||||
$delfiles[] = $_POST['file'][$i];
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < count($delfiles); $i++) {
|
||||
$del = array_merge(
|
||||
$del,
|
||||
deleteMultipartFiles($config['paths']['backup'], $delfiles[$i])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$msg .= Html::getErrorMsg($lang['L_FM_NOFILE']);
|
||||
}
|
||||
}
|
||||
if (isset($_POST['deleteauto'])) {
|
||||
$deleteResult = doAutoDelete();
|
||||
if ($deleteResult > '') {
|
||||
$msg .= $deleteResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['deleteall']) || isset($_POST['deleteallfilter'])) {
|
||||
if (isset($_POST['deleteall'])) {
|
||||
$del = deleteMultipartFiles($config['paths']['backup'], '', '.sql');
|
||||
$del = array_merge(
|
||||
$del, deleteMultipartFiles($config['paths']['backup'], '', '.gz')
|
||||
);
|
||||
} else {
|
||||
$del = deleteMultipartFiles($config['paths']['backup'], $dbactive);
|
||||
}
|
||||
}
|
||||
|
||||
// print file-delete-messages
|
||||
if (is_array($del) && sizeof($del) > 0) {
|
||||
foreach ($del as $file => $success) {
|
||||
if ($success) {
|
||||
$msg .= $lang['L_FM_DELETE1'] . ' \'' . $file . '\' ';
|
||||
$msg .= $lang['L_FM_DELETE2'];
|
||||
$msg = Html::getOkMsg($msg);
|
||||
$log->write(Log::PHP, "Deleted '$file'.");
|
||||
} else {
|
||||
$msg .= $lang['L_FM_DELETE1'] . ' \'' . $file . '\' ';
|
||||
$msg .= $lang['L_FM_DELETE3'];
|
||||
$msg = Html::getErrorMsg($msg);
|
||||
$log->write(Log::PHP, "Deleted '$file'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
41
inc/filemanagement/file_download.php
Normale Datei
41
inc/filemanagement/file_download.php
Normale Datei
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
// Download of a backup file wanted
|
||||
$file = urldecode($_GET['f']);
|
||||
|
||||
// check for injected chars by removing allowed chars and check if the rest
|
||||
// only contains alphanumerical chars
|
||||
$search = array('-','.', '_');
|
||||
$replace = array('', '', '');
|
||||
$check = str_replace($search, $replace, $file);
|
||||
if (ctype_alnum($check) && is_readable($config['paths']['backup'] . $file)) {
|
||||
$file = './' . $config['paths']['backup'] . $file;
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename=' . basename($file));
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . (string) filesize($file));
|
||||
flush();
|
||||
$file = fopen($file, "rb");
|
||||
while (!feof($file)) {
|
||||
print fread($file, round(100 * 1024));
|
||||
flush();
|
||||
}
|
||||
fclose($file);
|
||||
} else {
|
||||
die('Error: Couldn\'t open file: ' . $file);
|
||||
}
|
||||
die();
|
||||
49
inc/filemanagement/file_upload.php
Normale Datei
49
inc/filemanagement/file_upload.php
Normale Datei
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) {
|
||||
die('No direct access.');
|
||||
}
|
||||
if (!isset($_FILES['upfile']['name'])
|
||||
|| trim($_FILES['upfile']['name']) == '') {
|
||||
$msg .= Html::getErrorMsg(
|
||||
$lang['L_FM_UPLOADFILEREQUEST'] . '<br />' . $lang['L_FM_UPLOADFAILED']
|
||||
);
|
||||
} else {
|
||||
if (!file_exists($config['paths']['backup'] . $_FILES['upfile']['name'])) {
|
||||
$extension = strrchr($_FILES['upfile']['name'], '.');
|
||||
$allowedExtensions = array('.gz', '.sql', 'txt');
|
||||
if (!in_array($extension, $allowedExtensions)) {
|
||||
$msg .= Html::getErrorMsg(
|
||||
$lang['L_FM_UPLOADNOTALLOWED1'] . '<br />'
|
||||
. $lang['L_FM_UPLOADNOTALLOWED2']
|
||||
);
|
||||
$msg .= Html::getErrorMsg($lang['L_FM_UPLOADFAILED']);
|
||||
} else {
|
||||
$upfile = $config['paths']['backup'] . $_FILES['upfile']['name'];
|
||||
if (@move_uploaded_file($_FILES['upfile']['tmp_name'], $upfile)) {
|
||||
@chmod($upfile, 0777);
|
||||
$msg = Html::getOkMsg(
|
||||
sprintf(
|
||||
$lang['L_FILE_UPLOAD_SUCCESSFULL'],
|
||||
$_FILES['upfile']['name']
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$msg .= Html::getErrorMsg($lang['L_FM_UPLOADMOVEERROR']);
|
||||
$msg .= Html::getErrorMsg($lang['L_FM_UPLOADFAILED']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$msg .= Html::getErrorMsg($lang['L_FM_UPLOADFILEEXISTS']);
|
||||
$msg .= Html::getErrorMsg($lang['L_FM_UPLOADFAILED']);
|
||||
}
|
||||
}
|
||||
237
inc/filemanagement/files.php
Normale Datei
237
inc/filemanagement/files.php
Normale Datei
|
|
@ -0,0 +1,237 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @version SVN: $rev: 1207 $
|
||||
* @author $Author$
|
||||
* @lastmodified $Date$
|
||||
*/
|
||||
|
||||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
include ('./inc/define_icons.php');
|
||||
$expand = (isset($_GET['expand'])) ? $_GET['expand'] : -1;
|
||||
|
||||
// execute delete action if clicked
|
||||
if (isset($_POST['delete']) || isset($_POST['deleteauto'])
|
||||
|| isset($_POST['deleteall']) || isset($_POST['deleteallfilter'])) {
|
||||
include ('./inc/filemanagement/file_delete.php');
|
||||
}
|
||||
|
||||
$tplFiles = new MSDTemplate();
|
||||
$tplFiles->set_filenames(array('tplFiles' => 'tpl/filemanagement/files.tpl'));
|
||||
|
||||
$dbactualOutput = $dbactive;
|
||||
// replace internal keys for backups of other programs and converted files
|
||||
// with human readable output
|
||||
if ($dbactive == '~unknown') {
|
||||
$dbactualOutput = '<i>' . $lang['L_UNKNOWN'] . '</i>';
|
||||
}
|
||||
if ($dbactive == '~converted') {
|
||||
$dbactualOutput = '<i>' . $lang['L_CONVERTED_FILES'] . '</i>';
|
||||
}
|
||||
$autoDelete = $lang['L_NOT_ACTIVATED'];
|
||||
if ($config['auto_delete']['activated'] > 0) {
|
||||
$autoDelete = $lang['L_ACTIVATED'] . ' ('
|
||||
. $config['auto_delete']['max_backup_files'] . ' '
|
||||
. $lang['L_MAX_BACKUP_FILES_EACH2'] . ')';
|
||||
}
|
||||
|
||||
$tplFiles->assign_vars(
|
||||
array(
|
||||
'BACKUP_PATH' => $config['paths']['backup'],
|
||||
'ICON_DOWNLOAD' => $icon['open_file'],
|
||||
'ICON_VIEW' => $icon['view'],
|
||||
'ICON_DELETE' => $icon['delete'],
|
||||
'DB_ACTUAL' => $dbactive,
|
||||
'DB_ACTUAL_OUTPUT' => $dbactualOutput,
|
||||
'UPLOAD_MAX_SIZE' => $config['upload_max_filesize'],
|
||||
'AUTODELETE_ENABLED' => $autoDelete,
|
||||
'NOTIFICATION_POSITION' => $config['notification_position']
|
||||
)
|
||||
);
|
||||
|
||||
if ($msg > '') {
|
||||
$tplFiles->assign_block_vars(
|
||||
'MESSAGE', array('TEXT' => Html::getJsQuote($msg, true))
|
||||
);
|
||||
}
|
||||
$backups = getBackupfileInfo();
|
||||
$i = 0;
|
||||
if (!isset($backups['databases'][$dbactive])) {
|
||||
$tplFiles->assign_block_vars('NO_FILE_FOUND', array());
|
||||
}
|
||||
if ($dbactive != '~unknown' && $dbactive != '~converted') {
|
||||
$tplFiles->assign_block_vars('DELETE_FILTER', array());
|
||||
}
|
||||
// show detailed file info of the selected database at top
|
||||
foreach ($backups['files'] as $backup) {
|
||||
if ($backup['db'] == $dbactive) {
|
||||
// get MySQL Version from which the backup was taken
|
||||
$mysqlVersion = '';
|
||||
if (isset($backup['mysqlversion'])) {
|
||||
$mysqlVersion = $backup['mysqlversion'];
|
||||
}
|
||||
// get grouping name of database
|
||||
$dbName = $backup['name'];
|
||||
if (!in_array($backup['db'], array('~unknown', '~converted'))) {
|
||||
$dbName = $backup['db'];
|
||||
}
|
||||
// with which MSD-Version was the backup made?
|
||||
$scriptVersion = $lang['L_UNKNOWN'];
|
||||
if ($backup['script'] > '') {
|
||||
$scriptVersion = $backup['script'];
|
||||
}
|
||||
// show Gzip-Icon?
|
||||
$compressed = substr($backup['name'], -3) == '.gz' ? $icon['gz'] : '-';
|
||||
// is a commetn given?
|
||||
$comment = '';
|
||||
if ($backup['comment'] > '') {
|
||||
$comment = nl2br(wordwrap($backup['comment'], 50));
|
||||
}
|
||||
// number of tables
|
||||
$nrOfTables = $lang['L_UNKNOWN'];
|
||||
if ($backup['tables'] > -1) {
|
||||
$nrOfTables = String::formatNumber($backup['tables']);
|
||||
}
|
||||
// number of records
|
||||
$nrOfRecords = $lang['L_UNKNOWN'];
|
||||
if ($backup['records'] > -1) {
|
||||
$nrOfRecords = String::formatNumber($backup['records']);
|
||||
}
|
||||
// charset of bakup file
|
||||
$charset = $lang['L_UNKNOWN'];
|
||||
if ($backup['charset'] != '?') {
|
||||
$charset = $backup['charset'];
|
||||
}
|
||||
|
||||
$tplFiles->assign_block_vars(
|
||||
'FILE',
|
||||
array(
|
||||
'ROWCLASS' => $i % 2 ? 'dbrow' : 'dbrow1',
|
||||
'FILE_INDEX' => $i,
|
||||
// expand or unexpand multipart list on next click
|
||||
'FILE_EXPAND_INDEX' => $expand == $i ? -1 : $i,
|
||||
'FILE_NAME' => $backup['name'],
|
||||
'FILE_NAME_URLENCODED' => urlencode($backup['name']),
|
||||
'DB_NAME' => $dbName,
|
||||
'ICON_COMPRESSED' => $compressed,
|
||||
'SCRIPT_VERSION' => $scriptVersion,
|
||||
'COMMENT' => $comment,
|
||||
'FILE_CREATION_DATE' => $backup['date'],
|
||||
'NR_OF_TABLES' => $nrOfTables,
|
||||
'NR_OF_RECORDS' => $nrOfRecords,
|
||||
'FILESIZE' => byteOutput($backup['size']),
|
||||
'FILE_CHARSET' => $charset,
|
||||
'NR_OF_MULTIPARTS' => $backup['multipart'],
|
||||
'MYSQL_VERSION' => $mysqlVersion
|
||||
)
|
||||
);
|
||||
|
||||
if ($backup['multipart'] > 0) {
|
||||
$mpFileHeadline = $lang['L_FILES'];
|
||||
if ($backup['multipart'] == 1) {
|
||||
$mpFileHeadline = $lang['L_FILE'];
|
||||
}
|
||||
$tplFiles->assign_block_vars(
|
||||
'FILE.IS_MULTIPART', array('FILES' => $mpFileHeadline)
|
||||
);
|
||||
} else {
|
||||
$tplFiles->assign_block_vars('FILE.NO_MULTIPART', array());
|
||||
}
|
||||
if ($backup['multipart'] > 0) {
|
||||
// show all files of a Multipart-backup
|
||||
$tplFiles->assign_block_vars(
|
||||
'FILE.EXPAND_MULTIPART',
|
||||
array(
|
||||
'NR' => $i,
|
||||
'ROWCLASS' => $i % 2 ? 'dbrow1' : 'dbrow'
|
||||
)
|
||||
);
|
||||
// expand multipartlist if click came from restore screen
|
||||
if ($expand == $i) {
|
||||
$tplFiles->assign_block_vars(
|
||||
'EXPAND_MP_FILE', array('FILEINDEX' => $i)
|
||||
);
|
||||
}
|
||||
|
||||
$partPosition = strrpos($backup['name'], 'part_');
|
||||
$fileBase = substr($backup['name'], 0, $partPosition) . 'part_';
|
||||
$fileExtension = '.sql';
|
||||
if (substr($backup['name'], -2) == 'gz') {
|
||||
$fileExtension = '.sql.gz';
|
||||
}
|
||||
for ($x = 0; $x < $backup['multipart']; $x++) {
|
||||
$fileName = $fileBase . ($x + 1) . $fileExtension;
|
||||
$fileSize = $lang['L_UNKNOWN'];
|
||||
$file = $config['paths']['backup'] . $fileName;
|
||||
if (!is_readable($file)) {
|
||||
$fileName = $backup['name'];
|
||||
$fileSize = byteOutput(@filesize($file));
|
||||
}
|
||||
$tplFiles->assign_block_vars(
|
||||
'FILE.EXPAND_MULTIPART.MP_FILE',
|
||||
array(
|
||||
'ROWCLASS' => $x % 2 ? 'dbrow' : 'dbrow1',
|
||||
'NR' => $x + 1,
|
||||
'FILE_NAME' => $fileName,
|
||||
'FILE_NAME_URLENCODED' => urlencode($fileName),
|
||||
'FILE_SIZE' => $fileSize
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
//sort databases according to the databasenames ascending
|
||||
ksort($backups['databases']);
|
||||
// list summary of other backup files grouped by databases
|
||||
if (count($backups['databases']) > 0) {
|
||||
$i = 0;
|
||||
foreach ($backups['databases'] as $db => $info) {
|
||||
$rowclass = $i % 2 ? 'dbrow' : 'dbrow1';
|
||||
if ($db == $dbactive) {
|
||||
$rowclass = 'dbrowsel';
|
||||
}
|
||||
$dbNameOutput = $db;
|
||||
if ($db == '~unknown') {
|
||||
$dbNameOutput = '<i>' . $lang['L_NO_MSD_BACKUPFILE'] . '</i>';
|
||||
}
|
||||
if ($db == '~converted') {
|
||||
$dbNameOutput = '<i>' . $lang['L_CONVERTED_FILES'] . '</i>';
|
||||
}
|
||||
|
||||
$nrOfBackups = isset($info['backup_count']) ? $info['backup_count'] : 0;
|
||||
$latestBackup = '-';
|
||||
if (isset($info['latest_backup_timestamp'])) {
|
||||
$latestBackup = $info['latest_backup_timestamp'];
|
||||
}
|
||||
$fileSizeTotal = 0;
|
||||
if (isset($info['backup_size_total'])) {
|
||||
$fileSizeTotal = byteOutput($info['backup_size_total']);
|
||||
}
|
||||
|
||||
$tplFiles->assign_block_vars(
|
||||
'DB',
|
||||
array(
|
||||
'ROWCLASS' => $rowclass,
|
||||
'DB_NAME_LINK' => $db,
|
||||
'DB_NAME' => $dbNameOutput,
|
||||
'NR_OF_BACKUPS' => $nrOfBackups,
|
||||
'LATEST_BACKUP' => $latestBackup,
|
||||
'SUM_SIZE' => $fileSizeTotal
|
||||
)
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$tplFiles->assign_vars(
|
||||
array(
|
||||
'SUM_SIZE' => byteOutput($backups['filesize_total']),
|
||||
'FREESPACE_ON_SERVER' => getFreeDiskSpace()
|
||||
)
|
||||
);
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren