Thought I throw something back to you guys, hope you find it useful.
This is tested on code in 1.3.4sp3, but I don’t think there should be any hassles on other versions.
This is a mod to add time/date of backup to table(including time), not relying on db name for date referencing.
I also changed default naming scheme to dump_yyyymmdd.
Table sort order is now newest to oldest (based on conventional/updated scheme).
Later on I might modify the code to sort by date regardless of name.
Highlighted in [COLOR=“Red”]red[/COLOR] is added, or changed code in: include/admin/database.php
// Backup database
if ($mode == 'backup') {
if (empty($dbdump_filename)) {
[COLOR="Red"] $dbdump_filename = 'dump_'.date('Ymd').'.sql';[/COLOR]
}
$files = fn_get_dir_contents($var_dir['database'].'backup', false, true, '.sql');
[COLOR="Red"]// sort($files, SORT_STRING);[/COLOR]
[COLOR="Red"]array_multisort($files,SORT_DESC,SORT_STRING);[/COLOR]
$backup_files = array();
if (is_array($files)) {
foreach ($files as $file) {
$backup_files[$file]['size'] = filesize($var_dir['database'].'backup'.DS.$file);
$backup_files[$file]['type'] = strpos($file, '.tgz')===false ? 'sql' : 'tgz';
[COLOR="Red"]$backup_files[$file]['time'] = date("H:i:s d/m/Y",filemtime($var_dir['database'].'backup'.DS.$file));[/COLOR]
}
}
fn_add_breadcrumb(fn_get_lang_var('tools'));
fn_add_breadcrumb(fn_get_lang_var('database_maintenance'));
$smarty->assign('backup_files', $backup_files);
$smarty->assign('backup_dir', $var_dir['database'].'backup'.DS);
$smarty->assign('content', 'database');
}
?>
Highlighted in [COLOR=“Red”]red[/COLOR] is added, or changed code in: skins/~skin name~/admin/tools_pages/database.tpl
```php
{$lang.backup_filename}:
[COLOR="Red"]
Backup Format: dump_yyyymmdd.sql
{$lang.text_backup_filename}
{$backup_dir}[/COLOR]
``````php
[COLOR="Red"] [/COLOR]
{if $backup_files}
{foreach from=$backup_files item=file key=name}
[COLOR="Red"][/COLOR]
{/foreach}
{else}
```
Also add language variable [COLOR="Red"]backup_time[/COLOR] with value [COLOR="Red"]Backup Time[/COLOR] (thanks for the reminder [B]wartornskull[/B])
Attached jpeg is how the finished code should look.
I would like to see similar code added to future versions, IMO it is quite handy.
Let me know what you guys think.
|
{$lang.type} | {$lang.filename} | {$lang.filesize} | {$lang.backup_time} |
|
[{$file.type}] |
{$name} |
{$file.size|number_format} {$lang.bytes} |
{$file.time} |