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.
39 lines
1.1 KiB
39 lines
1.1 KiB
<?php
|
|
require_once('../../defines.php');
|
|
require_once('/srv/etc/sys_map.php');
|
|
require_once('toolkit.php' );
|
|
|
|
$DD = file( $GVAULT_PATH . '/versions.var');
|
|
$Data = array();
|
|
$Data['backups'] = array();
|
|
$CID = 0;
|
|
foreach( $DD as $V ){
|
|
$CV = trim( $V );
|
|
$BB = file( $GVAULT_PATH.'/'.$CV.'/backups.var' );
|
|
foreach( $BB as $B ){
|
|
$TArr = explode( ':', trim( $B ) );
|
|
if( count( $TArr ) > 1 ){
|
|
$CR['id'] = $CID;
|
|
$CR['ts'] = date( "Y-m-d H:i", intval($TArr[0]));
|
|
$CR['bk_type'] = intval( $TArr[1] );
|
|
$CR['base_version']=$CV;
|
|
$CR['file_name']=$CV.'_'.$TArr[0].'.tar.bz2';
|
|
$CR['size']=filesize( $GVAULT_PATH.'/'.$CV.'/'.$CR['file_name'] );
|
|
if( $CR['size'] > 268435456 ){
|
|
$CR['size'] = sprintf("%0.1fGb", $CR['size'] / 1073741824 );
|
|
} else if( $CR['size'] > 716800 ){
|
|
$CR['size'] = sprintf("%0.1fMb", $CR['size'] / 1048576 );
|
|
} else if( $CR['size'] > 1023 ){
|
|
$CR['size'] = sprintf("%0.1fKb", $CR['size'] / 1024 );
|
|
} else {
|
|
$CR['size'] = sprintf("%dB", $CR['size'] );
|
|
};
|
|
$Data['backups'][]=$CR;
|
|
$CID ++;
|
|
};
|
|
};
|
|
};
|
|
$Data['totalCount'] = $CID;
|
|
echo json_encode( $Data );
|
|
|
|
?>
|