17 include_once (
"FDL/Class.Doc.php");
18 include_once (
"FDL/Class.TaskRequest.php");
35 if (!
$tid)
$err = _(
"no task identifier found");
37 $ot = new \Dcp\TransformationEngine\Client($action->
getParam(
"TE_HOST") , $action->
getParam(
"TE_PORT"));
42 if ($tr->isAffected()) {
46 $sem = fopen(sprintf(
"%s/fdl%s.lck",
getTmpDir() , strtr(
$docid,
'./',
'__')) ,
"a+");
48 if (flock($sem, LOCK_EX)) {
51 if (!
$doc->isAffected()) $err = sprintf(_(
"cannot see unknow reference %s") ,
$docid);
57 $err = sprintf(_(
"Error creating temporary file in '%s'.") ,
getTmpDir());
62 $at = $attrid .
'_txt';
67 if (
$doc->AffectColumn(array(
73 $av = $attrid .
'_vec';
74 $doc->fields[$av] = $av;
78 $doc->fields[$at] = $at;
79 $doc->fields[
'fulltext'] =
'fulltext';
80 $err =
$doc->modify(
true, array(
85 $doc->addHistoryEntry(sprintf(_(
"text conversion done for file %s") ,
$doc->vault_filename($attrid,
false, $index)) ,
HISTO_NOTICE);
86 if (($err ==
"") && (
$doc->locked == - 1)) {
88 $idl =
$doc->getLatestId();
90 if (
$doc->getRawValue($attrid) == $ldoc->getRawValue($attrid)) {
91 $ldoc->$at =
$doc->$at;
94 $ldoc->fields[$at] = $at;
95 $ldoc->fields[$av] = $av;
96 $ldoc->fields[
'fulltext'] =
'fulltext';
97 $err = $ldoc->modify(
true, array(
105 $err = sprintf(_(
"output file [%s] not found") ,
$filename);
111 $err = sprintf(_(
"task %s is not done correctly") ,
$tid);
113 if ($err !=
"")
$doc->addHistoryEntry(sprintf(_(
"conversion failed for %s: ") . $err,
$doc->vault_filename($attrid,
false, $index)) ,
HISTO_NOTICE);
115 $err = sprintf(_(
"document [%s] not found") ,
$docid);
118 flock($sem, LOCK_UN);
120 $err = sprintf(_(
"semaphore block") ,
$docid);
124 $err = sprintf(_(
"task %s is not recorded") ,
$tid);
128 if (
$err !=
'') $action->lay->template = htmlspecialchars(
$err, ENT_QUOTES);
129 else $action->lay->template = htmlspecialchars(
"OK : " . sprintf(_(
"doc %d indexed") ,
$docid) , ENT_QUOTES);
130 $action->lay->noparse =
true;
sep_replace($ak, $idx, $by="-", $sep="\n")
settxtfile(Action &$action)
new_Doc($dbaccess, $id= '', $latest=false)
static getArgument($k, $def= '')
if($file) if($subject==""&&$file) if($subject=="") $err