Rev 846 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 846 | Rev 874 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | * |
5 | * |
6 | * Creates an sftp:// protocol handler that can be used with, for example, fopen(), dir(), etc. |
6 | * Creates an sftp:// protocol handler that can be used with, for example, fopen(), dir(), etc. |
7 | * |
7 | * |
8 | * PHP version 5 |
8 | * PHP version 5 |
9 | * |
9 | * |
- | 10 | * @category Net |
|
- | 11 | * @package SFTP |
|
10 | * @author Jim Wigginton <terrafrost@php.net> |
12 | * @author Jim Wigginton <terrafrost@php.net> |
11 | * @copyright 2013 Jim Wigginton |
13 | * @copyright 2013 Jim Wigginton |
12 | * @license http://www.opensource.org/licenses/mit-license.html MIT License |
14 | * @license http://www.opensource.org/licenses/mit-license.html MIT License |
13 | * @link http://phpseclib.sourceforge.net |
15 | * @link http://phpseclib.sourceforge.net |
14 | */ |
16 | */ |
Line 16... | Line 18... | ||
16 | namespace phpseclib3\Net\SFTP; |
18 | namespace phpseclib3\Net\SFTP; |
17 | 19 | ||
18 | use phpseclib3\Crypt\Common\PrivateKey; |
20 | use phpseclib3\Crypt\Common\PrivateKey; |
19 | use phpseclib3\Net\SFTP; |
21 | use phpseclib3\Net\SFTP; |
20 | use phpseclib3\Net\SSH2; |
22 | use phpseclib3\Net\SSH2; |
21 | use phpseclib3\Net\SSH2\MessageType as SSH2MessageType; |
- | |
22 | 23 | ||
23 | /** |
24 | /** |
24 | * SFTP Stream Wrapper |
25 | * SFTP Stream Wrapper |
25 | * |
26 | * |
- | 27 | * @package SFTP |
|
26 | * @author Jim Wigginton <terrafrost@php.net> |
28 | * @author Jim Wigginton <terrafrost@php.net> |
- | 29 | * @access public |
|
27 | */ |
30 | */ |
28 | class Stream |
31 | class Stream |
29 | { |
32 | { |
30 | /** |
33 | /** |
31 | * SFTP instances |
34 | * SFTP instances |
Line 38... | Line 41... | ||
38 | 41 | ||
39 | /** |
42 | /** |
40 | * SFTP instance |
43 | * SFTP instance |
41 | * |
44 | * |
42 | * @var object |
45 | * @var object |
- | 46 | * @access private |
|
43 | */ |
47 | */ |
44 | private $sftp; |
48 | private $sftp; |
45 | 49 | ||
46 | /** |
50 | /** |
47 | * Path |
51 | * Path |
48 | * |
52 | * |
49 | * @var string |
53 | * @var string |
- | 54 | * @access private |
|
50 | */ |
55 | */ |
51 | private $path; |
56 | private $path; |
52 | 57 | ||
53 | /** |
58 | /** |
54 | * Mode |
59 | * Mode |
55 | * |
60 | * |
56 | * @var string |
61 | * @var string |
- | 62 | * @access private |
|
57 | */ |
63 | */ |
58 | private $mode; |
64 | private $mode; |
59 | 65 | ||
60 | /** |
66 | /** |
61 | * Position |
67 | * Position |
62 | * |
68 | * |
63 | * @var int |
69 | * @var int |
- | 70 | * @access private |
|
64 | */ |
71 | */ |
65 | private $pos; |
72 | private $pos; |
66 | 73 | ||
67 | /** |
74 | /** |
68 | * Size |
75 | * Size |
69 | * |
76 | * |
70 | * @var int |
77 | * @var int |
- | 78 | * @access private |
|
71 | */ |
79 | */ |
72 | private $size; |
80 | private $size; |
73 | 81 | ||
74 | /** |
82 | /** |
75 | * Directory entries |
83 | * Directory entries |
76 | * |
84 | * |
77 | * @var array |
85 | * @var array |
- | 86 | * @access private |
|
78 | */ |
87 | */ |
79 | private $entries; |
88 | private $entries; |
80 | 89 | ||
81 | /** |
90 | /** |
82 | * EOF flag |
91 | * EOF flag |
83 | * |
92 | * |
84 | * @var bool |
93 | * @var bool |
- | 94 | * @access private |
|
85 | */ |
95 | */ |
86 | private $eof; |
96 | private $eof; |
87 | 97 | ||
88 | /** |
98 | /** |
89 | * Context resource |
99 | * Context resource |
90 | * |
100 | * |
91 | * Technically this needs to be publicly accessible so PHP can set it directly |
101 | * Technically this needs to be publicly accessible so PHP can set it directly |
92 | * |
102 | * |
93 | * @var resource |
103 | * @var resource |
- | 104 | * @access public |
|
94 | */ |
105 | */ |
95 | public $context; |
106 | public $context; |
96 | 107 | ||
97 | /** |
108 | /** |
98 | * Notification callback function |
109 | * Notification callback function |
99 | * |
110 | * |
100 | * @var callable |
111 | * @var callable |
- | 112 | * @access public |
|
101 | */ |
113 | */ |
102 | private $notification; |
114 | private $notification; |
103 | 115 | ||
104 | /** |
116 | /** |
105 | * Registers this class as a URL wrapper. |
117 | * Registers this class as a URL wrapper. |
106 | * |
118 | * |
107 | * @param string $protocol The wrapper name to be registered. |
119 | * @param string $protocol The wrapper name to be registered. |
108 | * @return bool True on success, false otherwise. |
120 | * @return bool True on success, false otherwise. |
- | 121 | * @access public |
|
109 | */ |
122 | */ |
110 | public static function register($protocol = 'sftp') |
123 | public static function register($protocol = 'sftp') |
111 | { |
124 | { |
112 | if (in_array($protocol, stream_get_wrappers(), true)) { |
125 | if (in_array($protocol, stream_get_wrappers(), true)) { |
113 | return false; |
126 | return false; |
Line 116... | Line 129... | ||
116 | } |
129 | } |
117 | 130 | ||
118 | /** |
131 | /** |
119 | * The Constructor |
132 | * The Constructor |
120 | * |
133 | * |
- | 134 | * @access public |
|
121 | */ |
135 | */ |
122 | public function __construct() |
136 | public function __construct() |
123 | { |
137 | { |
124 | if (defined('NET_SFTP_STREAM_LOGGING')) { |
138 | if (defined('NET_SFTP_STREAM_LOGGING')) { |
125 | echo "__construct()\r\n"; |
139 | echo "__construct()\r\n"; |
Line 130... | Line 144... | ||
130 | * Path Parser |
144 | * Path Parser |
131 | * |
145 | * |
132 | * Extract a path from a URI and actually connect to an SSH server if appropriate |
146 | * Extract a path from a URI and actually connect to an SSH server if appropriate |
133 | * |
147 | * |
134 | * If "notification" is set as a context parameter the message code for successful login is |
148 | * If "notification" is set as a context parameter the message code for successful login is |
135 | * SSHMsg::USERAUTH_SUCCESS. For a failed login it's SSHMsg::USERAUTH_FAILURE. |
149 | * NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE. |
136 | * |
150 | * |
137 | * @param string $path |
151 | * @param string $path |
138 | * @return string |
152 | * @return string |
- | 153 | * @access private |
|
139 | */ |
154 | */ |
140 | protected function parse_path($path) |
155 | protected function parse_path($path) |
141 | { |
156 | { |
142 | $orig = $path; |
157 | $orig = $path; |
143 | extract(parse_url($path) + ['port' => 22]); |
158 | extract(parse_url($path) + ['port' => 22]); |
Line 214... | Line 229... | ||
214 | user_error is on. |
229 | user_error is on. |
215 | */ |
230 | */ |
216 | call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); |
231 | call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); |
217 | call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); |
232 | call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); |
218 | if (!$this->sftp->login($user, $pass)) { |
233 | if (!$this->sftp->login($user, $pass)) { |
219 | call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', SSH2MessageType::USERAUTH_FAILURE, 0, 0); |
234 | call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0); |
220 | return false; |
235 | return false; |
221 | } |
236 | } |
222 | call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', SSH2MessageType::USERAUTH_SUCCESS, 0, 0); |
237 | call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0); |
223 | } else { |
238 | } else { |
224 | if (!$this->sftp->login($user, $pass)) { |
239 | if (!$this->sftp->login($user, $pass)) { |
225 | return false; |
240 | return false; |
226 | } |
241 | } |
227 | } |
242 | } |
Line 238... | Line 253... | ||
238 | * @param string $path |
253 | * @param string $path |
239 | * @param string $mode |
254 | * @param string $mode |
240 | * @param int $options |
255 | * @param int $options |
241 | * @param string $opened_path |
256 | * @param string $opened_path |
242 | * @return bool |
257 | * @return bool |
- | 258 | * @access public |
|
243 | */ |
259 | */ |
244 | private function _stream_open($path, $mode, $options, &$opened_path) |
260 | private function _stream_open($path, $mode, $options, &$opened_path) |
245 | { |
261 | { |
246 | $path = $this->parse_path($path); |
262 | $path = $this->parse_path($path); |
247 | 263 | ||
Line 279... | Line 295... | ||
279 | /** |
295 | /** |
280 | * Read from stream |
296 | * Read from stream |
281 | * |
297 | * |
282 | * @param int $count |
298 | * @param int $count |
283 | * @return mixed |
299 | * @return mixed |
- | 300 | * @access public |
|
284 | */ |
301 | */ |
285 | private function _stream_read($count) |
302 | private function _stream_read($count) |
286 | { |
303 | { |
287 | switch ($this->mode) { |
304 | switch ($this->mode) { |
288 | case 'w': |
305 | case 'w': |
Line 299... | Line 316... | ||
299 | //} |
316 | //} |
300 | 317 | ||
301 | $result = $this->sftp->get($this->path, false, $this->pos, $count); |
318 | $result = $this->sftp->get($this->path, false, $this->pos, $count); |
302 | if (isset($this->notification) && is_callable($this->notification)) { |
319 | if (isset($this->notification) && is_callable($this->notification)) { |
303 | if ($result === false) { |
320 | if ($result === false) { |
304 | call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), PacketType::OPEN, 0, 0); |
321 | call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0); |
305 | return 0; |
322 | return 0; |
306 | } |
323 | } |
307 | // seems that PHP calls stream_read in 8k chunks |
324 | // seems that PHP calls stream_read in 8k chunks |
308 | call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size); |
325 | call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size); |
309 | } |
326 | } |
Line 320... | Line 337... | ||
320 | /** |
337 | /** |
321 | * Write to stream |
338 | * Write to stream |
322 | * |
339 | * |
323 | * @param string $data |
340 | * @param string $data |
324 | * @return int|false |
341 | * @return int|false |
- | 342 | * @access public |
|
325 | */ |
343 | */ |
326 | private function _stream_write($data) |
344 | private function _stream_write($data) |
327 | { |
345 | { |
328 | switch ($this->mode) { |
346 | switch ($this->mode) { |
329 | case 'r': |
347 | case 'r': |
Line 331... | Line 349... | ||
331 | } |
349 | } |
332 | 350 | ||
333 | $result = $this->sftp->put($this->path, $data, SFTP::SOURCE_STRING, $this->pos); |
351 | $result = $this->sftp->put($this->path, $data, SFTP::SOURCE_STRING, $this->pos); |
334 | if (isset($this->notification) && is_callable($this->notification)) { |
352 | if (isset($this->notification) && is_callable($this->notification)) { |
335 | if (!$result) { |
353 | if (!$result) { |
336 | call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), PacketType::OPEN, 0, 0); |
354 | call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0); |
337 | return 0; |
355 | return 0; |
338 | } |
356 | } |
339 | // seems that PHP splits up strings into 8k blocks before calling stream_write |
357 | // seems that PHP splits up strings into 8k blocks before calling stream_write |
340 | call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data)); |
358 | call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data)); |
341 | } |
359 | } |
Line 353... | Line 371... | ||
353 | 371 | ||
354 | /** |
372 | /** |
355 | * Retrieve the current position of a stream |
373 | * Retrieve the current position of a stream |
356 | * |
374 | * |
357 | * @return int |
375 | * @return int |
- | 376 | * @access public |
|
358 | */ |
377 | */ |
359 | private function _stream_tell() |
378 | private function _stream_tell() |
360 | { |
379 | { |
361 | return $this->pos; |
380 | return $this->pos; |
362 | } |
381 | } |
Line 370... | Line 389... | ||
370 | * Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof() |
389 | * Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof() |
371 | * will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof() |
390 | * will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof() |
372 | * will return false. do fread($fp, 1) and feof() will then return true. |
391 | * will return false. do fread($fp, 1) and feof() will then return true. |
373 | * |
392 | * |
374 | * @return bool |
393 | * @return bool |
- | 394 | * @access public |
|
375 | */ |
395 | */ |
376 | private function _stream_eof() |
396 | private function _stream_eof() |
377 | { |
397 | { |
378 | return $this->eof; |
398 | return $this->eof; |
379 | } |
399 | } |
Line 382... | Line 402... | ||
382 | * Seeks to specific location in a stream |
402 | * Seeks to specific location in a stream |
383 | * |
403 | * |
384 | * @param int $offset |
404 | * @param int $offset |
385 | * @param int $whence |
405 | * @param int $whence |
386 | * @return bool |
406 | * @return bool |
- | 407 | * @access public |
|
387 | */ |
408 | */ |
388 | private function _stream_seek($offset, $whence) |
409 | private function _stream_seek($offset, $whence) |
389 | { |
410 | { |
390 | switch ($whence) { |
411 | switch ($whence) { |
391 | case SEEK_SET: |
412 | case SEEK_SET: |
Line 410... | Line 431... | ||
410 | * |
431 | * |
411 | * @param string $path |
432 | * @param string $path |
412 | * @param int $option |
433 | * @param int $option |
413 | * @param mixed $var |
434 | * @param mixed $var |
414 | * @return bool |
435 | * @return bool |
- | 436 | * @access public |
|
415 | */ |
437 | */ |
416 | private function _stream_metadata($path, $option, $var) |
438 | private function _stream_metadata($path, $option, $var) |
417 | { |
439 | { |
418 | $path = $this->parse_path($path); |
440 | $path = $this->parse_path($path); |
419 | if ($path === false) { |
441 | if ($path === false) { |
Line 443... | Line 465... | ||
443 | /** |
465 | /** |
444 | * Retrieve the underlaying resource |
466 | * Retrieve the underlaying resource |
445 | * |
467 | * |
446 | * @param int $cast_as |
468 | * @param int $cast_as |
447 | * @return resource |
469 | * @return resource |
- | 470 | * @access public |
|
448 | */ |
471 | */ |
449 | private function _stream_cast($cast_as) |
472 | private function _stream_cast($cast_as) |
450 | { |
473 | { |
451 | return $this->sftp->fsock; |
474 | return $this->sftp->fsock; |
452 | } |
475 | } |
Line 454... | Line 477... | ||
454 | /** |
477 | /** |
455 | * Advisory file locking |
478 | * Advisory file locking |
456 | * |
479 | * |
457 | * @param int $operation |
480 | * @param int $operation |
458 | * @return bool |
481 | * @return bool |
- | 482 | * @access public |
|
459 | */ |
483 | */ |
460 | private function _stream_lock($operation) |
484 | private function _stream_lock($operation) |
461 | { |
485 | { |
462 | return false; |
486 | return false; |
463 | } |
487 | } |
Line 470... | Line 494... | ||
470 | * does. |
494 | * does. |
471 | * |
495 | * |
472 | * @param string $path_from |
496 | * @param string $path_from |
473 | * @param string $path_to |
497 | * @param string $path_to |
474 | * @return bool |
498 | * @return bool |
- | 499 | * @access public |
|
475 | */ |
500 | */ |
476 | private function _rename($path_from, $path_to) |
501 | private function _rename($path_from, $path_to) |
477 | { |
502 | { |
478 | $path1 = parse_url($path_from); |
503 | $path1 = parse_url($path_from); |
479 | $path2 = parse_url($path_to); |
504 | $path2 = parse_url($path_to); |
Line 521... | Line 546... | ||
521 | * ATTRS attrs |
546 | * ATTRS attrs |
522 | * |
547 | * |
523 | * @param string $path |
548 | * @param string $path |
524 | * @param int $options |
549 | * @param int $options |
525 | * @return bool |
550 | * @return bool |
- | 551 | * @access public |
|
526 | */ |
552 | */ |
527 | private function _dir_opendir($path, $options) |
553 | private function _dir_opendir($path, $options) |
528 | { |
554 | { |
529 | $path = $this->parse_path($path); |
555 | $path = $this->parse_path($path); |
530 | if ($path === false) { |
556 | if ($path === false) { |
Line 537... | Line 563... | ||
537 | 563 | ||
538 | /** |
564 | /** |
539 | * Read entry from directory handle |
565 | * Read entry from directory handle |
540 | * |
566 | * |
541 | * @return mixed |
567 | * @return mixed |
- | 568 | * @access public |
|
542 | */ |
569 | */ |
543 | private function _dir_readdir() |
570 | private function _dir_readdir() |
544 | { |
571 | { |
545 | if (isset($this->entries[$this->pos])) { |
572 | if (isset($this->entries[$this->pos])) { |
546 | return $this->entries[$this->pos++]; |
573 | return $this->entries[$this->pos++]; |
Line 550... | Line 577... | ||
550 | 577 | ||
551 | /** |
578 | /** |
552 | * Rewind directory handle |
579 | * Rewind directory handle |
553 | * |
580 | * |
554 | * @return bool |
581 | * @return bool |
- | 582 | * @access public |
|
555 | */ |
583 | */ |
556 | private function _dir_rewinddir() |
584 | private function _dir_rewinddir() |
557 | { |
585 | { |
558 | $this->pos = 0; |
586 | $this->pos = 0; |
559 | return true; |
587 | return true; |
Line 561... | Line 589... | ||
561 | 589 | ||
562 | /** |
590 | /** |
563 | * Close directory handle |
591 | * Close directory handle |
564 | * |
592 | * |
565 | * @return bool |
593 | * @return bool |
- | 594 | * @access public |
|
566 | */ |
595 | */ |
567 | private function _dir_closedir() |
596 | private function _dir_closedir() |
568 | { |
597 | { |
569 | return true; |
598 | return true; |
570 | } |
599 | } |
Line 576... | Line 605... | ||
576 | * |
605 | * |
577 | * @param string $path |
606 | * @param string $path |
578 | * @param int $mode |
607 | * @param int $mode |
579 | * @param int $options |
608 | * @param int $options |
580 | * @return bool |
609 | * @return bool |
- | 610 | * @access public |
|
581 | */ |
611 | */ |
582 | private function _mkdir($path, $mode, $options) |
612 | private function _mkdir($path, $mode, $options) |
583 | { |
613 | { |
584 | $path = $this->parse_path($path); |
614 | $path = $this->parse_path($path); |
585 | if ($path === false) { |
615 | if ($path === false) { |
Line 598... | Line 628... | ||
598 | * $options. What does 8 correspond to? |
628 | * $options. What does 8 correspond to? |
599 | * |
629 | * |
600 | * @param string $path |
630 | * @param string $path |
601 | * @param int $options |
631 | * @param int $options |
602 | * @return bool |
632 | * @return bool |
- | 633 | * @access public |
|
603 | */ |
634 | */ |
604 | private function _rmdir($path, $options) |
635 | private function _rmdir($path, $options) |
605 | { |
636 | { |
606 | $path = $this->parse_path($path); |
637 | $path = $this->parse_path($path); |
607 | if ($path === false) { |
638 | if ($path === false) { |
Line 615... | Line 646... | ||
615 | * Flushes the output |
646 | * Flushes the output |
616 | * |
647 | * |
617 | * See <http://php.net/fflush>. Always returns true because \phpseclib3\Net\SFTP doesn't cache stuff before writing |
648 | * See <http://php.net/fflush>. Always returns true because \phpseclib3\Net\SFTP doesn't cache stuff before writing |
618 | * |
649 | * |
619 | * @return bool |
650 | * @return bool |
- | 651 | * @access public |
|
620 | */ |
652 | */ |
621 | private function _stream_flush() |
653 | private function _stream_flush() |
622 | { |
654 | { |
623 | return true; |
655 | return true; |
624 | } |
656 | } |
625 | 657 | ||
626 | /** |
658 | /** |
627 | * Retrieve information about a file resource |
659 | * Retrieve information about a file resource |
628 | * |
660 | * |
629 | * @return mixed |
661 | * @return mixed |
- | 662 | * @access public |
|
630 | */ |
663 | */ |
631 | private function _stream_stat() |
664 | private function _stream_stat() |
632 | { |
665 | { |
633 | $results = $this->sftp->stat($this->path); |
666 | $results = $this->sftp->stat($this->path); |
634 | if ($results === false) { |
667 | if ($results === false) { |
Line 640... | Line 673... | ||
640 | /** |
673 | /** |
641 | * Delete a file |
674 | * Delete a file |
642 | * |
675 | * |
643 | * @param string $path |
676 | * @param string $path |
644 | * @return bool |
677 | * @return bool |
- | 678 | * @access public |
|
645 | */ |
679 | */ |
646 | private function _unlink($path) |
680 | private function _unlink($path) |
647 | { |
681 | { |
648 | $path = $this->parse_path($path); |
682 | $path = $this->parse_path($path); |
649 | if ($path === false) { |
683 | if ($path === false) { |
Line 661... | Line 695... | ||
661 | * cross that bridge when and if it's reached |
695 | * cross that bridge when and if it's reached |
662 | * |
696 | * |
663 | * @param string $path |
697 | * @param string $path |
664 | * @param int $flags |
698 | * @param int $flags |
665 | * @return mixed |
699 | * @return mixed |
- | 700 | * @access public |
|
666 | */ |
701 | */ |
667 | private function _url_stat($path, $flags) |
702 | private function _url_stat($path, $flags) |
668 | { |
703 | { |
669 | $path = $this->parse_path($path); |
704 | $path = $this->parse_path($path); |
670 | if ($path === false) { |
705 | if ($path === false) { |
Line 682... | Line 717... | ||
682 | /** |
717 | /** |
683 | * Truncate stream |
718 | * Truncate stream |
684 | * |
719 | * |
685 | * @param int $new_size |
720 | * @param int $new_size |
686 | * @return bool |
721 | * @return bool |
- | 722 | * @access public |
|
687 | */ |
723 | */ |
688 | private function _stream_truncate($new_size) |
724 | private function _stream_truncate($new_size) |
689 | { |
725 | { |
690 | if (!$this->sftp->truncate($this->path, $new_size)) { |
726 | if (!$this->sftp->truncate($this->path, $new_size)) { |
691 | return false; |
727 | return false; |
Line 705... | Line 741... | ||
705 | * |
741 | * |
706 | * @param int $option |
742 | * @param int $option |
707 | * @param int $arg1 |
743 | * @param int $arg1 |
708 | * @param int $arg2 |
744 | * @param int $arg2 |
709 | * @return bool |
745 | * @return bool |
- | 746 | * @access public |
|
710 | */ |
747 | */ |
711 | private function _stream_set_option($option, $arg1, $arg2) |
748 | private function _stream_set_option($option, $arg1, $arg2) |
712 | { |
749 | { |
713 | return false; |
750 | return false; |
714 | } |
751 | } |
715 | 752 | ||
716 | /** |
753 | /** |
717 | * Close an resource |
754 | * Close an resource |
718 | * |
755 | * |
- | 756 | * @access public |
|
719 | */ |
757 | */ |
720 | private function _stream_close() |
758 | private function _stream_close() |
721 | { |
759 | { |
722 | } |
760 | } |
723 | 761 | ||
Line 732... | Line 770... | ||
732 | * NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method. |
770 | * NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method. |
733 | * |
771 | * |
734 | * @param string $name |
772 | * @param string $name |
735 | * @param array $arguments |
773 | * @param array $arguments |
736 | * @return mixed |
774 | * @return mixed |
- | 775 | * @access public |
|
737 | */ |
776 | */ |
738 | public function __call($name, $arguments) |
777 | public function __call($name, $arguments) |
739 | { |
778 | { |
740 | if (defined('NET_SFTP_STREAM_LOGGING')) { |
779 | if (defined('NET_SFTP_STREAM_LOGGING')) { |
741 | echo $name . '('; |
780 | echo $name . '('; |