20 include_once (
"FDL/Lib.Attr.php");
21 include_once (
"FDL/Class.DocFam.php");
28 print
"Database not found : param FREEDOM_DB";
38 if (
$doc->locked == - 1) {
42 $doc->setValue(
"exec_status",
"progressing");
43 $doc->setValue(
"exec_statusdate",
$doc->getTimeDate());
44 $doc->modify(
true, array(
52 $cmd.=
">$fout 2>$ferr";
54 system(
$cmd, $statut);
56 $ms = gmstrftime(
"%H:%M:%S", $m2);
58 if (file_exists($fout)) {
59 $doc->setValue(
"exec_detail", file_get_contents($fout));
62 if (file_exists($ferr)) {
63 $doc->setValue(
"exec_detaillog", file_get_contents($ferr));
67 $doc->deleteValue(
"exec_nextdate");
68 $doc->setValue(
"exec_elapsed", $ms);
69 $doc->setValue(
"exec_date", date(
"d/m/Y H:i "));
70 $doc->deleteValue(
"exec_status");
71 $doc->deleteValue(
"exec_statusdate");
72 $doc->setValue(
"exec_state", (($statut == 0) ?
"OK" : $statut));
73 $puserid =
$doc->getValue(
"exec_iduser");
74 $doc->setValue(
"exec_iduser",
$doc->getExecUserID());
79 $err =
$doc->AddRevision(sprintf(_(
"execution by %s done %s") ,
$doc->getTitle(
$doc->getExecUserID()) , $statut));
81 $doc->deleteValue(
"exec_elapsed");
82 $doc->deleteValue(
"exec_detail");
83 $doc->deleteValue(
"exec_detaillog");
84 $doc->deleteValue(
"exec_date");
85 $doc->deleteValue(
"exec_state");
86 $doc->setValue(
"exec_iduser", $puserid);