Page tree
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?fullpath=%2Fpublic_html%2Findex.php
https://hostname.example.com:2083/cpsessXXXXXXXXXXXX/execute/Restore/query_file_info?fullpath=%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(
        'fullpath'  => '/public_html/index.php',
    )
 );
$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(
        'fullpath'  => '/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',
    {
        'fullpath'  => '/public_html/index.php',
    }
 );
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',
    {
        'fullpath'  => '/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'{ 'fullpath' => '/public_html/index.php' } ); %]
[% FOREACH q = data %]
     <p>
         BackupDate: [% q.backupDate %] backupID: [% q.backupID %] FileSize: [% q.fileSize %] Fullpath: [% q.fullpath %] ModifiedDate: [% q.modifiedDate %]
     </p>
[% END %]
<!--  get a list of all backups that contain file -->
[% data = execute( 'Restore', 'query_file_info'{ 'fullpath' => '/public_html' } ); %]
[% FOREACH q = data %]
     <p>
         BackupDate: [% q.backupDate %] backupID: [% q.backupID %] FileSize: [% q.fileSize %] Fullpath: [% q.fullpath %] 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 fullpath=/public_html/index.php
uapi --user=example Restore query_file_info fullpath=/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. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
# Output for: Restore query_file_info fullpath=/directory/file.name
 
{
   "errors":null,
   "messages":null,
   "data":[
      {
         "modifiedDate":"2017-09-13 14:58",
         "backupID":"2017-09-17",
         "backupDate":"2017-09-17",
         "type":"file",
         "backupType":"compressed",
         "fileSize":"1792",
         "fullpath":"/public_html/testdir/9.txt"
      },
      {
         "fullpath":"/public_html/testdir/9.txt",
         "fileSize":"1792",
         "backupType":"compressed",
         "backupID":"2017-09-18",
         "modifiedDate":"2017-09-13 14:58",
         "backupDate":"2017-09-18",
         "type":"file"
      }
   ],
   "metadata":{
      "transformed":1
   },
   "status":1
}
 
# Output for: Restore query_file_info fullpath=/directory 
{
   "data":[
      {
         "dirSize":40896,
         "backupID":"2017-09-17",
         "backupType":"incremental",
         "type":"dir",
         "backupDate":"2017-09-17",
         "fileCount":15,
         "fullpath":"/public_html/testdir"
      },
      {
         "backupID":"2017-09-18",
         "dirSize":40896,
         "fileCount":15,
         "type":"dir",
         "backupDate":"2017-09-18",
         "backupType":"compressed",
         "fullpath":"/public_html/testdir"
      }
   ],
   "status":1,
   "errors":null,
   "metadata":{
      "transformed":1
   },
   "messages":null
}

Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
fullpathstring

Required.

An item in the user's home directory, or any level below it.

Note:

The value of this parameter must begin with a forward slash (/).

A valid file path.

/public_html/index.php

 

Returns

ReturnTypeDescriptionPossible valuesExample
dataarray of hashes

An array of hashes that contains information about the backups that exist in a file.

This array contains one or more unnamed hashes.

 

 hashA hash that contains an item's details.

This hash contains one ore more of the following parameters:

  • backupDate
  • backupID
  • backupType
  • dirSize
  • fileCount
  • fileSize
  • fullpath
  • modifiedDate
  • 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

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:

The function returns this value only when the item is a directory.

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:

The function returns this value only when the item is a directory.

An integer.2

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

An integer.199

fullpath

string

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

The function returns this value in the unnamed hash.

A filepath./public_html/index.php

modifiedDate

integer

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

The function returns this value in the unnamed hash.

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

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