New: Can sort files into backup tool.

New: Default output charset are utf8 into backup tool.
This commit is contained in:
Laurent Destailleur 2012-02-10 10:53:11 +01:00
parent a2d3485b2a
commit 8336befb25
5 changed files with 84 additions and 38 deletions

View File

@ -44,6 +44,8 @@ For users:
- New: Value of data into charts are visible on mouse hover.
- New: Import wizard can import contacts.
- New: Install process is now two times faster.
- New: Can sort files into backup tool.
- New: Default output charset are utf8 into backup tool.
- New: Extra fields support int type.
- New: Add brazilian states.
- New: Automtic list of documents in ECM module is ok for customers,

View File

@ -22,21 +22,43 @@
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load("admin");
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.name";
if ($page < 0) {
$page = 0;
}
$limit = $conf->liste_limit;
$offset = $limit * $page;
if (! $user->admin) accessforbidden();
$form=new Form($db);
$formfile = new FormFile($db);
/*
* Actions
*/
// None
/*
* View
*/
$form=new Form($db);
$formfile = new FormFile($db);
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('','',$help_url);
@ -229,6 +251,10 @@ $label=getStaticMember($db, 'label');
id="checkbox_hexforbinary" checked="checked" /> <label
for="checkbox_hexforbinary"> <?php echo $langs->trans("EncodeBinariesInHexa"); ?></label><br>
<input type="checkbox" name="charset_utf8" value="yes"
id="checkbox_charset_utf8" checked="checked" disabled="disabled" /> <label
for="checkbox_charset_utf8"> <?php echo $langs->trans("UTF8"); ?></label><br>
</fieldset>
</fieldset>
<?php
@ -356,8 +382,10 @@ print "\n";
</form>
<?php
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
//if ($result) print '<br><br>';
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'',1,0,'',0,$langs->trans("PreviousDumpFiles"));
llxFooter();

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -26,59 +26,71 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$what=$_REQUEST["what"];
$export_type=$_REQUEST["export_type"];
$file=isset($_POST['filename_template']) ? $_POST['filename_template'] : '';
$langs->load("admin");
if (! $user->admin) accessforbidden();
$what=GETPOST("what");
$export_type=GETPOST("export_type");
$file=GETPOST('filename_template');
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date";
if ($page < 0) { $page = 0; }
$limit = $conf->liste_limit;
$offset = $limit * $page;
if (! $user->admin) accessforbidden();
if ($file && ! $what)
{
//print DOL_URL_ROOT.'/dolibarr_export.php';
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired",$langs->transnoentities("ExportMethod"))));
/*
print '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ExportMethod")).'</div>';
print '<br>';
*/
exit;
}
/*
* Actions
*/
// None
/*
* View
*/
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('','',$help_url);
$form=new Form($db);
$formfile = new FormFile($db);
print_fiche_titre($langs->trans("Backup"),'','setup');
*/
// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit=600;
if (!empty($ExecTimeLimit)) {
// Cette page peut etre longue. On augmente le delai autorise.
// Ne fonctionne que si on est pas en safe_mode.
if (!empty($ExecTimeLimit))
{
$err=error_reporting();
error_reporting(0); // Disable all errors
//error_reporting(E_ALL);
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err);
}
if (!empty($MemoryLimit)) {
if (!empty($MemoryLimit))
{
@ini_set('memory_limit', $MemoryLimit);
}
$form=new Form($db);
$formfile = new FormFile($db);
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('','',$help_url);
print_fiche_titre($langs->trans("Backup"),'','setup');
// Start with empty buffer
$dump_buffer = '';
$dump_buffer_len = 0;
// We send fake headers to avoid browser timeout when buffering
// We will send fake headers to avoid browser timeout when buffering
$time_start = time();
@ -132,8 +144,9 @@ if ($what == 'mysql')
}
else
{
$param.=" -d";
$param.=" -d"; // No row information (no data)
}
$param.=" --default-character-set=utf8"; // We always save output into utf8 charset
$paramcrypted=$param;
$paramclear=$param;
if (! empty($dolibarr_main_db_pass))
@ -333,7 +346,8 @@ if ($what)
}
}
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'',1,0,'',0,$langs->trans("PreviousDumpFiles"));
if ($result == 0)
{

View File

@ -57,9 +57,9 @@ $page = GETPOST("page");
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.name";
if ($page < 0) { $page = 0 ; }
if ($page < 0) { $page = 0; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$offset = $limit * $page;
$langs->load("companies");
$titre=$langs->trans("ListOfContacts");

View File

@ -171,10 +171,10 @@ class FormFile
* @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete)
* @param string $filedir Directory to scan
* @param string $urlsource Url of origin page (for return)
* @param int $genallowed Generation is allowed (1/0 or array of formats)
* @param int $genallowed Generation is allowed (1/0 or array list of templates)
* @param int $delallowed Remove is allowed (1/0)
* @param string $modelselected Model to preselect by default
* @param string $allowgenifempty Show warning if no model activated
* @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning)
* @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param int $iconPDF Show only PDF icon with link (1/0)
* @param int $maxfilenamelength Max length for filename shown
@ -536,18 +536,19 @@ class FormFile
* @param string $relativepath Relative path of docs (autodefined if not provided)
* @param int $permtodelete Permission to delete
* @param int $useinecm Change output for use in ecm module
* @param string $textifempty Text to show if filearray is empty
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
* @param int $maxlength Maximum length of file name shown
* @param string $title Title before list
* @return int <0 if KO, nb of files shown if OK
*/
function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0)
function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='')
{
global $user, $conf, $langs;
global $bc;
global $sortfield, $sortorder, $maxheightmini;
// Show list of existing files
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
if (empty($useinecm)) print_titre($title?$title:$langs->trans("AttachedFiles"));
//else { $bc[true]=''; $bc[false]=''; };
$url=$_SERVER["PHP_SELF"];
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">';
@ -614,7 +615,8 @@ class FormFile
print '</td></tr>';
}
print "</table>";
// Fin de zone
return $nboffiles;
}