Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
a27753dd
Commit
a27753dd
authored
10 years ago
by
Andreas Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Pass existing Net_SFTP object into Net_SFTP_Stream.
parent
6c28c9b1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_external/lib/sftp.php
+9
-3
9 additions, 3 deletions
apps/files_external/lib/sftp.php
with
9 additions
and
3 deletions
apps/files_external/lib/sftp.php
+
9
−
3
View file @
a27753dd
...
...
@@ -17,6 +17,9 @@ class SFTP extends \OC\Files\Storage\Common {
private
$password
;
private
$root
;
/**
* @var \Net_SFTP
*/
private
$client
;
private
static
$tempFiles
=
array
();
...
...
@@ -231,8 +234,8 @@ class SFTP extends \OC\Files\Storage\Common {
case
'x+'
:
case
'c'
:
case
'c+'
:
// FIXME: make client login lazy to prevent it when using fopen()
return
fopen
(
$this
->
constructUrl
(
$path
),
$mode
);
$context
=
stream_context_create
(
array
(
'sftp'
=>
array
(
'session'
=>
$this
->
client
)));
return
fopen
(
$this
->
constructUrl
(
$path
),
$mode
,
false
,
$context
);
}
}
catch
(
\Exception
$e
)
{
}
...
...
@@ -294,7 +297,10 @@ class SFTP extends \OC\Files\Storage\Common {
* @param string $path
*/
public
function
constructUrl
(
$path
)
{
$url
=
'sftp://'
.
$this
->
user
.
':'
.
$this
->
password
.
'@'
.
$this
->
host
.
$this
->
root
.
$path
;
// Do not pass the password here. We want to use the Net_SFTP object
// supplied via stream context or fail. We only supply username and
// hostname because this might show up in logs (they are not used).
$url
=
'sftp://'
.
$this
->
user
.
'@'
.
$this
->
host
.
$this
->
root
.
$path
;
return
$url
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment