Child pages
  • UAPI Functions - Restore::query_file_info

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt
This function lists all of an item's backup locations. An item can be a file, a directory, or a symlink.


Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsessXXXXXXXXXXXX/execute/Restore/query_file_info?path=%2Fpublic_html

 

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// get a list of all backups that contain file
$DAV = $cpanel->uapi(
    'Restore', 'query_file_info',
    array(
        'path'  => '/public_html',
    )
 );

 

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# get a list of all backups that contain file
my $disable_shared_global_addressbook = $cpliveapi->uapi(
    'Restore', 'query_file_info',
    {
        'path'  => '/public_html',
    }
 );

 

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Template Toolkit


Code Block
languagexml
<!--  get a list of all backups that contain file -->
[% data = execute( 'Restore', 'query_file_info'{ 'path' => '/public_html' } ); %]
[% FOREACH q = data %]
     <p>
         BackupDate: [% q.backupDate %] backupID: [% q.backupID %] FileSize: [% q.fileSize %] Path: [% q.path %] ModifiedDate: [% q.modifiedDate %]
     </p>
[% END %]

 

Include Page
LIB:_TTLink
LIB:_TTLink


Expand
titleCommand Line


Code Block
languagetext
uapi --user=example Restore query_file_info path=/public_html


Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
# Output for: Restore query_file_info path=/directory/file.name
 
{
   "data":[
      {
         "mtime":1522195920,
         "backupType":"compressed",
         "type":"file",
         "backupID":"2018-03-28",
         "backupDate":"2018-03-28",
         "path":"/public_html/file.txt",
         "fileSize":26
      },
      {
         "mtime":1522195920,
         "backupType":"compressed",
         "type":"file",
         "backupID":"2018-03-29",
         "backupDate":"2018-03-29",
         "path":"/public_html/file.txt",
         "fileSize":26
      }
   ],
   "metadata":{
      "transformed":1
   },
   "messages":null,
   "status":1,
   "errors":null
}
 
# Output for: Restore query_file_info path=/directory 
{
   "messages":null,
   "data":[
      {
         "mtime":1522195920,
         "backupType":"compressed",
         "type":"dir",
         "backupID":"2018-03-28",
         "backupDate":"2018-03-28",
         "path":"/public_html"
      },
      {
         "mtime":1522195920,
         "backupType":"compressed",
         "type":"dir",
         "backupID":"2018-03-29",
         "backupDate":"2018-03-29",
         "path":"/public_html"
      }
   ],
   "metadata":{
      "transformed":1
   },
   "errors":null,
   "status":1
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
pathstring

Required

A file, directory, or symlink in the user's directory tree.

Note
titleNotes:
  • The value of this parameter must begin with a forward slash (/).
  • We added this parameter in cPanel & WHM version 72.


A file or directory path, relative to the user's home directory.

/public_html/index.php
fullpathstring

Required

A file, directory, or symlink in the user's directory tree.

Note
titleNotes:
  • The value of this parameter must begin with a forward slash (/).
  • We deprecated this parameter in cPanel & WHM version 72.


A file or directory path, relative to the user's home directory.

/public_html/index.php

exists

Boolean

Whether to show the exist return, which indicates whether the item exists in the local disk or only in the backup.

Note
titleNote:
  • We added this parameter in cPanel & WHM version 76.
  • Because this parameter is optional, when you do not pass the parameter, the system defaults the value to 0 .


  • 1 — Show the exist return's value.
  • 0 — Do not show the exists return's value.


0

 Returns

ReturnTypeDescriptionPossible valuesExample
 hashA hash that contains an item's details.

This hash contains one or more of the following parameters:

  • backupDate
  • backupID
  • backupType
  • exists
  • fileSize
  • path
  • mtime
  • type
 

backupDate

integer

The date when the system created the backup.

The function returns this value in the unnamed hash.


The date, in YYYY-MM-DD format, where:

  • YYYY represents the year.
  • MM represents the month.
  • DD represents the date.
2017-07-01

backupID

string

The backup's identification.

The function returns this value in the unnamed hash.

  • A date, in YYYY-MM-DD format.
  • The value incremental, for an incremental daily backup.
  • The backup frequency, a slash character (/), and the backup date, in YYYY-MM-DD format.
  • The backup frequency, a slash character (/), and the value incremental.
Note
titleNote:

The date, in YYYY-MM-DD format, where:

  • YYYY represents the year.
  • MM represents the month.
  • DD represents the date.


2017-07-01

backupType

string

The backup type.

The function returns this value in the unnamed hash.

  • compressed — A compressed tar file.
  • incremental — A full tree of files and directories.
  • uncompressed — An uncompressed tar file.
compressed

exists

Boolean

Whether the item (a file, a directory, or a symlink) exists in the local disk or only in the backup.

The function returns this value in the unnamed hash.

Note
titleNotes:
  • This return appears only if you set the exist parameter to 1.
  • We added this return in cPanel & WHM version 76.


  • 1 — The item exists in the local disk.
  • 0 — The item exists only in the backup.

1

fileSize

integer

The size, in bytes, of the file in the backup.

The function returns this value in the unnamed hash.

Note
titleNote:

The function returns this value only if the item is a file.


An integer.199

path

string

The identical path value that the system passed in the function.

The function returns this value in the unnamed hash.

Note
titleNote:

We added this return in cPanel & WHM version 72.


A filepath./public_html/index.php

mtime

integer

The file's last modification time.

The function returns this value in the unnamed hash.

Note
titleNote:

We added this return in cPanel & WHM version 70.


Unix time stamp.
1520043240

type

string

The item type stored in the backup.

The function returns this value in the unnamed hash.

  • dir — A directory.
  • file — A file.
  • symlink — A symlink.
  • unknown — An unknown file type.
file

fullpath

string

The identical fullpath value that the system passed in the function.

The function returns this value in the unnamed hash.

Note
titleNote:

We removed this return in cPanel & WHM version 72.


A filepath.

dirSize

integer

The size, in bytes, of the directory and all of its files, subdirectories, and subfiles.

The function returns this value in the unnamed hash.

Note
titleNotes:
  • The function returns this value only if the item is a directory.
  • We removed this return in cPanel & WHM version 70.


An integer.12

fileCount

integer

The sum of all the files, subfiles, and subdirectories within a specified directory.

The function returns this value in the unnamed hash.

Note
titleNotes:
  • The function returns this value only if the item is a directory.
  • We removed this return in cPanel & WHM version 70.


An integer.2

modifiedDate

integer

The file's last modified date, at the time of the backup.

The function returns this value in the unnamed hash.

Note
titleNote:

We removed this return in cPanel & WHM version 70.


The date and time in YYYY-MM-DD HH:mm format, where:

  • YYYY represents the year.
  • MM represents the month.
  • DD represents the date.
  • HH represents the hour.
  • mm represents the minute.
2017-06-02 12:18