- Add FileSystem Core API

- Update Service class
- Readme update
This commit is contained in:
alphayax 2016-05-15 19:47:14 +02:00
parent 75654ecc07
commit 38c521f9d0
14 changed files with 929 additions and 5 deletions

1
.gitignore vendored
View File

@ -11,4 +11,5 @@
/exemple/AirMedia/app_token
/exemple/config/app_token
/exemple/download/app_token
/exemple/FileSystem/app_token
/app_token

View File

@ -11,6 +11,9 @@ Ce projet est basé sur **composer**. Pensez à installer les dependences :)
Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
- AirMedia
- FileSystem
- FileSystem (Core)
- Downloads
- Download
- Configuration

View File

@ -0,0 +1,24 @@
<?php
/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.filesystem', 'Freebox PHP API Example (FileSystem)', '1.0.0');
$App->authorize();
$App->openSession();
/// Scan files in root
$FSListService = new \alphayax\freebox\api\v3\services\FileSystem\FileSystemListing( $App);
$FilesInRoot = $FSListService->getFilesFromDirectory( '/');
foreach( $FilesInRoot as $fileInfo){
echo '- '. $fileInfo->getPath() . PHP_EOL;
}
/// Get a file information (Will throw an exception if file does not exists)
try {
$VideoFile = $FSListService->getFileInformation( '/Disque dur/Téléchargements/The.100.S03E14.FASTSUB.VOSTFR.1080p.HDTV.x264.AAC-GOBO2S/The.100.S03E14.FASTSUB.VOSTFR.1080p.HDTV.x264.AAC-GOBO2S.mkv');
var_dump( $VideoFile);
} catch (Exception $e){
echo $e->getMessage();
}

View File

@ -0,0 +1,54 @@
<?php
/// Require Composer AutoLoader
require_once '../../vendor/autoload.php';
/// Define our application
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.filesystem', 'Freebox PHP API (FileSystem)', '1.0.0');
$App->authorize();
$App->openSession();
$FSListService = new \alphayax\freebox\api\v3\services\FileSystem\FileSystemOperation( $App);
/// Uncomment following lines and give existing file names to test
/*
$a = $FSListService->move( ['/Disque dur/Photos/vivi.jpg'], '/Disque dur/Videos/');
var_dump( $a);
$a = $FSListService->copy( ['/Disque dur/Photos/vivi.jpg'], '/Disque dur/Photos/vivi3.jpg');
var_dump( $a);
$b = $FSListService->remove( ['/Disque dur/Photos/vivi2.jpg']);
var_dump( $b);
$c = $FSListService->cat( ['/Disque dur/Photos/vivi.jpg','/Disque dur/Photos/vivi3.jpg'], '/Disque dur/Photos/vivivivi.jpg');
var_dump( $c);
$d = $FSListService->archive(['/Disque dur/Photos/vivi.jpg','/Disque dur/Photos/vivi3.jpg'], '/Disque dur/Photos/vivi.zip');
var_dump( $d);
$e = $FSListService->extract( '/Disque dur/Photos/vivi.zip', '/Disque dur/Vidéos/', '', true);
var_dump( $e);
$f = $FSListService->computeHash( '/Disque dur/Photos/vivi.jpg');
var_dump( $f);
sleep( 2);
$g = $FSListService->getHashValue( $f->getId());
var_dump( $g);
$h = $FSListService->createDirectory( '/Disque dur/Photos/', 'toto');
var_dump( $h);
$i = $FSListService->rename('/Disque dur/Photos/toto', 'tutu');
var_dump( $i);
$j = $FSListService->download( '/Disque dur/Photos/vivi.jpg');
var_dump( $j);
*/
/*
sleep(1);
$Task = new \alphayax\freebox\api\v3\services\FileSystem\FileSystemTask($App);
$a = $Task->getTaskById($e->getId());
var_dump( $a);
*/

View File

