1 | <?php |
||
14 | class Remote |
||
15 | { |
||
16 | /** @var resource */ |
||
17 | protected $handle; |
||
18 | |||
19 | /** @var string Current remote folder path */ |
||
20 | protected $currentFolder; |
||
21 | |||
22 | /** @var integer Time difference between remote and local */ |
||
23 | protected $timeDiff; |
||
24 | |||
25 | /** |
||
26 | * Generic log function for further modification |
||
27 | * @param string $message |
||
28 | * @return mixed |
||
29 | */ |
||
30 | public function log($message) |
||
42 | |||
43 | /** |
||
44 | * Constructor |
||
45 | * @param string $host |
||
46 | * @param string $login |
||
47 | * @param string $pwd |
||
48 | */ |
||
49 | public function __construct($host, $login, $pwd) |
||
65 | |||
66 | /** |
||
67 | * Compare local file with remote file |
||
68 | * @param string $fullPath Full local file path |
||
69 | * @param int $maxAge File maximum possible age |
||
70 | * @return bool True if file is old and must be updated |
||
71 | */ |
||
72 | public function isOld($fullPath, $maxAge = 1) |
||
77 | |||
78 | /** Destructor */ |
||
79 | public function __destruct() |
||
83 | |||
84 | /** |
||
85 | * Write temp file to remote system and count difference |
||
86 | * @param string $localPath Path to local file |
||
87 | * @return int Time difference between systems |
||
88 | */ |
||
89 | private function writeTempFile($localPath) |
||
109 | |||
110 | /** |
||
111 | * Get time difference between servers |
||
112 | * @return integer Time difference between servers |
||
113 | */ |
||
114 | protected function getTimeDifference() |
||
127 | |||
128 | /** |
||
129 | * Go one level up in directory |
||
130 | */ |
||
131 | public function cdup() |
||
135 | |||
136 | /** |
||
137 | * Change current remote folder |
||
138 | * @param string $path Path to folder |
||
139 | * @return bool False if we cannot change folder |
||
140 | */ |
||
141 | public function cd($path) |
||
160 | |||
161 | /** |
||
162 | * Try to write to remote |
||
163 | * @return bool True if we can write to remote |
||
164 | */ |
||
165 | public function isWritable() |
||
182 | |||
183 | /** |
||
184 | * Create remote directory and get into it |
||
185 | * @param $path |
||
186 | */ |
||
187 | public function mkDir($path) |
||
199 | |||
200 | /** |
||
201 | * Write remote file |
||
202 | * @param string $fullPath Local file path |
||
203 | * @return bool True if success |
||
204 | */ |
||
205 | public function write($fullPath) |
||
225 | } |
||
226 |