RunningTransfer.tornado.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* $Id: RunningTransfer.tornado.php 2260 2007-01-11 00:46:01Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. /**
  16. * class RunningTransferTornado for tornado-client
  17. */
  18. class RunningTransferTornado extends RunningTransfer
  19. {
  20. /**
  21. * ctor
  22. *
  23. * @param $psLine
  24. * @return RunningTransferTornado
  25. */
  26. function RunningTransferTornado($psLine) {
  27. global $cfg;
  28. // tornadoBin
  29. $tornadoBin = $cfg["docroot"]."bin/clients/tornado/tftornado.py";
  30. // ps-parse
  31. if (strlen($psLine) > 0) {
  32. while (strpos($psLine," ") > 0)
  33. $psLine = str_replace(" ",' ',trim($psLine));
  34. $arr = explode(' ',$psLine);
  35. $this->processId = $arr[0];
  36. foreach($arr as $key =>$value) {
  37. if ($key == 0)
  38. $startArgs = false;
  39. if ($value == $tornadoBin) {
  40. $offset = 1;
  41. if(!@strpos($arr[$key+$offset],"/",1) > 0)
  42. $offset += 1;
  43. if(!@strpos($arr[$key+$offset],"/",1) > 0)
  44. $offset += 1;
  45. $this->filePath = substr($arr[$key+$offset],0,strrpos($arr[$key+$offset],"/")+1);
  46. $this->transferowner = $arr[$key+$offset];
  47. $this->transferFile = str_replace($cfg['transfer_file_path'],'',$arr[$key+$offset+1]);
  48. }
  49. if ($value == '--display_interval')
  50. $startArgs = true;
  51. if ($startArgs) {
  52. if (!empty($value)) {
  53. if (strpos($value, "-", 1) > 0) {
  54. if (array_key_exists($key + 1, $arr)) {
  55. $this->args .= (strpos($value,"priority") > 0)
  56. ? "\n file ".$value." set"
  57. : $value.":".$arr[$key+1].",";
  58. } else {
  59. $this->args .= "";
  60. }
  61. }
  62. }
  63. }
  64. if ($value == '--responsefile')
  65. $this->transferFile = str_replace($cfg['transfer_file_path'],'',$arr[$key+1]);
  66. }
  67. $this->args = str_replace("--","",$this->args);
  68. $this->args = substr($this->args,0,strlen($this->args));
  69. }
  70. }
  71. }
  72. ?>