Ant.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <?php
  2. Lib::loadClass('RouteBase');
  3. Lib::loadClass('UI');
  4. Lib::loadClass('DBG');
  5. /**
  6. * Executes ant build for dita file - creates pdf file
  7. * - ant build in SE/schema/ant-url_action/{object_namespace_to_file_path}/{function_name}/build.xml
  8. *
  9. * APP_PATH_SCHEMA . '/ant-url_action/' . {$namespace_sep_by_dot} . '/' . {$function_name} . '/build.xml'
  10. * APP_PATH_SCHEMA . '/ant-tool/' . {$ant_tool_name} . '/build.xml'
  11. *
  12. * usage:
  13. * index.php?_route=Ant
  14. * index.php?_route=Ant&_task=ant&path={$ant_tool_name}
  15. * index.php?_route=UrlAction_Ant
  16. * index.php?_route=UrlAction_Ant&_task=ant&path={$namespace_sep_by_dot}{$function_name}&featureID={featureID}&namespace={$namespace}
  17. *
  18. * @doc ant <exec> https://ant.apache.org/manual/Tasks/exec.html
  19. */
  20. class Route_Ant extends RouteBase {
  21. public $pathTools;
  22. public $pathUrlActions;
  23. public $antBin;
  24. public $_antUrlProjects;
  25. public $_antUrlProjectTemplates;
  26. public function __construct() {
  27. $this->pathTools = APP_PATH_SCHEMA . "/ant-tool/";
  28. $this->pathUrlActions = APP_PATH_SCHEMA . "/ant-url_action";
  29. $this->antBin = APP_PATH_WWW . DS . 'stuff' . DS . 'dita-ot-2.3.3' . DS . 'bin' . DS . 'ant';
  30. $this->_antUrlProjects = [];// path => label
  31. $this->_antUrlProjectTemplates = [];// path => [ template => label ]
  32. }
  33. public function defaultAction() {
  34. UI::gora();
  35. UI::tag('h1', [], 'Ant');
  36. try {
  37. $taskList = $this->getAntToolList();
  38. DBG::nicePrint($taskList, 'ant-tool');
  39. $featureID = V::get('featureID', '', $_GET);
  40. $namespace = V::get('namespace', '', $_GET);
  41. UI::startTag('ul');
  42. foreach ($taskList as $path => $label) {
  43. $link = "index.php?_route=Ant&_task=ant&path={$path}";
  44. echo UI::h('li', [], [
  45. UI::h('a', ['href'=>$link], "Uruchom '{$label}'")
  46. ]);
  47. }
  48. UI::endTag('ul');
  49. } catch (Exception $e) {
  50. UI::alert('danger', $e->getMessage());
  51. DBG::log($e);
  52. }
  53. UI::dol();
  54. }
  55. public function antAction() {
  56. UI::gora();
  57. try {
  58. $path = V::get('path', '', $_GET);
  59. if (!$path) throw new Exception("Missing Ant path!");
  60. $taskList = $this->getAntToolList();
  61. if (!array_key_exists($path, $taskList)) throw new Exception("Ant path not exists! '{$path}'");
  62. $cmd = "cd {$this->pathTools}{$path} && {$this->antBin} -Xms5g -Xmx11g 2>&1";// wymaga java jdk
  63. V::exec($cmd, $out, $ret);
  64. } catch (Exception $e) {
  65. UI::alert('danger', $e->getMessage());
  66. DBG::log($e);
  67. }
  68. UI::dol();
  69. }
  70. public function execAntTool($antTask) {
  71. $antList = $this->getAntToolList();
  72. if (!array_key_exists($antTask, $antList)) throw new Exception("ant task not found", 404);
  73. throw new Exception("TODO: run ant task '{$antTask}'", 501);
  74. }
  75. //todo headery xml itp - aby szly z anta do tej funkcji i wysylane byly przez php
  76. // /SE/ant.php?antTask=$ jakas nazwa z ant_tool
  77. //ant ogolne
  78. public function getAntUrlActionList() {
  79. if (!empty($this->_antUrlProjects)) return $this->_antUrlProjects;
  80. DBG::log("DBG::getAntUrlActionList START");
  81. V::exec("ls -1 {$this->pathUrlActions}/*/*/build.xml", $out, $ret);
  82. DBG::log($out, 'array', "DBG::getAntUrlActionList ls -1 */*/build.xml ret({$ret})");
  83. if (0) { // tmp use glob to store filemtime($file)
  84. $antFileList = glob("{$this->pathUrlActions}/*/*/build.xml", GLOB_NOSORT);
  85. DBG::log($antFileList, 'array', "DBG::getAntUrlActionList glob */*/build.xml");
  86. // tmp use glob to store filemtime($file)
  87. $antFileList = V::glob("{$this->pathUrlActions}/*/*/build.xml", GLOB_NOSORT);
  88. $pathUrlActions = $this->pathUrlActions;
  89. DBG::log($pathUrlActions, 'array', "DBG::getAntUrlActionList pathUrlActions");
  90. $antMtimeFileList = array_map(function ($filePath) use ($pathUrlActions) {
  91. // $pathUrlActions = '/Users/plabudda/rsync.se.master/SE/schema/ant-url_action'
  92. // 0 => '/Users/plabudda/rsync.se.master/SE/schema/ant-url_action/default_db.in7_dziennik_koresp/etykieta/build.xml',
  93. // 0 => 'default_db.in7_dziennik_koresp/etykieta/build.xml',
  94. list($ns, $projectFolder, $buildXml) = explode('/', str_replace($pathUrlActions . '/', '', $filePath));
  95. return [
  96. 'ns' => $ns,
  97. 'project' => $projectFolder,
  98. 'mtime' => filemtime($filePath),
  99. ];
  100. }, $antFileList);
  101. DBG::log($antMtimeFileList, 'array', "DBG::getAntUrlActionList glob + mtime");
  102. $forceUpdate = ('1' === V::get('forceUpdate', '', $_POST));
  103. $antInfoList = array_map(function ($fileInfo) use ($forceUpdate) {
  104. return $this->fetchProjectInfo($fileInfo, $forceUpdate);
  105. }, $antMtimeFileList);
  106. DBG::log($antInfoList, 'array', "DBG::getAntUrlActionList antInfoList");
  107. $this->_antUrlProjects = array();
  108. foreach ($antInfoList as $antInfo) {
  109. $path = "{$antInfo['ns']}/{$antInfo['project']}";
  110. $this->_antUrlProjects[$path] = $antInfo['label'];
  111. foreach ($antInfo['main_targets'] as $targetInfo) {
  112. $this->_antUrlProjectTemplates[$path][$targetInfo['target']] = $targetInfo['label'];
  113. }
  114. }
  115. return $this->_antUrlProjects;
  116. }
  117. $this->_antUrlProjects = array();
  118. foreach ($out as $line) {
  119. try {
  120. if ($this->pathUrlActions != substr($line, 0, strlen($this->pathUrlActions))) throw new Exception("Wrong line prefix '{$line}' - skip");
  121. if ('/build.xml' != substr($line, -1 * strlen('/build.xml'))) throw new Exception("Wrong line suffix '{$line}' - expected '/build.xml' - skip");
  122. } catch (Exception $e) {
  123. UI::alert('warning', $e->getMessage());
  124. continue;
  125. }
  126. $line = substr($line, strlen($this->pathUrlActions) + 1);
  127. $path = substr($line, 0, -1 * strlen('/build.xml'));
  128. $this->_antUrlProjects[$path] = $path;
  129. try {
  130. V::exec("cd {$this->pathUrlActions}/{$path} && ant -p|grep -v '^Unable to locate'|grep -v '^Buildfile:'", $out, $ret);
  131. // ant -p 2>/dev/null |grep -v '^Unable to locate'|grep -v '^Buildfile:' | grep 'URL_TASK\|^Default target:'
  132. // Test WFS for actions given featureID // TODO: first line - project description
  133. // Main targets:
  134. //
  135. // DescribeFeatureType URL_TASK Target DescribeFeatureType
  136. // GetFeature URL_TASK Target GetFeature
  137. // Default target: http_first_input
  138. if (!empty($out)) {
  139. $projectDesc = '';
  140. $templates = [];
  141. $state = 'projectDesc';// 'projectDesc', 'Main targets', 'Default target'
  142. foreach ($out as $line) {
  143. switch ($state) {
  144. case 'projectDesc': {
  145. if ('Main targets' == substr($line, 0, strlen('Main targets'))) {
  146. $state = 'Main targets';
  147. } else {
  148. $line = trim($line);
  149. if (!$projectDesc && $line) $projectDesc = $line;
  150. }
  151. } break;
  152. case 'Main targets': {
  153. if (false !== ($pos = strpos($line, 'URL_TASK'))) {
  154. $templateName = trim(substr($line, 0, $pos));
  155. $label = trim(substr($line, $pos + 9));
  156. if (!empty($templateName)) $templates[$templateName] = (!empty($label)) ? $label : $templateName;
  157. }
  158. if ('Default target' == substr($line, 0, strlen('Default target'))) {
  159. $state = 'Default target';
  160. }
  161. } break;
  162. }
  163. }
  164. if (!empty($projectDesc)) $this->_antUrlProjects[$path] = $projectDesc;
  165. if (!empty($templates)) foreach ($templates as $t => $l) $this->_antUrlProjectTemplates[$path][$t] = $l;
  166. }
  167. } catch (Exception $e) {
  168. DBG::log($e);
  169. }
  170. }
  171. DBG::log((array)$this, 'array', "DBG::getAntUrlActionList END Ant projects and main targets");
  172. return $this->_antUrlProjects;
  173. }
  174. function prepareCache($fileInfo) {
  175. // 'ns' => $ns,
  176. // 'project' => $projectFolder,
  177. // 'mtime' => filemtime($filePath),
  178. $sql = "
  179. CREATE TABLE IF NOT EXISTS `ANT_TOOL_#CACHE_PROJECT` (
  180. `ID` int(11) NOT NULL AUTO_INCREMENT,
  181. `file_ns` varchar(255) NOT NULL,
  182. `file_project` varchar(255) NOT NULL,
  183. `file_mtime` int(11) unsigned NOT NULL DEFAULT 0,
  184. `label` varchar(255) DEFAULT '',
  185. `error` varchar(255) DEFAULT '',
  186. `is_active` tinyint(1) NOT NULL DEFAULT 0,
  187. `A_RECORD_CREATE_DATE` datetime NOT NULL,
  188. `A_RECORD_UPDATE_DATE` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  189. PRIMARY KEY (`ID`),
  190. KEY (`is_active`),
  191. UNIQUE KEY `uniq` (`file_ns`,`file_project`)
  192. ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
  193. ";
  194. DB::getPDO()->execSql($sql);
  195. $sql = "
  196. CREATE TABLE IF NOT EXISTS `ANT_TOOL_#CACHE_MAIN_TARGETS` (
  197. `ID_ANT_PROJECT` int(11) NOT NULL,
  198. `NAME` varchar(255) DEFAULT '',
  199. `LABEL` varchar(255) DEFAULT '',
  200. `A_RECORD_CREATE_DATE` datetime NOT NULL,
  201. KEY `ID_ANT_PROJECT` (`ID_ANT_PROJECT`),
  202. UNIQUE KEY `uniq` (`ID_ANT_PROJECT`,`NAME`)
  203. ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
  204. ";
  205. DB::getPDO()->execSql($sql);
  206. }
  207. function fetchProjectInfo($fileInfo, $forceUpdate = false) {
  208. $cacheInfo = DB::getPDO()->tryHandleException([ $this, 'prepareCache' ], 'fetchFirst', $args = [
  209. "
  210. select c.ID
  211. , c.file_ns
  212. , c.file_project
  213. , c.file_mtime
  214. , c.label
  215. from `ANT_TOOL_#CACHE_PROJECT` c
  216. where c.file_ns = :ns
  217. and c.file_project = :project
  218. ",
  219. [
  220. ':ns' => $fileInfo['ns'],
  221. ':project' => $fileInfo['project'],
  222. ]
  223. ]);
  224. $parsedAntInfo = null;
  225. DBG::log($cacheInfo, 'array', "DBG:cacheInfo");
  226. if (!$cacheInfo) {
  227. $errorMsg = "";
  228. try {
  229. $parsedAntInfo = $this->parseAntOutput("{$this->pathUrlActions}/{$fileInfo['ns']}/{$fileInfo['project']}");
  230. DBG::log($parsedAntInfo, 'array', "DBG:parsedAntInfo when !\$cacheInfo");
  231. } catch (Exception $e) {
  232. $errorMsg = $e->getMessage();
  233. }
  234. $idCache = DB::getPDO()->insert('ANT_TOOL_#CACHE_PROJECT', [
  235. 'file_ns' => $fileInfo['ns'],
  236. 'file_project' => $fileInfo['project'],
  237. 'file_mtime' => $fileInfo['mtime'],
  238. 'label' => ($parsedAntInfo) ? $parsedAntInfo['label'] : '',
  239. 'error' => ($parsedAntInfo) ? '' : ( ($errorMsg) ? $errorMsg : 'Error' ),
  240. 'is_active' => ($errorMsg || !$parsedAntInfo) ? 0 : 1,
  241. 'A_RECORD_CREATE_DATE' => "NOW()",
  242. ]);
  243. DB::getPDO()->execSql(" delete from `ANT_TOOL_#CACHE_MAIN_TARGETS` where ID_ANT_PROJECT = :id ", [ ':id' => $idCache ]);
  244. if ($parsedAntInfo) foreach ($parsedAntInfo['main_targets'] as $targetInfo) {
  245. DB::getPDO()->insert('ANT_TOOL_#CACHE_MAIN_TARGETS', [
  246. 'ID_ANT_PROJECT' => $idCache,
  247. 'NAME' => $targetInfo['target'],
  248. 'LABEL' => $targetInfo['label'],
  249. 'A_RECORD_CREATE_DATE' => "NOW()",
  250. ]);
  251. }
  252. }
  253. else if ($cacheInfo['file_mtime'] < $fileInfo['mtime'] || $forceUpdate) {
  254. // select c.ID,
  255. // c.file_ns,
  256. // c.file_project,
  257. // c.file_mtime,
  258. $errorMsg = "Error";
  259. try {
  260. $parsedAntInfo = $this->parseAntOutput("{$this->pathUrlActions}/{$fileInfo['ns']}/{$fileInfo['project']}");
  261. } catch (Exception $e) {
  262. $errorMsg = $e->getMessage();
  263. }
  264. DBG::log($parsedAntInfo, 'array', "DBG:parsedAntInfo when file_mtime > cache || forceUpdate({$forceUpdate})");
  265. DB::getPDO()->update('ANT_TOOL_#CACHE_PROJECT', 'ID', $cacheInfo['ID'], [
  266. 'label' => ($parsedAntInfo) ? $parsedAntInfo['label'] : '',
  267. 'error' => ($errorMsg || !$parsedAntInfo) ? $errorMsg : '',
  268. 'A_RECORD_CREATE_DATE' => "NOW()",
  269. ]);
  270. DB::getPDO()->execSql(" delete from `ANT_TOOL_#CACHE_MAIN_TARGETS` where ID_ANT_PROJECT = :id ", [ ':id' => $cacheInfo['ID'] ]);
  271. if ($parsedAntInfo) foreach ($parsedAntInfo['main_targets'] as $targetInfo) {
  272. DB::getPDO()->insert('ANT_TOOL_#CACHE_MAIN_TARGETS', [
  273. 'ID_ANT_PROJECT' => $cacheInfo['ID'],
  274. 'NAME' => $targetInfo['target'],
  275. 'LABEL' => $targetInfo['label'],
  276. 'A_RECORD_CREATE_DATE' => "NOW()",
  277. ]);
  278. }
  279. } else {
  280. $parsedAntInfo = [
  281. 'label' => $cacheInfo['label'],
  282. 'main_targets' => DB::getPDO()->fetchAll("
  283. select t.NAME as target
  284. , t.LABEL as label
  285. from `ANT_TOOL_#CACHE_MAIN_TARGETS` t
  286. where t.ID_ANT_PROJECT = :id
  287. ", [
  288. ':id' => $cacheInfo['ID'],
  289. ]),
  290. ];
  291. }
  292. return array_merge($fileInfo, $parsedAntInfo);
  293. }
  294. function parseAntOutput($antFolderPath) { // return [ label, main_targets => [ target, label ] ], throws Exception
  295. try {
  296. V::exec("cd {$antFolderPath} && ant -p|grep -v '^Unable to locate'|grep -v '^Buildfile:'", $out, $ret);
  297. // ant -p 2>/dev/null |grep -v '^Unable to locate'|grep -v '^Buildfile:' | grep 'URL_TASK\|^Default target:'
  298. // Test WFS for actions given featureID // TODO: first line - project description
  299. // Main targets:
  300. //
  301. // DescribeFeatureType URL_TASK Target DescribeFeatureType
  302. // GetFeature URL_TASK Target GetFeature
  303. // Default target: http_first_input
  304. if (empty($out)) throw new Exception("Missing ant -p output");
  305. $projectDesc = '';
  306. $mainTargets = [];
  307. $state = 'projectDesc'; // 'projectDesc', 'Main targets', 'Default target'
  308. foreach ($out as $line) {
  309. switch ($state) {
  310. case 'projectDesc': {
  311. if ('Main targets' == substr($line, 0, strlen('Main targets'))) {
  312. $state = 'Main targets';
  313. } else {
  314. $line = trim($line);
  315. if (!$projectDesc && $line) $projectDesc = $line;
  316. }
  317. } break;
  318. case 'Main targets': {
  319. if (false !== ($pos = strpos($line, 'URL_TASK'))) {
  320. $templateName = trim(substr($line, 0, $pos));
  321. $label = trim(substr($line, $pos + 9));
  322. if (!empty($templateName)) $mainTargets[] = [
  323. 'target' => $templateName,
  324. 'label' => (!empty($label)) ? $label : $templateName,
  325. ];
  326. }
  327. if ('Default target' == substr($line, 0, strlen('Default target'))) {
  328. $state = 'Default target';
  329. }
  330. } break;
  331. }
  332. if ('Default target' === $state) break;
  333. }
  334. if (empty($projectDesc)) throw new Exception("Missing project label (first line in ant -p)");
  335. if (empty($mainTargets)) throw new Exception("Missing main targets with type URL_TASK");
  336. return [
  337. 'label' => $projectDesc,
  338. 'main_targets' => $mainTargets,
  339. ];
  340. } catch (Exception $e) {
  341. DBG::log($e);
  342. throw $e;
  343. }
  344. }
  345. public function getAntUrlActionTemplates($path) {
  346. if (!empty($this->_antUrlProjectTemplates[$path])) return $this->_antUrlProjectTemplates[$path];
  347. $this->getAntUrlActionList();
  348. if (!empty($this->_antUrlProjectTemplates[$path])) return $this->_antUrlProjectTemplates[$path];
  349. }
  350. public function getAntToolList() {
  351. V::exec("ls -1 {$this->pathTools}*/build.xml", $out, $ret);
  352. $taskList = array();
  353. foreach ($out as $line) {
  354. try {
  355. if ($this->pathTools != substr($line, 0, strlen($this->pathTools))) throw new Exception("Wrong line prefix '{$line}' - skip");
  356. if ('/build.xml' != substr($line, -1 * strlen('/build.xml'))) throw new Exception("Wrong line suffix '{$line}' - expected '/build.xml' - skip");
  357. } catch (Exception $e) {
  358. UI::alert('warning', $e->getMessage());
  359. continue;
  360. }
  361. $line = substr($line, strlen($this->pathTools));
  362. $name = substr($line, 0, -1 * strlen('/build.xml'));
  363. $taskList[$name] = $name;// TODO: $name => $description (read from build.xml file first xml tag <project...>)
  364. }
  365. return $taskList;
  366. }
  367. public function generatePdfAction() {// TODO: OLD TEST
  368. $antPath = V::get('ditaPath', '', $_GET);
  369. $idKoresp = V::get('idKoresp', 0, $_POST, 'int');
  370. $doExecute = V::get('doExecute', '', $_POST);
  371. $antList = $this->getAntToolList();
  372. if (!array_key_exists($antPath, $antList)) throw new Exception("dita path not found", 404);
  373. UI::gora();
  374. UI::startContainer();
  375. try {
  376. UI::tag('h1', [], "Dita: '{$antList[$antPath]}'");
  377. UI::startTag('form', ['action'=>"", 'method'=>"POST", 'class'=>'form-inline']);
  378. UI::tag('input', ['type'=>'number', 'value'=>$idKoresp, 'class'=>'form-control', 'style'=>'max-width:200px']);
  379. UI::tag('input', ['type'=>'hidden', 'name'=>'doExecute', 'value'=>'1']);
  380. UI::tag('input', ['type'=>"submit", 'value'=>"Wykonaj", 'class'=>'btn btn-primary']);
  381. UI::endTag('form');
  382. if ($doExecute) {
  383. // if ($idKoresp <= 0) throw new Exception("Bad Request - missing id koresp");
  384. if ($idKoresp <= 0) UI::alert('danger', "Missing id koresp - using default file");
  385. if ($idKoresp > 0) UI::alert('warning', "TODO: generate xml file for id koresp = {$idKoresp}");
  386. $execPath = APP_PATH_SCHEMA . DS . 'ant' . DS . $antPath;
  387. $ant = APP_PATH_WWW . DS . 'stuff' . DS . 'dita-ot-2.3.3' . DS . 'bin' . DS . 'ant';
  388. $cmd = "cd {$execPath} && {$ant} 2>&1";// wymaga java jdk
  389. V::exec($cmd, $out, $ret);
  390. DBG::_(true, true, "cmd: {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
  391. }
  392. throw new Exception("TODO: F." . __FUNCTION__ . " . L." . __LINE__);
  393. } catch (Exception $e) {
  394. UI::alert('danger', $e->getMessage());
  395. }
  396. UI::endContainer();
  397. UI::dol();
  398. }
  399. public function reinstallAction() {
  400. UI::gora();
  401. UI::tag('h1', [], 'Reinstall Dita Open Toolkit 2.3.3');
  402. $stuffPath = APP_PATH_WWW . DS . 'stuff';
  403. // $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default/SE/stuff && rm dita-ot-2.3.3.zip || echo PASSED";
  404. // $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default/SE/stuff && wget https://github.com/dita-ot/dita-ot/releases/download/2.3.3/dita-ot-2.3.3.zip -O dita-ot-2.3.3.zip ";
  405. // $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default/SE/stuff && rm dita-ot-2.3.3 || echo PASSED";
  406. // $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default/SE/stuff && unzip dita-ot-2.3.3.zip || echo PASSED";
  407. // $cmd[]['rsh']="cd /Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3 && ./startcmd.sh || echo PASSED";
  408. $wget = "/opt/local/bin/wget";
  409. $unzip = "/usr/bin/unzip";
  410. // $testCmd = "which unzip";
  411. // V::exec($testCmd, $out, $ret);
  412. // DBG::_(true, true, "testCmd: {$testCmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
  413. // $testCmd = "which wget";
  414. // V::exec($testCmd, $out, $ret);
  415. // DBG::_(true, true, "testCmd: {$testCmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
  416. $cmd = "cd {$stuffPath} ; [ -f dita-ot-2.3.3.zip ] && rm dita-ot-2.3.3.zip";
  417. V::exec($cmd, $out, $ret);
  418. DBG::_(true, true, "cmd: {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
  419. $cmd = "cd {$stuffPath} ; {$wget} https://github.com/dita-ot/dita-ot/releases/download/2.3.3/dita-ot-2.3.3.zip -O dita-ot-2.3.3.zip";
  420. V::exec($cmd, $out, $ret);
  421. DBG::_(true, true, "cmd: {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
  422. $cmd = "cd {$stuffPath}
  423. [ -f dita-ot-2.3.3.zip ] && rm dita-ot-2.3.3.zip
  424. {$wget} https://github.com/dita-ot/dita-ot/releases/download/2.3.3/dita-ot-2.3.3.zip -O dita-ot-2.3.3.zip
  425. [ -d dita-ot-2.3.3 ] && rm -rf dita-ot-2.3.3
  426. {$unzip} dita-ot-2.3.3.zip
  427. ";
  428. V::exec($cmd, $out, $ret);
  429. DBG::_(true, true, "cmd: {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
  430. }
  431. }