Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../../defines.php');
  3. require_once('/srv/etc/sys_map.php');
  4. require_once('toolkit.php' );
  5. $DD = file( $GVAULT_PATH . '/versions.var');
  6. $Data = array();
  7. $Data['backups'] = array();
  8. $CID = 0;
  9. foreach( $DD as $V ){
  10. $CV = trim( $V );
  11. $BB = file( $GVAULT_PATH.'/'.$CV.'/backups.var' );
  12. foreach( $BB as $B ){
  13. $TArr = explode( ':', trim( $B ) );
  14. if( count( $TArr ) > 1 ){
  15. $CR['id'] = $CID;
  16. $CR['ts'] = date( "Y-m-d H:i", intval($TArr[0]));
  17. $CR['bk_type'] = intval( $TArr[1] );
  18. $CR['base_version']=$CV;
  19. $CR['file_name']=$CV.'_'.$TArr[0].'.tar.bz2';
  20. $CR['size']=filesize( $GVAULT_PATH.'/'.$CV.'/'.$CR['file_name'] );
  21. if( $CR['size'] > 268435456 ){
  22. $CR['size'] = sprintf("%0.1fGb", $CR['size'] / 1073741824 );
  23. } else if( $CR['size'] > 716800 ){
  24. $CR['size'] = sprintf("%0.1fMb", $CR['size'] / 1048576 );
  25. } else if( $CR['size'] > 1023 ){
  26. $CR['size'] = sprintf("%0.1fKb", $CR['size'] / 1024 );
  27. } else {
  28. $CR['size'] = sprintf("%dB", $CR['size'] );
  29. };
  30. $Data['backups'][]=$CR;
  31. $CID ++;
  32. };
  33. };
  34. };
  35. $Data['totalCount'] = $CID;
  36. echo json_encode( $Data );
  37. ?>