Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
file_sync
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
file_sync
Commits
2d8629a8
Commit
2d8629a8
authored
1 year ago
by
Borut Piletic
Browse files
Options
Downloads
Patches
Plain Diff
Rename method isSecure()
parent
df73d309
No related branches found
No related tags found
1 merge request
!15
SFTP support
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/FTPClient.php
+6
-6
6 additions, 6 deletions
src/FTPClient.php
src/FTPClientInterface.php
+1
-1
1 addition, 1 deletion
src/FTPClientInterface.php
with
7 additions
and
7 deletions
src/FTPClient.php
+
6
−
6
View file @
2d8629a8
...
...
@@ -66,7 +66,7 @@ class FTPClient implements FTPClientInterface {
$this
->
settings
=
$settings
;
}
if
(
$this
->
isSecure
())
{
if
(
$this
->
isSecure
Connection
())
{
$this
->
connection
=
new
SFTP
(
$this
->
settings
[
'advanced'
][
'hostname'
]);
if
(
!
$this
->
connection
->
login
(
$this
->
settings
[
'username'
],
$this
->
settings
[
'password'
]))
{
throw
new
\Exception
(
'Failed to connect to SFTP server.'
);
...
...
@@ -102,7 +102,7 @@ class FTPClient implements FTPClientInterface {
* {@inheritdoc}
*/
public
function
closeConnection
():
void
{
if
(
$this
->
isSecure
())
{
if
(
$this
->
isSecure
Connection
())
{
$this
->
connection
??
$this
->
connection
->
disconnect
();
}
else
{
...
...
@@ -114,7 +114,7 @@ class FTPClient implements FTPClientInterface {
* {@inheritdoc}
*/
public
function
list
(
string
$directory
=
'.'
,
bool
$fullpath
=
TRUE
):
array
{
$list
=
(
$this
->
isSecure
())
?
$this
->
connection
->
nlist
(
$directory
)
:
ftp_nlist
(
$this
->
connection
,
$directory
);
$list
=
(
$this
->
isSecure
Connection
())
?
$this
->
connection
->
nlist
(
$directory
)
:
ftp_nlist
(
$this
->
connection
,
$directory
);
if
(
!
$list
)
{
throw
new
\Exception
(
'Failed to list the FTP directory: '
.
$directory
);
}
...
...
@@ -138,7 +138,7 @@ class FTPClient implements FTPClientInterface {
throw
new
\Exception
(
'Could not create the destination path: '
.
$destination_path
);
}
if
(
$this
->
isSecure
())
{
if
(
$this
->
isSecure
Connection
())
{
return
$this
->
connection
->
get
(
$source_file
,
$destination_file
);
}
else
{
...
...
@@ -169,7 +169,7 @@ class FTPClient implements FTPClientInterface {
* {@inheritdoc}
*/
public
function
getDirectory
(
string
$source
,
string
$destination
):
void
{
if
(
$this
->
isSecure
())
{
if
(
$this
->
isSecure
Connection
())
{
throw
new
\Exception
(
"FTPClient::getDirectory() is not supported for SFTP connections."
);
}
...
...
@@ -277,7 +277,7 @@ class FTPClient implements FTPClientInterface {
/**
* {@inheritdoc}
*/
public
function
isSecure
():
bool
{
public
function
isSecure
Connection
():
bool
{
return
(
isset
(
$this
->
settings
[
'connection'
])
&&
$this
->
settings
[
'connection'
]
===
'sftp'
);
}
...
...
This diff is collapsed.
Click to expand it.
src/FTPClientInterface.php
+
1
−
1
View file @
2d8629a8
...
...
@@ -78,6 +78,6 @@ interface FTPClientInterface {
* @return bool
* TRUE if SFTP connection is being used, FALSE otherwise.
*/
public
function
isSecure
():
bool
;
public
function
isSecure
Connection
():
bool
;
}
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