PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / 1.2.7
JetBackup – Backup, Restore & Migrate v1.2.7
3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 1.6.11 1.6.12 1.6.13 1.6.15 1.6.5.1 1.6.8.8 1.6.9 1.6.9.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7.5 2.0.8.7 2.0.9.11 2.0.9.14 2.0.9.15 2.0.9.6 2.0.9.7 2.0.9.9 3.1.10.7 3.1.11.1 3.1.12.3 3.1.13.4 3.1.14.17 3.1.15.4 3.1.16.1 3.1.17.5 3.1.18.10 3.1.18.8 3.1.18.9 3.1.19.8 3.1.20.3 3.1.21.3 3.1.7.9 3.1.9.2 trunk 1.1.90 1.1.91 1.2.0 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2
backup / com / core / storage / SGStorage.php
backup / com / core / storage Last commit date
SGDropbox.php 6 years ago SGDropboxStorage.php 6 years ago SGStorage.php 6 years ago
SGStorage.php
104 lines
1 <?php
2
3 require_once(SG_LIB_PATH.'SGReloadHandler.php');
4 require_once(SG_LIB_PATH.'SGState.php');
5 require_once(SG_LIB_PATH.'SGUploadState.php');
6
7 interface SGIStorageDelegate
8 {
9 public function willStartUpload($chunksCount);
10 public function updateProgressManually($progress);
11 public function shouldUploadNextChunk();
12 }
13
14 abstract class SGStorage
15 {
16 protected $connected = false;
17 protected $activeDirectory = '';
18 protected $delegate = null;
19 protected $state = null;
20
21 /* Make all initializations here */
22 abstract public function init();
23
24 /* Connect to the Storage */
25 abstract public function connect();
26
27 /* Connect offline. This will ensure that redirections to other pages won't be made */
28 abstract public function connectOffline();
29
30 /* Check if it is already connected */
31 abstract public function checkConnected();
32
33 /* Get list of files inside the active directory */
34 abstract public function getListOfFiles();
35
36 /* Create a folder inside the active directory. If folder already exists, do nothing. */
37 abstract public function createFolder($folderName);
38
39 /* Download file from Storage*/
40 abstract public function downloadFile($filePath, $size);
41
42 /* Upload local file to Storage */
43 abstract public function uploadFile($filePath);
44
45 /* Delete file from active directory */
46 abstract public function deleteFile($fileName);
47
48 /* Delete folder and it's contents from active directory */
49 abstract public function deleteFolder($folderName);
50
51 /* Search if file or folder exists in given path */
52 abstract public function fileExists($path);
53
54 public function __construct()
55 {
56 @session_write_close();
57 @session_start();
58 $this->init();
59 $this->checkConnected();
60 }
61
62 /* NOTE: Depending on the storage type, $directory could be the ID of the directory and not the name. */
63 public function setActiveDirectory($directory)
64 {
65 $this->activeDirectory = $directory;
66 }
67
68 public function getActiveDirectory()
69 {
70 return $this->activeDirectory;
71 }
72
73 public function isConnected()
74 {
75 return $this->connected;
76 }
77
78 public function setDelegate(SGIStorageDelegate $delegate)
79 {
80 $this->delegate = $delegate;
81 }
82
83 public function loadState()
84 {
85 $this->state = $this->delegate->getState();
86 }
87
88 public function reload()
89 {
90 $this->delegate->reload();
91 }
92
93 public function shouldReload()
94 {
95 return $this->delegate->shouldReload();
96 }
97
98 public function standardizeFileCreationDate($date)
99 {
100 $time = strtotime($date);
101 return backupGuardConvertDateTimezone(date('Y-m-d H:i:s', $time));
102 }
103 }
104