30require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
47$action =
GETPOST(
'action',
'aZ09');
48$what =
GETPOST(
'what',
'alpha');
49$export_type =
GETPOST(
'export_type',
'alpha');
54$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
55$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
57if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
60$offset = $limit * $page;
83 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') :
''));
87if ($action ==
'delete') {
98$_SESSION[
"commandbackuplastdone"] =
'';
99$_SESSION[
"commandbackuptorun"] =
'';
100$_SESSION[
"commandbackupresult"] =
'';
104if (!empty($ExecTimeLimit)) {
105 $err = error_reporting();
108 @set_time_limit($ExecTimeLimit);
109 error_reporting($err);
112if (!empty($MemoryLimit)) {
113 @ini_set(
'memory_limit', $MemoryLimit);
120$outputdir =
$conf->admin->dir_output.
'/backup';
128if ($what ==
'mysql') {
129 $cmddump =
GETPOST(
"mysqldump",
'none');
132 $basenamecmddump = basename(str_replace(
'\\',
'/', $cmddump));
135 if (preg_match(
'/\//', str_replace(
'\\',
'/', $cmddump))) {
138 if (preg_match(
'/mysqldump(\.exe)?$/', $cmddump, $reg)) {
139 $cmddump =
'mysqldump'.(empty($reg[1]) ?
'' : $reg[1]);
140 $langs->load(
"errors");
141 setEventMessage($langs->trans(
"WarningFullPathWasNotFoundSoWeUseAnAlternativeValue", $cmddump),
'warnings');
150 $result = $utils->dumpDatabase(
GETPOST(
'compression',
'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
152 $errormsg = $utils->error;
153 $_SESSION[
"commandbackuplastdone"] = $utils->result[
'commandbackuplastdone'];
154 $_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');
185 if (!$errormsg && $cmddump) {
190 $utils->dumpDatabase(
GETPOST(
'compression',
'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
191 $errormsg = $utils->error;
192 $_SESSION[
"commandbackuplastdone"] = $utils->result[
'commandbackuplastdone'];
193 $_SESSION[
"commandbackuptorun"] = $utils->result[
'commandbackuptorun'];
204 $resultstring .=
'<div class="error">'.$langs->trans(
"Error").
" : ".$errormsg.
'</div>';
206 $_SESSION[
"commandbackupresult"] = $resultstring;
209 setEventMessages($langs->trans(
"BackupFileSuccessfullyCreated").
'.<br>'.$langs->trans(
"YouCanDownloadBackupFile"),
null,
'mesgs');
211 $resultstring =
'<div class="ok">';
212 $resultstring .= $langs->trans(
"BackupFileSuccessfullyCreated").
'.<br>';
213 $resultstring .= $langs->trans(
"YouCanDownloadBackupFile");
214 $resultstring .=
'</div>';
216 $_SESSION[
"commandbackupresult"] = $resultstring;
235header(
"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.
dol_is_file($pathoffile)
Return if path is a file.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.