Child pages
  • UAPI Functions - Restore::query_file_info
Skip to end of metadata
Go to start of metadata

Description

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

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsessXXXXXXXXXXXX/execute/Restore/query_file_info?path=%2Fpublic_html

 


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$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',
    )
 );

 


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
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',
    }
 );

 


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!--  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 %]

 


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=example Restore query_file_info path=/public_html



Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 

 Output (JSON)
# 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
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
pathstring

Required

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

Notes:

  • 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.

Notes:

  • 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

 Returns

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

This hash contains one ore more of the following parameters:

  • backupDate
  • backupID
  • backupType
  • 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:

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

fileSize

integer

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

The function returns this value in the unnamed hash.

Note:

The function returns this value only when 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:

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:

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:

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.

Notes:

  • The function returns this value only when 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.

Notes:

  • The function returns this value only when 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:

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