Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
ng6
Commits
6646cb45
Commit
6646cb45
authored
Aug 13, 2018
by
Gerald Salin
Browse files
#21
parent
23e4ef57
Changes
1
Hide whitespace changes
Inline
Side-by-side
ui/nG6/lib/class.tx_nG6_utils.php
View file @
6646cb45
...
...
@@ -102,8 +102,24 @@ class tx_nG6_utils {
if
(
$directory
!=
'undefined'
&&
$directory
!=
''
)
{
// And process the directories structure
//TODO BUG NE RETOURNE PAS D'ERREUR si pas supprimer
if
(
!
ssh2_exec
(
$connection
,
'rm -rf '
.
$directory
.
"/"
))
{
$stream
=
ssh2_exec
(
$connection
,
'rm -rf '
.
$directory
.
"/"
);
$errorStream
=
ssh2_fetch_stream
(
$stream
,
SSH2_STREAM_STDERR
);
// Enable blocking for both streams
stream_set_blocking
(
$errorStream
,
true
);
stream_set_blocking
(
$stream
,
true
);
// Whichever of the two below commands is listed first will receive its appropriate output. The second command receives nothing
if
(
stream_get_contents
(
$errorStream
))
{
// Close the streams
fclose
(
$errorStream
);
fclose
(
$stream
);
return
1
;
}
else
{
// Close the streams
fclose
(
$errorStream
);
fclose
(
$stream
);
return
0
;
}
}
return
0
;
...
...
@@ -125,32 +141,32 @@ class tx_nG6_utils {
$connection
=
ssh2_connect
(
'127.0.0.1'
,
22
);
if
(
!
$connection
)
{
return
3
;
}
else
{
if
(
!
ssh2_auth_password
(
$connection
,
$user_login
,
$user_pwd
)){
return
2
;
}
else
{
$stream
=
ssh2_exec
(
$connection
,
'ls '
.
$directory
.
'/* | grep -v -e ".html$" -e ".png$" | xargs rm -f'
);
$errorStream
=
ssh2_fetch_stream
(
$stream
,
SSH2_STREAM_STDERR
);
// Enable blocking for both streams
stream_set_blocking
(
$errorStream
,
true
);
stream_set_blocking
(
$stream
,
true
);
}
if
(
!
ssh2_auth_password
(
$connection
,
$user_login
,
$user_pwd
)){
return
2
;
}
$stream
=
ssh2_exec
(
$connection
,
'ls '
.
$directory
.
'/* | grep -v -e ".html$" -e ".png$" | xargs rm -f'
);
$errorStream
=
ssh2_fetch_stream
(
$stream
,
SSH2_STREAM_STDERR
);
// Enable blocking for both streams
stream_set_blocking
(
$errorStream
,
true
);
stream_set_blocking
(
$stream
,
true
);
// Whichever of the two below commands is listed first will receive its appropriate output. The second command receives nothing
// Whichever of the two below commands is listed first will receive its appropriate output. The second command receives nothing
if
(
stream_get_contents
(
$errorStream
))
{
return
1
;
}
else
{
return
0
;
}
// Close the streams
fclose
(
$errorStream
);
fclose
(
$stream
);
}
if
(
stream_get_contents
(
$errorStream
))
{
// Close the streams
fclose
(
$errorStream
);
fclose
(
$stream
)
;
return
1
;
}
else
{
// Close the streams
fclose
(
$errorStream
);
fclose
(
$stream
);
return
0
;
}
}
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment