80 public function purgeFiles($choices =
'tempfilesold+logfiles', $nbsecondsold = 86400)
82 global
$conf, $langs, $user;
83 global $dolibarr_main_data_root;
85 $langs->load(
"admin");
87 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
89 if (empty($choices)) {
90 $choices =
'tempfilesold+logfiles';
92 if ($choices ==
'allfiles' && $nbsecondsold > 0) {
93 $choices =
'allfilesold';
96 dol_syslog(
"Utils::purgeFiles choice=".$choices, LOG_DEBUG);
99 if (in_array($choices, array(
'allfiles',
'allfilesold'))) {
100 if (empty($user->admin)) {
101 $this->output =
'Error: to erase data files, user running the batch (currently '.$user->login.
') must be an admin user';
111 $choicesarray = preg_split(
'/[\+,]/', $choices);
112 foreach ($choicesarray as $choice) {
114 $filesarray = array();
116 if ($choice ==
'tempfiles' || $choice ==
'tempfilesold') {
118 if ($dolibarr_main_data_root) {
119 $filesarray =
dol_dir_list($dolibarr_main_data_root,
"directories", 1,
'^temp$',
'',
'name', SORT_ASC, 2, 0,
'', 1);
121 if ($choice ==
'tempfilesold') {
122 foreach ($filesarray as $key => $val) {
123 if ($val[
'date'] > ($now - ($nbsecondsold))) {
124 unset($filesarray[$key]);
131 if ($choice ==
'allfiles') {
133 if ($dolibarr_main_data_root) {
134 $filesarray =
dol_dir_list($dolibarr_main_data_root,
"all", 0,
'',
'(\.lock|\.unlock)$',
'name', SORT_ASC, 0, 0,
'', 1);
138 if ($choice ==
'allfilesold') {
140 if ($dolibarr_main_data_root) {
141 $filesarray =
dol_dir_list($dolibarr_main_data_root,
"files", 1,
'',
'(\.lock|\.unlock)$',
'name', SORT_ASC, 0, 0,
'', 1, $nbsecondsold);
145 if ($choice ==
'logfile' || $choice ==
'logfiles') {
147 if ($dolibarr_main_data_root) {
148 $filesarray =
dol_dir_list($dolibarr_main_data_root,
"files", 0,
'.*\.log[\.0-9]*(\.gz)?$',
'(\.lock|\.unlock)$',
'name', SORT_ASC, 0, 0,
'', 1);
153 $filelog = preg_replace(
'/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
155 $alreadyincluded =
false;
156 foreach ($filesarray as $tmpcursor) {
157 if ($tmpcursor[
'fullname'] == $filelog) {
158 $alreadyincluded =
true;
161 if (!$alreadyincluded) {
162 $filesarray[] = array(
'fullname' => $filelog,
'type' =>
'file');
167 if (is_array($filesarray) && count($filesarray)) {
168 foreach ($filesarray as $key => $value) {
170 if ($filesarray[$key][
'type'] ==
'dir') {
172 $tmpcountdeleted = 0;
177 $conf->user->dir_temp,
180 $excluded[] =
$conf->api->dir_temp;
183 if (!in_array($filesarray[$key][
'fullname'], $excluded)) {
185 $countdeleted += $tmpcountdeleted;
187 } elseif ($filesarray[$key][
'type'] ==
'file') {
188 if ($choice !=
'allfilesold' || $filesarray[$key][
'date'] < ($now - $nbsecondsold)) {
190 if ($filesarray[$key][
'fullname'] != $filelog || $choice ==
'logfile' || $choice ==
'logfiles') {
205 require_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmdirectory.class.php';
207 $result = $ecmdirstatic->refreshcachenboffile(1);
213 $langs->load(
"admin");
214 $this->output = $langs->trans(
"PurgeNDirectoriesDeleted", $countdeleted);
215 if ($count > $countdeleted) {
216 $this->output .=
'<br>'.$langs->trans(
"PurgeNDirectoriesFailed", ($count - $countdeleted));
219 $this->output = $langs->trans(
"PurgeNothingToDelete").(in_array(
'tempfilesold', $choicesarray) ?
' (older than 24h for temp files)' :
'');
247 public function dumpDatabase($compression =
'none', $type =
'auto', $usedefault = 1, $file =
'auto', $keeplastnfiles = 0, $execmethod = 0, $lowmemorydump = 0)
250 global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass;
251 global $dolibarr_main_db_character_set;
252 global $dolibarr_main_restrict_os_commands;
254 $langs->load(
"admin");
256 dol_syslog(
"Utils::dumpDatabase type=".$type.
" compression=".$compression.
" file=".$file, LOG_DEBUG);
257 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
263 if (!in_array($compression, array(
'none',
'gz',
'bz',
'zip',
'zstd'))) {
264 $langs->load(
"errors");
265 $this->error = $langs->transnoentitiesnoconv(
"ErrorBadValueForParameter", $compression,
"Compression");
270 if ($type ==
'auto') {
271 $type = $this->db->type;
273 if (!in_array($type, array(
'postgresql',
'pgsql',
'mysql',
'mysqli',
'mysqlnobin'))) {
274 $langs->load(
"errors");
275 $this->error = $langs->transnoentitiesnoconv(
"ErrorBadValueForParameter", $type,
"Basetype");
280 if ($file ==
'auto') {
283 if (in_array($type, array(
'mysql',
'mysqli'))) {
284 $prefix =
'mysqldump';
287 if (in_array($type, array(
'pgsql'))) {
293 $outputdir =
$conf->admin->dir_output.
'/backup';
298 if ($type ==
'mysql' || $type ==
'mysqli') {
300 $cmddump =
$db->getPathOfDump();
304 if (empty($cmddump)) {
305 $this->error =
"Failed to detect command to use for mysqldump. Try a manual backup before to set path of command.";
309 $outputfile = $outputdir.
'/'.$file;
311 $compression = $compression ? $compression :
'none';
312 if ($compression ==
'gz') {
313 $outputfile .=
'.gz';
314 } elseif ($compression ==
'bz') {
315 $outputfile .=
'.bz2';
316 } elseif ($compression ==
'zstd') {
317 $outputfile .=
'.zst';
319 $outputerror = $outputfile.
'.err';
324 $basenamecmddump = basename(str_replace(
'\\',
'/', $cmddump));
327 if (!empty($dolibarr_main_restrict_os_commands)) {
328 $arrayofallowedcommand = explode(
',', $dolibarr_main_restrict_os_commands);
329 $arrayofallowedcommand = array_map(
'trim', $arrayofallowedcommand);
330 dol_syslog(
"Command are restricted to ".$dolibarr_main_restrict_os_commands.
". We check that one of this command is inside ".$cmddump);
331 if (!in_array($basenamecmddump, $arrayofallowedcommand)) {
332 $langs->load(
"errors");
333 $this->error = $langs->trans(
'CommandIsNotInsideAllowedCommands');
334 $this->error .=
'<br>'.$langs->trans(
'ErrorCheckTheCommandInsideTheAdvancedOptions');
341 $command = preg_replace(
'/(\$|%)/',
'', $command);
342 if (preg_match(
"/\s/", $command)) {
343 $command = escapeshellarg($command);
347 $param = $dolibarr_main_db_name.
" -h ".$dolibarr_main_db_host;
348 $param .=
" -u ".$dolibarr_main_db_user;
349 if (!empty($dolibarr_main_db_port)) {
350 $param .=
" -P ".$dolibarr_main_db_port.
" --protocol=tcp";
352 if (
GETPOST(
"use_transaction",
"alpha")) {
353 $param .=
" --single-transaction";
355 if (
GETPOST(
"disable_fk",
"alpha") || $usedefault) {
358 if (
GETPOST(
"sql_compat",
"alpha") &&
GETPOST(
"sql_compat",
"alpha") !=
'NONE') {
359 $param .=
" --compatible=".escapeshellarg(
GETPOST(
"sql_compat",
"alpha"));
361 if (
GETPOST(
"drop_database",
"alpha")) {
362 $param .=
" --add-drop-database";
364 if (
GETPOST(
"use_mysql_quick_param",
"alpha")) {
365 $param .=
" --quick";
367 if (
GETPOST(
"use_force",
"alpha")) {
370 if (
GETPOST(
"sql_structure",
"alpha") || $usedefault) {
371 if (
GETPOST(
"drop",
"alpha") || $usedefault) {
372 $param .=
" --add-drop-table=TRUE";
374 $param .=
" --add-drop-table=FALSE";
379 if (
GETPOST(
"disable-add-locks",
"alpha")) {
380 $param .=
" --add-locks=FALSE";
382 if (
GETPOST(
"sql_data",
"alpha") || $usedefault) {
383 $param .=
" --tables";
384 if (
GETPOST(
"showcolumns",
"alpha") || $usedefault) {
387 if (
GETPOST(
"extended_ins",
"alpha") || $usedefault) {
390 $param .=
" --skip-extended-insert";
392 if (
GETPOST(
"delayed",
"alpha")) {
393 $param .=
" --delayed-insert";
395 if (
GETPOST(
"sql_ignore",
"alpha")) {
396 $param .=
" --insert-ignore";
398 if (
GETPOST(
"hexforbinary",
"alpha") || $usedefault) {
399 $param .=
" --hex-blob";
404 if ($dolibarr_main_db_character_set ==
'utf8mb4') {
406 $param .=
" --default-character-set=utf8mb4 --no-tablespaces";
408 $param .=
" --default-character-set=utf8 --no-tablespaces";
410 $paramcrypted = $param;
411 $paramclear = $param;
412 if (!empty($dolibarr_main_db_pass)) {
413 $paramcrypted .=
' -p"'.preg_replace(
'/./i',
'*', $dolibarr_main_db_pass).
'"';
414 $paramclear .=
' -p"'.str_replace(array(
'"',
'`',
'$'), array(
'\"',
'\`',
'\$'), $dolibarr_main_db_pass).
'"';
420 $fullcommandcrypted = $command.
" ".$paramcrypted.
" 2>&1";
421 $fullcommandclear = $command.
" ".$paramclear.
" 2>&1";
422 if (!$lowmemorydump) {
423 if ($compression ==
'none') {
424 $handle = fopen($outputfile,
'w');
425 } elseif ($compression ==
'gz') {
426 $handle = gzopen($outputfile,
'w');
427 } elseif ($compression ==
'bz') {
428 $handle = bzopen($outputfile,
'w');
429 } elseif ($compression ==
'zstd') {
430 $handle = fopen($outputfile,
'w');
435 if ($compression ==
'none') {
436 $fullcommandclear .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." > "'.dol_sanitizePathName($outputfile).
'"';
437 $fullcommandcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." > "'.dol_sanitizePathName($outputfile).
'"';
439 } elseif ($compression ==
'gz') {
440 $fullcommandclear .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | gzip > "'.dol_sanitizePathName($outputfile).
'"';
441 $fullcommandcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | gzip > "'.dol_sanitizePathName($outputfile).
'"';
442 $paramcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | gzip';
444 } elseif ($compression ==
'bz') {
445 $fullcommandclear .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | bzip2 > "'.dol_sanitizePathName($outputfile).
'"';
446 $fullcommandcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | bzip2 > "'.dol_sanitizePathName($outputfile).
'"';
447 $paramcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | bzip2';
449 } elseif ($compression ==
'zstd') {
450 $fullcommandclear .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | zstd > "'.dol_sanitizePathName($outputfile).
'"';
451 $fullcommandcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | zstd > "'.dol_sanitizePathName($outputfile).
'"';
452 $paramcrypted .=
' | grep -v "Warning: Using a password on the command line interface can be insecure." | zstd';
462 if (empty($execmethod)) {
466 dol_syslog(
"Utils::dumpDatabase execmethod=".$execmethod.
", lowmemorydump=".$lowmemorydump.
", command=".$fullcommandcrypted, LOG_INFO);
471 if (!empty($MemoryLimit)) {
472 @ini_set(
'memory_limit', $MemoryLimit);
476 if ($execmethod == 1) {
477 $output_arr = array();
480 exec($fullcommandclear, $output_arr, $retval);
488 $langs->load(
"errors");
489 dol_syslog(
"Datadump retval after exec=".$retval, LOG_ERR);
490 $errormsg =
'Error '.$retval;
494 if (!empty($output_arr)) {
495 foreach ($output_arr as $key => $read) {
497 if ($i == 1 && preg_match(
'/Warning.*Using a password/i', $read)) {
502 if (!$lowmemorydump) {
505 fwrite($handle, $read.($execmethod == 2 ?
'' :
"\n"));
506 if (preg_match(
'/'.preg_quote(
'-- Dump completed',
'/').
'/i', $read)) {
508 } elseif (preg_match(
'/'.preg_quote(
'SET SQL_NOTES=@OLD_SQL_NOTES',
'/').
'/i', $read)) {
515 } elseif ($lowmemorydump) {
521 if ($execmethod == 2) {
522 $handlein = popen($fullcommandclear,
'r');
525 while (!feof($handlein)) {
527 $read = fgets($handlein);
529 if ($i == 1 && preg_match(
'/Warning.*Using a password/i', $read)) {
532 fwrite($handle, $read);
533 if (preg_match(
'/'.preg_quote(
'-- Dump completed',
'/').
'/i', $read)) {
535 } elseif (preg_match(
'/'.preg_quote(
'SET SQL_NOTES=@OLD_SQL_NOTES',
'/').
'/i', $read)) {
543 if (!$lowmemorydump) {
544 if ($compression ==
'none') {
546 } elseif ($compression ==
'gz') {
548 } elseif ($compression ==
'bz') {
550 } elseif ($compression ==
'zstd') {
557 $langs->load(
"errors");
558 dol_syslog(
"Failed to open file ".$outputfile, LOG_ERR);
559 $errormsg = $langs->trans(
"ErrorFailedToWriteInDir");
563 if ($compression ==
'none') {
564 $handle = fopen($outputfile,
'r');
565 } elseif ($compression ==
'gz') {
566 $handle = gzopen($outputfile,
'r');
567 } elseif ($compression ==
'bz') {
568 $handle = bzopen($outputfile,
'r');
569 } elseif ($compression ==
'zstd') {
570 $handle = fopen($outputfile,
'r');
574 $errormsg = fgets($handle, 2048);
578 if ($compression ==
'none') {
580 } elseif ($compression ==
'gz') {
582 } elseif ($compression ==
'bz') {
584 } elseif ($compression ==
'zstd') {
587 if ($ok && preg_match(
'/^-- (MySql|MariaDB)/i', $errormsg) || preg_match(
'/^\/\*M?!999999/', $errormsg)) {
593 @
dol_move($outputfile, $outputerror,
'0', 1, 0, 0);
596 $langs->load(
"errors");
597 $errormsg = $langs->trans(
"ErrorFailedToRunExternalCommand");
603 $this->output = $errormsg;
604 $this->error = $errormsg;
605 $this->result = array(
"commandbackuplastdone" => $command.
" ".$paramcrypted,
"commandbackuptorun" =>
"");
610 if ($type ==
'mysqlnobin') {
611 $outputfile = $outputdir.
'/'.$file;
612 $outputfiletemp = $outputfile.
'-TMP.sql';
614 $compression = $compression ? $compression :
'none';
615 if ($compression ==
'gz') {
616 $outputfile .=
'.gz';
618 if ($compression ==
'bz') {
619 $outputfile .=
'.bz2';
621 $outputerror = $outputfile.
'.err';
624 if ($compression ==
'gz' or $compression ==
'bz') {
625 $this->backupTables($outputfiletemp);
626 dol_compress_file($outputfiletemp, $outputfile, $compression);
627 unlink($outputfiletemp);
629 $this->backupTables($outputfile);
633 $this->result = array(
"commandbackuplastdone" =>
"",
"commandbackuptorun" =>
"");
637 if ($type ==
'postgresql' || $type ==
'pgsql') {
640 $outputfile = $outputdir.
'/'.$file;
642 $compression = $compression ? $compression :
'none';
643 if ($compression ==
'gz') {
644 $outputfile .=
'.gz';
646 if ($compression ==
'bz') {
647 $outputfile .=
'.bz2';
649 $outputerror = $outputfile.
'.err';
655 $basenamecmddump = basename(str_replace(
'\\',
'/', $cmddump));
657 if (!empty($dolibarr_main_restrict_os_commands)) {
658 $arrayofallowedcommand = explode(
',', $dolibarr_main_restrict_os_commands);
659 $arrayofallowedcommand = array_map(
'trim', $arrayofallowedcommand);
660 dol_syslog(
"Command are restricted to ".$dolibarr_main_restrict_os_commands.
". We check that one of this command is inside ".$cmddump);
661 if (!in_array($basenamecmddump, $arrayofallowedcommand)) {
662 $langs->load(
"errors");
663 $this->error = $langs->trans(
'CommandIsNotInsideAllowedCommands');
664 $this->error .=
'<br>'.$langs->trans(
'ErrorCheckTheCommandInsideTheAdvancedOptions');
671 $command = preg_replace(
'/(\$|%)/',
'', $command);
672 if (preg_match(
"/\s/", $command)) {
673 $command = escapeshellarg($command);
679 $param .=
" --no-tablespaces --inserts -h ".$dolibarr_main_db_host;
680 $param .=
" -U ".$dolibarr_main_db_user;
681 if (!empty($dolibarr_main_db_port)) {
682 $param .=
" -p ".$dolibarr_main_db_port;
685 $param .=
" --disable-dollar-quoting";
687 if (
GETPOST(
"drop_database")) {
690 if (
GETPOST(
"sql_structure")) {
692 $param .=
" --add-drop-table";
699 if (!
GETPOST(
"sql_structure")) {
706 $param .=
' -f "'.$outputfile.
'"';
708 if ($compression ==
'gz') {
712 $paramcrypted = $param;
713 $paramclear = $param;
719 $paramcrypted .=
" -w ".$dolibarr_main_db_name;
720 $paramclear .=
" -w ".$dolibarr_main_db_name;
723 $this->result = array(
"commandbackuplastdone" =>
"",
"commandbackuptorun" => $command.
" ".$paramcrypted);
727 if (!$errormsg && $keeplastnfiles > 0) {
728 $tmpfiles =
dol_dir_list(
$conf->admin->dir_output.
'/backup',
'files', 0,
'',
'(\.err|\.old|\.sav)$',
'date', SORT_DESC);
730 if (is_array($tmpfiles)) {
731 foreach ($tmpfiles as $key => $val) {
733 if ($i <= $keeplastnfiles) {
741 return ($errormsg ? -1 : 0);
843 $modulelowercase = strtolower($module);
847 $dir = $dirins.
'/'.$modulelowercase;
852 dol_include_once($modulelowercase.
'/core/modules/mod'.$module.
'.class.php');
853 $class =
'mod'.$module;
856 if (class_exists($class)) {
865 $langs->load(
"errors");
866 dol_print_error(
null, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
871 if (count($arrayversion)) {
872 $FILENAMEASCII = strtolower($module).
'.asciidoc';
873 $FILENAMEDOC = strtolower($module).
'.html';
874 $FILENAMEDOCPDF = strtolower($module).
'.pdf';
877 $dirofmoduledoc =
dol_buildpath(strtolower($module), 0).
'/doc';
878 $dirofmoduletmp =
dol_buildpath(strtolower($module), 0).
'/doc/temp';
879 $outputfiledoc = $dirofmoduledoc.
'/'.$FILENAMEDOC;
880 if ($dirofmoduledoc) {
887 if (!is_writable($dirofmoduletmp)) {
888 $this->error =
'Dir '.$dirofmoduletmp.
' does not exists or is not writable';
893 $this->error =
'Setup of module ModuleBuilder not complete';
898 dol_copy($dirofmodule.
'/README.md', $dirofmoduletmp.
'/README.md',
'0', 1);
899 dol_copy($dirofmodule.
'/ChangeLog.md', $dirofmoduletmp.
'/ChangeLog.md',
'0', 1);
902 $arrayreplacement = array();
903 $arrayreplacement[
'/^#\s.*/m'] =
'';
904 $arrayreplacement[
'/^#/m'] =
'##';
906 dolReplaceInFile($dirofmoduletmp.
'/README.md', $arrayreplacement,
'',
'0', 0, 1);
907 dolReplaceInFile($dirofmoduletmp.
'/ChangeLog.md', $arrayreplacement,
'',
'0', 0, 1);
910 $destfile = $dirofmoduletmp.
'/'.$FILENAMEASCII;
912 $fhandle = fopen($destfile,
'w+');
914 $specs =
dol_dir_list(
dol_buildpath(strtolower($module).
'/doc', 0),
'files', 1,
'(\.md|\.asciidoc)$', array(
'\/temp\/'));
917 foreach ($specs as $spec) {
918 if (preg_match(
'/notindoc/', $spec[
'relativename'])) {
921 if (preg_match(
'/example/', $spec[
'relativename'])) {
924 if (preg_match(
'/disabled/', $spec[
'relativename'])) {
928 $pathtofile = strtolower($module).
'/doc/'.$spec[
'relativename'];
929 $format =
'asciidoc';
930 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
931 $format =
'markdown';
934 $filecursor = @file_get_contents($spec[
'fullname']);
936 fwrite($fhandle, ($i ?
"\n<<<\n\n" :
"").$filecursor.
"\n");
938 $this->error =
'Failed to concat content of file '.$spec[
'fullname'];
947 $contentreadme = file_get_contents($dirofmoduletmp.
'/README.md');
948 $contentchangelog = file_get_contents($dirofmoduletmp.
'/ChangeLog.md');
950 include DOL_DOCUMENT_ROOT.
'/core/lib/parsemd.lib.php';
953 $arrayreplacement = array(
954 'mymodule' => strtolower($module),
955 'MyModule' => $module,
956 'MYMODULE' => strtoupper($module),
957 'My module' => $module,
958 'my module' => $module,
959 'Mon module' => $module,
960 'mon module' => $module,
961 'htdocs/modulebuilder/template' => strtolower($module),
962 '__MYCOMPANY_NAME__' =>
$mysoc->name,
963 '__KEYWORDS__' => $module,
964 '__USER_FULLNAME__' => $user->getFullName($langs),
965 '__USER_EMAIL__' => $user->email,
967 '---Put here your own copyright and developer email---' =>
dol_print_date($now,
'dayrfc').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
''),
968 '__DATA_SPECIFICATION__' =>
'Not yet available',
978 $currentdir = getcwd();
981 require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
982 $utils =
new Utils($this->db);
985 $command =
getDolGlobalString(
'MODULEBUILDER_ASCIIDOCTOR') .
' '.$destfile.
' -n -o '.$dirofmoduledoc.
'/'.$FILENAMEDOC;
986 $outfile = $dirofmoduletmp.
'/out.tmp';
988 $resarray = $utils->executeCLI($command, $outfile);
989 if ($resarray[
'result'] !=
'0') {
990 $this->error = $resarray[
'error'].
' '.$resarray[
'output'];
991 $this->errors[] = $this->error;
993 $result = ($resarray[
'result'] == 0) ? 1 : 0;
994 if ($result < 0 && empty($this->errors)) {
995 $this->error = $langs->trans(
"ErrorFailToGenerateFile", $FILENAMEDOC);
996 $this->errors[] = $this->error;
1000 $command =
getDolGlobalString(
'MODULEBUILDER_ASCIIDOCTORPDF') .
' '.$destfile.
' -n -o '.$dirofmoduledoc.
'/'.$FILENAMEDOCPDF;
1001 $outfile = $dirofmoduletmp.
'/outpdf.tmp';
1002 $resarray = $utils->executeCLI($command, $outfile);
1003 if ($resarray[
'result'] !=
'0') {
1004 $this->error = $resarray[
'error'].
' '.$resarray[
'output'];
1005 $this->errors[] = $this->error;
1007 $result = ($resarray[
'result'] == 0) ? 1 : 0;
1008 if ($result < 0 && empty($this->errors)) {
1009 $this->error = $langs->trans(
"ErrorFailToGenerateFile", $FILENAMEDOCPDF);
1010 $this->errors[] = $this->error;
1025 $langs->load(
"errors");
1026 $this->error = $langs->trans(
"ErrorCheckVersionIsDefined");