.htaccess
1 year ago
JetBackupLinux.php
1 year ago
JetBackupLinuxObject.php
1 year ago
Query.php
1 year ago
QueueItem.php
1 year ago
index.html
1 year ago
web.config
1 year ago
Query.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace JetBackup\JetBackupLinux; |
| 4 | |
| 5 | use JetBackup\Exception\JetBackupLinuxException; |
| 6 | use JetBackup\SocketAPI\Exception\SocketAPIException; |
| 7 | use JetBackup\SocketAPI\SocketAPI; |
| 8 | |
| 9 | if (!defined( '__JETBACKUP__')) die('Direct access is not allowed'); |
| 10 | |
| 11 | class Query extends SocketAPI { |
| 12 | |
| 13 | /** |
| 14 | * @param $function |
| 15 | * |
| 16 | * @return Query |
| 17 | * @throws JetBackupLinuxException |
| 18 | */ |
| 19 | public static function api($function):Query { |
| 20 | if(!function_exists('socket_connect')) |
| 21 | throw new JetBackupLinuxException("The function socket_connect not installed or disabled within your PHP."); |
| 22 | return new Query($function); |
| 23 | } |
| 24 | |
| 25 | public function execute() { |
| 26 | |
| 27 | try { |
| 28 | $response = parent::execute(); |
| 29 | } catch(SocketAPIException $e) { |
| 30 | throw new JetBackupLinuxException($e->getMessage()); |
| 31 | } |
| 32 | |
| 33 | if(!$response['success']) throw new JetBackupLinuxException($response['message']); |
| 34 | return $response['data']; |
| 35 | } |
| 36 | |
| 37 | } |