From 9d773c02981d74ff37eeb51c24f1240c689d1e96 Mon Sep 17 00:00:00 2001 From: ramon Date: Fri, 13 Oct 2017 11:00:17 +0000 Subject: #810: Indicar si existen backups de imágenes en ruta RREST {{{/repository/images}}}. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@5460 a21b9725-9963-47de-94b9-378ad31fedc9 --- admin/WebConsole/rest/opengnsys-api.yml | 12 ++++++++++-- admin/WebConsole/rest/repository.php | 7 +++++++ repoman/bin/checkrepo | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/admin/WebConsole/rest/opengnsys-api.yml b/admin/WebConsole/rest/opengnsys-api.yml index e37559d5..34b44752 100644 --- a/admin/WebConsole/rest/opengnsys-api.yml +++ b/admin/WebConsole/rest/opengnsys-api.yml @@ -1197,7 +1197,7 @@ definitions: description: image name (file name without extension) type: string type: - description: image type (file extension or ''dir'' for directory image) + description: image type (file extension or `dir` for directory image) type: string clientname: description: source client name @@ -1226,5 +1226,13 @@ definitions: mode: description: image access permissions (four octal digits) type: string - required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode ] + backedup: + description: image backed up flag (check if `.ant` file exists) + type: boolean + default: false + backupsize: + description: image backup size (bytes) + type: integer + format: int64 + required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode, backedup ] diff --git a/admin/WebConsole/rest/repository.php b/admin/WebConsole/rest/repository.php index e5ce76bd..3acb4230 100644 --- a/admin/WebConsole/rest/repository.php +++ b/admin/WebConsole/rest/repository.php @@ -97,6 +97,13 @@ $app->get('/repository/images(/)', 'validateRepositoryApiKey', $response['images'][$i]['size'] = @stat($file)['size']; $response['images'][$i]['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']); $response['images'][$i]['mode'] = substr(decoct(@stat($file)['mode']), -4); + $backupfile = $file.".ant"; + if (file_exists($backupfile)) { + $response['images'][$i]['backedup'] = true; + $response['images'][$i]['backupsize'] = @stat($backupfile)['size']; + } else { + $response['images'][$i]['backedup'] = false; + } } // Complete image in OUs information. for ($j=0; $j