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, a directory, or a symlink.

Important:

In cPanel & WHM version 84 and later, when you disable the FileStorage role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

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.

 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. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 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

exists

Boolean

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

Note:

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

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.

Notes:

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

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:

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

Notes:

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

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