Merge pull request #22647 from bb2a/FIX---Max-size-send-backup
NEW - Add max size send backup and linck to mail if max size
This commit is contained in:
commit
7a58d846e2
@ -1255,9 +1255,10 @@ class Utils
|
|||||||
* @param string $message Message
|
* @param string $message Message
|
||||||
* @param string $filename List of files to attach (full path of filename on file system)
|
* @param string $filename List of files to attach (full path of filename on file system)
|
||||||
* @param string $filter Filter file send
|
* @param string $filter Filter file send
|
||||||
|
* @param string $sizelimit Limit size to send file
|
||||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||||
*/
|
*/
|
||||||
public function sendBackup($sendto = '', $from = '', $subject = '', $message = '', $filename = '', $filter = '')
|
public function sendBackup($sendto = '', $from = '', $subject = '', $message = '', $filename = '', $filter = '', $sizelimit = 100000000)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -1315,9 +1316,13 @@ class Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($filepath) {
|
if ($filepath) {
|
||||||
if ($filesize > 100000000) {
|
if ($filesize > $sizelimit) {
|
||||||
$output = 'Sorry, last backup file is too large to be send by email';
|
$message .= '<br>'.$langs->trans("BackupIsTooLargeSend");
|
||||||
$error++;
|
$documenturl = $dolibarr_main_url_root.'/document.php?modulepart=systemtools&atachement=1&file=backup/'.urlencode($filename[0]);
|
||||||
|
$message .= '<br><a href='.$documenturl.'>Lien de téléchargement</a>';
|
||||||
|
$filepath = '';
|
||||||
|
$mimetype = '';
|
||||||
|
$filename = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$output = 'No backup file found';
|
$output = 'No backup file found';
|
||||||
|
|||||||
@ -84,6 +84,7 @@ MakeLocalDatabaseDumpShort=Local database backup
|
|||||||
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
|
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
|
||||||
MakeSendLocalDatabaseDumpShort=Send local database backup
|
MakeSendLocalDatabaseDumpShort=Send local database backup
|
||||||
MakeSendLocalDatabaseDump=Send local database backup by email. Parameters are: to, from, subject, message, filename (Name of file sent), filter ('sql' for backup of database only)
|
MakeSendLocalDatabaseDump=Send local database backup by email. Parameters are: to, from, subject, message, filename (Name of file sent), filter ('sql' for backup of database only)
|
||||||
|
BackupIsTooLargeSend=Sorry, last backup file is too large to be send by email
|
||||||
CleanUnfinishedCronjobShort=Clean unfinished cronjob
|
CleanUnfinishedCronjobShort=Clean unfinished cronjob
|
||||||
CleanUnfinishedCronjob=Clean cronjob stuck in processing when the process is no longer running
|
CleanUnfinishedCronjob=Clean cronjob stuck in processing when the process is no longer running
|
||||||
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
|
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user