@ -30,11 +30,13 @@ abstract class Service {
}
/**
* @param $service
* @param string $service
* @param bool $isJson
* @param bool $returnAsArray
* @return \alphayax\freebox\utils\RestAuth
*/
protected function getAuthService( $service){
$rest = new \alphayax\freebox\utils\RestAuth( static::API_HOST . $service);
protected function getAuthService( $service, $isJson = true, $returnAsArray = true){
$rest = new \alphayax\freebox\utils\RestAuth( static::API_HOST . $service, $isJson, $returnAsArray);
$rest->setSessionToken( $this->application->getSessionToken());
return $rest;
}

View File

@ -0,0 +1,145 @@
<?php
namespace alphayax\freebox\api\v3\models\FileSystem;
use alphayax\freebox\api\v3\Model;
/**
* Class FileInfo
* @package alphayax\freebox\api\v3\models\FileSystem
*/
class FileInfo extends Model {
/** @var string (Read-only) : file path (encoded in base64 as explained in Path Encoding) */
protected $path;
/** @var string (Read-only) : file name (in clear text) */
protected $name;
/** @var string (Read-only) : file mimetype */
protected $mimetype;
/**
* @var string (Read-only) : The file type
* @see alphayax\freebox\api\v3\symbols\FileSystem\FileInfoType
*/
protected $type;
/** @var int (Read-only) : file size in bytes */
protected $size;
/** @var int (Read-only) : file modification timestamp */
protected $modification;
/** @var int (Read-only) : display order for natural sort */
protected $index;
/** @var boolean (Read-only) : is this file a link */
protected $link;
/** @var string (Read-only) : symlink target path
* (encoded in base64 as explained in Path Encoding)
* Only present when link is set to true
*/
protected $target;
/** @var boolean (Read-only) : should the file be hidden to user */
protected $hidden;
/**
* @var int (Read-only) : number of subfolders
* Only relevant for dir, only provided if “countSubFolder” parameter is set
*/
protected $foldercount;
/**
* @var int (Read-only) : number of files inside directory
* Only relevant for dir, only provided if “countSubFolder” parameter is set
*/
protected $filecount;
/**
* @return string
*/
public function getPath(){
return base64_decode( $this->path);
}
/**
* @return string
*/
public function getName(){
return $this->name;
}
/**
* @return string
*/
public function getMimetype(){
return $this->mimetype;
}
/**
* @return string
* @see alphayax\freebox\api\v3\symbols\FileSystem\FileInfoType
*/
public function getType(){
return $this->type;
}
/**
* @return int
*/
public function getSize(){
return $this->size;
}
/**
* @return int
*/
public function getModification(){
return $this->modification;
}
/**
* @return int
*/
public function getIndex(){
return $this->index;
}
/**
* @return boolean
*/
public function isLink(){
return $this->link;
}
/**
* @return string
*/
public function getTarget(){
return base64_decode( $this->target);
}
/**
* @return boolean
*/
public function isHidden(){
return $this->hidden;
}
/**
* @return int
*/
public function getFoldercount(){
return $this->foldercount;
}
/**
* @return int
*/
public function getFilecount(){
return $this->filecount;
}
}

View File

@ -0,0 +1,247 @@
<?php
namespace alphayax\freebox\api\v3\models\FileSystem;
use alphayax\freebox\api\v3\Model;
/**
* Class FsTask
* @package alphayax\freebox\api\v3\models\FileSystem
*/
class FsTask extends Model {
/** @var int (Read-only) : id */
protected $id;
/**
* @var string (Read-only) : The task type
* @see alphayax\freebox\api\v3\symbols\FileSystem\TaskType
*/
protected $type;
/**
* @var string : The task state
* @see alphayax\freebox\api\v3\symbols\FileSystem\TaskState
*/
protected $state;
/**
* @var string (Read-only)
* none : No error
* archive_read_failed : Error reading archive
* archive_open_failed : Error opening archive
* archive_write_failed : Error writing archive
* chdir_failed : Error changing directory
* dest_is_not_dir : The destination is not a directory
* file_exists : File already exists
* file_not_found : File not found
* mkdir_failed : Unable to create directory
* open_input_failed : Error opening input file
* open_output_failed : Error opening output file
* opendir_failed : Error opening directory
* overwrite_failed : Error overwriting file
* path_too_big : Path is too long
* repair_failed : Failed to repair corrupted files
* rmdir_failed : Error removing directory
* same_file : Source and Destination are the same file
* unlink_failed : Error removing file
* unsupported_file_type : This file type is not supported
* write_failed : Error writing file
* disk_full : Disk is full
* internal : Internal error
* invalid_format : Invalid file format (corrupted ?)
* incorrect_password : Invalid or missing password for extraction
* permission_denied : Permission denied
* readlink_failed : Failed to read the target of a symbolic link
* symlink_failed : Failed to create a symbolic link
*/
protected $error;
/** @var int timestamp (Read-only) : task creation timestamp */
protected $created_ts;
/** @var int timestamp (Read-only) : task start timestamp */
protected $started_ts;
/** @var int timestamp (Read-only) : task end timestamp */
protected $done_ts;
/** @var int (Read-only) : task duration in seconds */
protected $duration;
/** @var int (Read-only) : task progress in percent (scaled by 100) */
protected $progress;
/** @var int (Read-only) : estimated time remaining before the task completion (in seconds) */
protected $eta;
/** @var string (Read-only) : current source file (if available) */
protected $from;
/** @var string (Read-only) : current destination file (if available) */
protected $to;
/** @var int (Read-only) : number of files to process */
protected $nfiles;
/** @var int (Read-only) : number of files processed */
protected $nfiles_done;
/** @var int (Read-only) : total bytes to process */
protected $total_bytes;
/** @var int (Read-only) : number of bytes processed */
protected $total_bytes_done;
/** @var int (Read-only) : size of the file currently processed */
protected $curr_bytes;
/** @var int (Read-only) : number of bytes processed for the current file */
protected $curr_bytes_done;
/** @var int (Read-only) : processing rate in byte/s */
protected $rate;
/**
* @return int
*/
public function getId(){
return $this->id;
}
/**
* @return string
* @see alphayax\freebox\api\v3\symbols\FileSystem\TaskType
*/
public function getType(){
return $this->type;
}
/**
* @return string
* @see alphayax\freebox\api\v3\symbols\FileSystem\TaskState
*/
public function getState(){
return $this->state;
}
/**
* @param string $state
* @see alphayax\freebox\api\v3\symbols\FileSystem\TaskState
*/
public function setState( $state){
$this->state = $state;
}
/**
* @return string
*/
public function getError(){
return $this->error;
}
/**
* @return int
*/
public function getCreatedTs(){
return $this->created_ts;
}
/**
* @return int
*/
public function getStartedTs(){
return $this->started_ts;
}
/**
* @return int
*/
public function getDoneTs(){
return $this->done_ts;
}
/**
* @return int
*/
public function getDuration(){
return $this->duration;
}
/**
* @return int
*/
public function getProgress(){
return $this->progress;
}
/**
* @return int
*/
public function getEta(){
return $this->eta;
}
/**
* @return string
*/
public function getFrom(){
return $this->from;
}
/**
* @return string
*/
public function getTo(){
return $this->to;
}
/**
* @return int
*/
public function getNfiles(){
return $this->nfiles;
}
/**
* @return int
*/
public function getNfilesDone(){
return $this->nfiles_done;
}
/**
* @return int
*/
public function getTotalBytes(){
return $this->total_bytes;
}
/**
* @return int
*/
public function getTotalBytesDone(){
return $this->total_bytes_done;
}
/**
* @return int
*/
public function getCurrBytes(){
return $this->curr_bytes;
}
/**
* @return int
*/
public function getCurrBytesDone(){
return $this->curr_bytes_done;
}
/**
* @return int
*/
public function getRate(){
return $this->rate;
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace alphayax\freebox\api\v3\services\FileSystem;
use alphayax\freebox\api\v3\models\FileSystem\FileInfo;
use alphayax\freebox\api\v3\Service;
/**
* Class FileSystemListing
* @package alphayax\freebox\api\v3\services\FileSystem
*/
class FileSystemListing extends Service {
const API_FS_LS = '/api/v3/fs/ls/';
const API_FS_INFO = '/api/v3/fs/info/';
/**
* @param string $DirectoryName
* @param bool $onlyFolder Only list folders
* @param bool $countSubFolder Return files and subfolder count for folders
* @param bool $removeHidden Dont return hidden files in directory listing
* @return FileInfo[]
*/
public function getFilesFromDirectory( $DirectoryName = '/Disque dur/', $onlyFolder = true, $countSubFolder = false, $removeHidden = true){
$Directory_b64 = base64_encode( $DirectoryName);
$rest = $this->getAuthService( self::API_FS_LS . $Directory_b64);
$rest->GET([
'onlyFolder' => $onlyFolder,
'countSubFolder' => $countSubFolder,
'removeHidden' => $removeHidden,
]);
$FsTask_xs = $rest->getCurlResponse()['result'];
$FsTasks = [];
foreach( $FsTask_xs as $fsTask_x) {
$FsTasks[] = new FileInfo( $fsTask_x);
}
return $FsTasks;
}
/**
* Get file information
* @param string $DirectoryName
* @return FileInfo
*/
public function getFileInformation( $DirectoryName){
$Directory_b64 = base64_encode( $DirectoryName);
$rest = $this->getAuthService( self::API_FS_INFO . $Directory_b64);
$rest->GET();
return new FileInfo( $rest->getCurlResponse()['result']);
}
}

View File

@ -0,0 +1,278 @@
<?php
namespace alphayax\freebox\api\v3\services\FileSystem;
use alphayax\freebox\api\v3\models\FileSystem\FsTask;
use alphayax\freebox\api\v3\Service;
/**
* Class FileSystemOperation
* @package alphayax\freebox\api\v3\services\FileSystem
*/
class FileSystemOperation extends Service {
const API_FS_MV = '/api/v3/fs/mv/';
const API_FS_CP = '/api/v3/fs/cp/';
const API_FS_RM = '/api/v3/fs/rm/';
const API_FS_CAT = '/api/v3/fs/cat/';
const API_FS_ARCHIVE = '/api/v3/fs/archive/';
const API_FS_EXTRACT = '/api/v3/fs/extract/';
const API_FS_REPAIR = '/api/v3/fs/repair/';
const API_FS_HASH = '/api/v3/fs/hash/';
const API_FS_TASK_HASH = '/api/v3/fs/tasks/%u/hash';
const API_FS_MKDIR = '/api/v3/fs/mkdir/';
const API_FS_RENAME = '/api/v3/fs/rename/';
const API_DOWNLOAD = '/api/v3/dl/';
/**
* Move files
* @param string[] $sourceFiles
* @param string $destination
* @param string $conflictMode
* @return FsTask
*/
public function move( array $sourceFiles = [], $destination, $conflictMode = 'recent'){
/// Convert all paths in base64
$destination_b64 = base64_encode( $destination);
$source_b64 = [];
foreach( $sourceFiles as $sourceFile){
$source_b64[] = base64_encode( $sourceFile);
}
$rest = $this->getAuthService( self::API_FS_MV);
$rest->POST([
'files' => $source_b64,
'dst' => $destination_b64,
'mode' => $conflictMode,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Copy files
* @param string[] $sourceFiles
* @param string $destination
* @param string $conflictMode
* @return FsTask
*/
public function copy( array $sourceFiles = [], $destination, $conflictMode = 'recent'){
/// Convert all paths in base64
$destination_b64 = base64_encode( $destination);
$source_b64 = [];
foreach( $sourceFiles as $sourceFile){
$source_b64[] = base64_encode( $sourceFile);
}
$rest = $this->getAuthService( self::API_FS_CP);
$rest->POST([
'files' => $source_b64,
'dst' => $destination_b64,
'mode' => $conflictMode,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Delete files
* @param string[] $RemoveFiles
* @return FsTask
*/
public function remove( array $RemoveFiles = []){
/// Convert all paths in base64
$removedFiles_b64 = [];
foreach( $RemoveFiles as $sourceFile){
$removedFiles_b64[] = base64_encode( $sourceFile);
}
$rest = $this->getAuthService( self::API_FS_RM);
$rest->POST([
'files' => $removedFiles_b64,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Concatenate files (Miaw ^^)
* @param string[] $fileParts : The list of files to concatenate
* @param string $destination : The destination file
* @param bool $isMultiVolumes : Enable multi-volumes mode, it will start at XXX001 and concatenate XXX002, XXX003, ...
* @param bool $isToDelete : Deletes source files
* @param bool $isToOverwrite : Overwrites the destination
* @param bool $isToAppend : Append to the destination
* @return FsTask
*/
public function cat( array $fileParts = [], $destination, $isMultiVolumes = false, $isToDelete = false, $isToOverwrite = false, $isToAppend = false){
/// Convert all paths in base64
$destination_b64 = base64_encode( $destination);
$fileParts_b64 = [];
foreach($fileParts as $FilePart){
$fileParts_b64[] = base64_encode( $FilePart);
}
$rest = $this->getAuthService( self::API_FS_CAT);
$rest->POST([
'files' => $fileParts_b64,
'dst' => $destination_b64,
'multi_volumes' => $isMultiVolumes,
'delete_files' => $isToDelete,
'append' => $isToAppend,
'overwrite' => $isToOverwrite,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Create an archive
* @param string[] $fileParts : The list of files to concatenate
* @param string $destination : The destination file
* @return FsTask
*/
public function archive( array $fileParts = [], $destination){
/// Convert all paths in base64
$destination_b64 = base64_encode( $destination);
$fileParts_b64 = [];
foreach($fileParts as $FilePart){
$fileParts_b64[] = base64_encode( $FilePart);
}
$rest = $this->getAuthService( self::API_FS_ARCHIVE);
$rest->POST([
'files' => $fileParts_b64,
'dst' => $destination_b64,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Extract an archive
* @param string $source : The archive file
* @param string $destination : The destination folder
* @param string $password : The archive password
* @param bool $isToDelete : Delete archive after extraction
* @param bool $isToOverwrite : Overwrites the destination
* @return FsTask
*/
public function extract( $source, $destination, $password = '', $isToDelete = false, $isToOverwrite = false){
/// Convert all paths in base64
$source_b64 = base64_encode( $source);
$destination_b64 = base64_encode( $destination);
$rest = $this->getAuthService( self::API_FS_EXTRACT);
$rest->POST([
'src' => $source_b64,
'dst' => $destination_b64,
'password' => $password,
'delete_archive' => $isToDelete,
'overwrite' => $isToOverwrite,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Repair files from a .par2
* @param string $source : The .par2 file
* @param bool $isToDelete : Delete par2 files after repair
* @return FsTask
*/
public function repair( $source, $isToDelete = false){
/// Convert all paths in base64
$source_b64 = base64_encode( $source);
$rest = $this->getAuthService( self::API_FS_REPAIR);
$rest->POST([
'src' => $source_b64,
'delete_archive' => $isToDelete,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Hash a file. This operation can take some time. To get the hash value,
* the returned task must have succeed and be in the state “done”.
* @see
* @param string $source : The file to hash
* @param string $hashType : The type of hash (md5, sha1, ...) - Default is md5
* @return FsTask
*/
public function computeHash( $source, $hashType = 'md5'){
/// Convert all paths in base64
$source_b64 = base64_encode( $source);
$rest = $this->getAuthService( self::API_FS_HASH);
$rest->POST([
'src' => $source_b64,
'hash_type' => $hashType,
]);
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* Get the hash value
* To get the hash, the task must have succeed and be in the state “done”.
* @param $fsTaskId
* @return string
*/
public function getHashValue( $fsTaskId){
$service = sprintf( self::API_FS_TASK_HASH, $fsTaskId);
$rest = $this->getAuthService( $service);
$rest->GET();
return $rest->getCurlResponse()['result'];
}
/**
* Create a directory
* Contrary to other file system tasks, this operation is done synchronously.
* Instead of a returning a FsTask a call to this API will only return success status
* @param string $parentDirectory : The parent directory path
* @param string $newDirectoryName : The name of the directory to create
* @return bool
*/
public function createDirectory( $parentDirectory, $newDirectoryName){
$rest = $this->getAuthService( self::API_FS_MKDIR);
$rest->POST([
'parent' => base64_encode( $parentDirectory),
'dirname' => $newDirectoryName,
]);
return $rest->getCurlResponse()['success'];
}
/**
* Rename a file/folder
* Contrary to other file system tasks, this operation is done synchronously.
* Instead of a returning a FsTask a call to this API will only return success status
* @param string $sourceFilePath : The source file path
* @param string $newFileName : The new name of the file (clear text, without path)
* @return bool
*/
public function rename( $sourceFilePath, $newFileName){
$rest = $this->getAuthService( self::API_FS_RENAME);
$rest->POST([
'src' => base64_encode( $sourceFilePath),
'dst' => $newFileName,
]);
return $rest->getCurlResponse()['success'];
}
/**
* Download a file from the freebox server
* @param string $sourceFilePath
* @return mixed
*/
public function download( $sourceFilePath){
$rest = $this->getAuthService( self::API_DOWNLOAD . base64_encode( $sourceFilePath), false, false);
$rest->GET( null, false);
return $rest->getCurlResponse();
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace alphayax\freebox\api\v3\services\FileSystem;
use alphayax\freebox\api\v3\models\FileSystem\FsTask;
use alphayax\freebox\api\v3\Service;
/**
* Class FileSystemTask
* @package alphayax\freebox\api\v3\services\FileSystem
*/
class FileSystemTask extends Service {
const API_FS_TASK = '/api/v3/fs/tasks/';
/**
* @throws \Exception
* @return FsTask[]
*/
public function getAllTasks(){
$rest = $this->getAuthService( self::API_FS_TASK);
$rest->GET();
$FsTask_xs = $rest->getCurlResponse()['result'];
$FsTasks = [];
foreach( $FsTask_xs as $fsTask_x) {
$FsTasks[] = new FsTask( $fsTask_x);
}
return $FsTasks;
}
/**
* @param int $TaskId
* @return FsTask
*/
public function getTaskById( $TaskId){
$rest = $this->getAuthService( self::API_FS_TASK . $TaskId);
$rest->GET();
return new FsTask( $rest->getCurlResponse()['result']);
}
/**
* @param FsTask $FsTask
* @return bool
*/
public function deleteTask( FsTask $FsTask){
return $this->deleteTaskById( $FsTask->getId());
}
/**
* @param int $TaskId
* @return bool
*/
public function deleteTaskById( $TaskId){
$rest = $this->getAuthService( self::API_FS_TASK . $TaskId);
$rest->DELETE();
return $rest->getCurlResponse()['success'];
}
/**
* @param FsTask $FsTask
* @return bool
*/
public function updateTask( FsTask $FsTask){
$rest = $this->getAuthService( self::API_FS_TASK . $FsTask->getId());
$rest->PUT( $FsTask->toArray());
return $rest->getCurlResponse()['success'];
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace alphayax\freebox\api\v3\symbols\FileSystem;
/**
* Interface FileInfoType
* @package alphayax\freebox\api\v3\symbols\FileSystem
*/
interface FileInfoType {
const DIRECTORY = 'dir';
const REGULAR_FILE = 'file';
}

View File

@ -0,0 +1,14 @@
<?php
namespace alphayax\freebox\api\v3\symbols\FileSystem;
/**
* Interface TaskState
* @package alphayax\freebox\api\v3\symbols\FileSystem
*/
interface TaskState {
const QUEUED = 'queued'; // Queued (only one task is active at a given time)
const RUNNING = 'running'; // Running
const PAUSED = 'paused'; // Paused (user suspended)
const DONE = 'done'; // Done
const FAILED = 'failed'; // Failed (see error)
}

View File

@ -0,0 +1,16 @@
<?php
namespace alphayax\freebox\api\v3\symbols\FileSystem;
/**
* Interface TaskType
* @package alphayax\freebox\api\v3\symbols\FileSystem
*/
interface TaskType {
const CONCATENATE_MULTIPLE_FILES = 'cat';
const COPY_FILES = 'cp';
const MOVE_FILES = 'mv';
const REMOVE_FILES = 'rm';
const ARCHIVE_CREATE = 'archive';
const ARCHIVE_EXTRACT = 'extract';
const CHECK_AND_REPAIR_FILES = 'repair';
}

View File

@ -15,11 +15,15 @@ class RestAuth extends alphayax\utils\Rest {
/**
* @param null $curl_post_data
* @param bool $checkResponse
* @throws \Exception
*/
public function GET( $curl_post_data = null){
public function GET( $curl_post_data = null, $checkResponse = true){
$this->add_XFbxAppAuth_Header();
parent::GET( $curl_post_data);
$this->checkResponse();
if( $checkResponse){
$this->checkResponse();
}
}
/**