1
0
Fork 0

Merge pull request #5057 from curry684/issue-5053

Ensure stat cache is cleared for junctions
pull/5058/head
Jordi Boggiano 2016-03-14 11:34:00 +00:00
commit 24f04f7dbf
1 changed files with 5 additions and 0 deletions

View File

@ -613,6 +613,7 @@ class Filesystem
if ($this->getProcess()->execute($cmd, $output) !== 0) { if ($this->getProcess()->execute($cmd, $output) !== 0) {
throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target); throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
} }
clearstatcache(true, $junction);
} }
/** /**
@ -637,7 +638,10 @@ class Filesystem
* *
* #define _S_IFDIR 0x4000 * #define _S_IFDIR 0x4000
* #define _S_IFREG 0x8000 * #define _S_IFREG 0x8000
*
* Stat cache should be cleared before to avoid accidentally reading wrong information from previous installs.
*/ */
clearstatcache(true, $junction);
$stat = lstat($junction); $stat = lstat($junction);
return !($stat['mode'] & 0xC000); return !($stat['mode'] & 0xC000);
@ -659,6 +663,7 @@ class Filesystem
throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction)); throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
} }
$cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction)); $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
clearstatcache(true, $junction);
return ($this->getProcess()->execute($cmd, $output) === 0); return ($this->getProcess()->execute($cmd, $output) === 0);
} }