28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44$action =
GETPOST(
'action',
'aZ09');
45$what =
GETPOST(
'what',
'alpha');
46$export_type =
GETPOST(
'export_type',
'alpha');
51$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
57$offset = $limit * $page;
71$utils =
new Utils($db);
80 header(
"Location: ".DOL_URL_ROOT.
'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"ExportMethod"))).(GETPOSTINT(
'page_y') ?
'&page_y='.GETPOSTINT(
'page_y') :
''));
84if ($action ==
'delete') {
95$_SESSION[
"commandbackuplastdone"] =
'';
96$_SESSION[
"commandbackuptorun"] =
'';
97$_SESSION[
"commandbackupresult"] =
'';
101if (!empty($ExecTimeLimit)) {
102 $err = error_reporting();
105 @set_time_limit($ExecTimeLimit);
106 error_reporting($err);
109if (!empty($MemoryLimit)) {
110 @ini_set(
'memory_limit', $MemoryLimit);
121$outputdir =
$conf->admin->dir_output.
'/backup';
129if ($what ==
'mysql') {
130 $cmddump =
GETPOST(
"mysqldump",
'none');
133 if (!empty($dolibarr_main_restrict_os_commands)) {
134 $arrayofallowedcommand = explode(
',', $dolibarr_main_restrict_os_commands);
135 $arrayofallowedcommand = array_map(
'trim', $arrayofallowedcommand);
136 dol_syslog(
"Command are restricted to ".$dolibarr_main_restrict_os_commands.
". We check that one of this command is inside ".$cmddump);
137 $basenamecmddump = basename(str_replace(
'\\',
'/', $cmddump));
138 if (!in_array($basenamecmddump, $arrayofallowedcommand)) {
139 $langs->load(
"errors");
140 $errormsg = $langs->trans(
'CommandIsNotInsideAllowedCommands');
141 $errormsg .=
'<br>'.$langs->trans(
'ErrorCheckTheCommandInsideTheAdvancedOptions');
145 if (!$errormsg && $cmddump) {
150 $utils->dumpDatabase(
GETPOST(
'compression',
'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
151 $errormsg = $utils->error;
152 $_SESSION[
"commandbackuplastdone"] = $utils->result[
'commandbackuplastdone'];
153 $_SESSION[
"commandbackuptorun"] = $utils->result[
'commandbackuptorun'];
158if ($what ==
'mysqlnobin') {
159 $utils->dumpDatabase(
GETPOST(
'compression',
'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
161 $errormsg = $utils->error;
162 $_SESSION[
"commandbackuplastdone"] = $utils->result[
'commandbackuplastdone'];
163 $_SESSION[
"commandbackuptorun"] = $utils->result[
'commandbackuptorun'];
167if ($what ==
'postgresql') {
168 $cmddump =
GETPOST(
"postgresqldump",
'none');
184 if (!$errormsg && $cmddump) {
189 $utils->dumpDatabase(
GETPOST(
'compression',
'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
190 $errormsg = $utils->error;
191 $_SESSION[
"commandbackuplastdone"] = $utils->result[
'commandbackuplastdone'];
192 $_SESSION[
"commandbackuptorun"] = $utils->result[
'commandbackuptorun'];
203 $resultstring .=
'<div class="error">'.$langs->trans(
"Error").
" : ".$errormsg.
'</div>';
205 $_SESSION[
"commandbackupresult"] = $resultstring;
208 setEventMessages($langs->trans(
"BackupFileSuccessfullyCreated").
'.<br>'.$langs->trans(
"YouCanDownloadBackupFile"),
null,
'mesgs');
210 $resultstring =
'<div class="ok">';
211 $resultstring .= $langs->trans(
"BackupFileSuccessfullyCreated").
'.<br>';
212 $resultstring .= $langs->trans(
"YouCanDownloadBackupFile");
213 $resultstring .=
'</div>';
215 $_SESSION[
"commandbackupresult"] = $resultstring;
234header(
"Location: dolibarr_export.php".(
GETPOSTINT(
'page_y') ?
'?page_y='.
GETPOSTINT(
'page_y') :
''));
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Class to manage utility methods.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_sanitizePathName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a path name.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.