Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Projects
Groups
Snippets
Sign up now
Login
Sign in
Toggle navigation
Menu
Open sidebar
project
provision
Commits
7e5f4744
Commit
7e5f4744
authored
Sep 06, 2014
by
Grazyna Jaworska
Browse files
Use strict checks: is_file() and/or is_link() instead of file_exists() before attempting unlink()
parent
cbe26d01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Provision/FileSystem.php
View file @
7e5f4744
...
...
@@ -118,7 +118,7 @@ class Provision_FileSystem extends Provision_ChainedState {
function
unlink
(
$path
)
{
$this
->
_clear_state
();
if
(
file
_exists
(
$path
)
||
is_link
(
$path
))
{
if
(
is_
file
(
$path
)
||
is_link
(
$path
))
{
$this
->
last_status
=
unlink
(
$path
);
}
else
{
...
...
platform/provision_drupal.drush.inc
View file @
7e5f4744
...
...
@@ -806,7 +806,7 @@ function _provision_client_create_symlink() {
function
_provision_client_delete_old_symlink
()
{
$previous
=
d
()
->
server
->
clients_path
.
'/'
.
d
()
->
client_name
.
'/'
.
d
()
->
uri
;
// this is necessary because unlink doesn't fail on missing files (!)
$found
=
(
file
_exists
(
$previous
)
||
is_link
(
$previous
));
$found
=
(
is_
file
(
$previous
)
||
is_link
(
$previous
));
provision_file
()
->
unlink
(
$previous
);
if
(
!
$found
)
{
drush_log
(
dt
(
"couldn't find previous client symlink, iterating through all sites"
));
...
...
@@ -815,7 +815,7 @@ function _provision_client_delete_old_symlink() {
while
((
$file
=
readdir
(
$dh
))
!==
false
)
{
if
(
$file
!=
'.'
&&
$file
!=
'..'
)
{
$path
=
d
()
->
server
->
clients_path
.
'/'
.
$file
.
'/'
.
d
()
->
uri
;
if
(
file
_exists
(
$path
)
||
is_link
(
$path
))
{
if
(
is_
file
(
$path
)
||
is_link
(
$path
))
{
provision_file
()
->
unlink
(
$path
);
drush_log
(
dt
(
"removed previous symlink in @path"
,
array
(
"@path"
=>
$path
)),
'success'
);
break
;
// found it
...
...
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