17 include_once (
"FDL/Class.Doc.php");
18 include_once (
"FDL/Class.TaskRequest.php");
19 include_once (
"Lib.FileMime.php");
31 $vidin = GetHttpVars(
"vidin");
32 $vidout = GetHttpVars(
"vidout");
33 $tid = GetHttpVars(
"tid");
34 $name = GetHttpVars(
"name");
35 $docid = GetHttpVars(
"docid");
38 if (!
$tid)
$err = _(
"no task identifier found");
42 $err = sprintf(_(
"Error creating temporary file in '%s'.") ,
getTmpDir());
55 $vf->Retrieve($vidin, $infoin);
56 $vf->Retrieve($vidout, $infoout);
58 $err =
$vf->Retrieve($vidout, $infoout);
60 if (
$ext ==
"")
$ext = $infoout->teng_lname;
66 $pp = strrpos($infoin->name,
'.');
67 $newname = substr($infoin->name, 0, $pp) .
'.' .
$ext;
70 $vf->Rename($vidout, $newname);
71 $vf->storage->teng_state = \Dcp\TransformationEngine\Client::status_done;
72 $vf->storage->modify();
75 $vf->Retrieve($vidin, $infoin);
76 $vf->Retrieve($vidout, $infoout);
78 $filename2 = tempnam(
getTmpDir() ,
'txt-');
79 if ($filename2 ===
false) {
80 $err = sprintf(_(
"Error creating temporary file in '%s'.") ,
getTmpDir());
82 $error = sprintf(_(
"Conversion as %s has failed ") , $infoout->teng_lname);
83 $error.=
"\n== " . _(
"See below information about conversion") .
"==\n" . print_r(
$info,
true);
84 file_put_contents($filename2, $error);
86 $vf->Retrieve($vidout, $infoout);
87 $err =
$vf->Save($filename2,
false, $vidout);
88 $basename = _(
"conversion error") .
".txt";
89 $vf->Rename($vidout, $basename);
90 $vf->storage->teng_state = \Dcp\TransformationEngine\Client::error_convert;
91 $vf->storage->modify();
94 if (
$doc->isAlive()) {
95 $doc->addHistoryEntry(sprintf(_(
"convert file %s as %s failed") , $infoin->name, $infoout->teng_lname) ,
HISTO_ERROR);
105 if (
$err !=
'')
$action->lay->template = htmlspecialchars(
$err, ENT_QUOTES);
106 else $action->lay->template = htmlspecialchars(
"OK : " . sprintf(_(
"vid %s stored") , $vidout) , ENT_QUOTES);
121 $ot = new \Dcp\TransformationEngine\Client($action->getParam(
"TE_HOST") , $action->getParam(
"TE_PORT"));
126 if ($tr->isAffected()) {
136 $err = sprintf(_(
"task %s is not recorded") ,
$tid);
newFreeVaultFile($dbaccess)
getTEFile($tid, $filename, &$info)
if($file) if($subject==""&&$file) if($subject=="") $err