NEW Can set number of dump to keep with job "local database backup"

This commit is contained in:
Laurent Destailleur 2017-02-27 02:04:25 +01:00
parent 43f3e46aac
commit 74e8fb9c19
6 changed files with 29 additions and 5 deletions

View File

@ -2,7 +2,14 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 5.0.0 compared to 4.0.* *****
WARNING:
Following changes may create regression for some external modules, but were necessary to make Dolibarr better:
* The hook getNodeList has been replaced by a normalized 'addreplace' hook getDirList.
***** ChangeLog for 5.0.0 compared to 4.0.* ***** ***** ChangeLog for 5.0.0 compared to 4.0.* *****
For users: For users:

View File

@ -111,8 +111,9 @@ jQuery(document).ready(function() {
<?php <?php
print load_fiche_titre($langs->trans("Backup"),'','title_setup'); print load_fiche_titre($langs->trans("Backup"),'','title_setup');
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
print $langs->trans("BackupDesc",DOL_DATA_ROOT).'<br><br>'; print '<div class="center">'.$langs->trans("BackupDesc",DOL_DATA_ROOT).'</div><br><br>';
?> ?>
@ -121,7 +122,7 @@ print $langs->trans("BackupDesc",DOL_DATA_ROOT).'<br><br>';
name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input
type="hidden" name="export_type" value="server" /> type="hidden" name="export_type" value="server" />
<fieldset id="fieldsetexport"><legend style="font-size: 3em">1</legend> <fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>
<?php <?php
print $langs->trans("BackupDesc3",$dolibarr_main_db_name).'<br>'; print $langs->trans("BackupDesc3",$dolibarr_main_db_name).'<br>';
@ -468,7 +469,7 @@ print '</td></tr></table>';
?> ?>
</div> </div>
<div id="backupdatabaseright" class="fichehalfright" style="height:400px; overflow: auto;"> <div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">
<div class="ficheaddleft"> <div class="ficheaddleft">
<?php <?php
@ -484,7 +485,7 @@ print '<br>';
<br> <br>
<fieldset><legend style="font-size: 3em">2</legend> <fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
<?php <?php
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>'; print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescX").'<br><br>'; print $langs->trans("BackupDescX").'<br><br>';

View File

@ -145,6 +145,7 @@ class HookManager
'formatNotificationMessage', 'formatNotificationMessage',
'getFormMail', 'getFormMail',
'getIdProfUrl', 'getIdProfUrl',
'getDirList',
'moveUploadedFile', 'moveUploadedFile',
'pdf_build_address', 'pdf_build_address',
'pdf_writelinedesc', 'pdf_writelinedesc',

View File

@ -153,6 +153,7 @@ class Utils
{ {
global $db, $conf, $langs, $dolibarr_main_data_root; global $db, $conf, $langs, $dolibarr_main_data_root;
global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass; global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass;
$langs->load("admin"); $langs->load("admin");
@ -405,6 +406,19 @@ class Utils
$this->output = ""; $this->output = "";
$this->result = array("commandbackuplastdone" => "", "commandbackuptorun" => $command." ".$paramcrypted); $this->result = array("commandbackuplastdone" => "", "commandbackuptorun" => $command." ".$paramcrypted);
} }
// Clean old files
if ($keeplastnfiles > 0)
{
$tmpfiles = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '(\.err|\.old|\.sav)$', 'date', SORT_DESC);
$i=0;
foreach($tmpfiles as $key => $val)
{
$i++;
if ($i <= $keeplastnfiles) continue;
dol_delete_file($val['fullname']);
}
}
return 0; return 0;

View File

@ -378,7 +378,7 @@ input:-webkit-autofill {
input:-moz-placeholder { color:#ccc; } input:-moz-placeholder { color:#ccc; }
fieldset { border: 1px solid #AAAAAA !important; } fieldset { border: 1px solid #AAAAAA !important; }
.legendforfieldsetstep { padding-bottom: 10px; }
.button, .buttonDelete, input[name="sbmtConnexion"] { .button, .buttonDelete, input[name="sbmtConnexion"] {
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;

View File

@ -355,6 +355,7 @@ input:-webkit-autofill {
input:-moz-placeholder { color:#ccc; } input:-moz-placeholder { color:#ccc; }
fieldset { border: 1px solid #AAAAAA !important; } fieldset { border: 1px solid #AAAAAA !important; }
.legendforfieldsetstep { padding-bottom: 10px; }
.button, sbmtConnexion { .button, sbmtConnexion {