Fix disk_free_space being called even when not available, fixes #10936
parent
f600ea46c7
commit
a481dfce3f
|
@ -162,11 +162,11 @@ class Cache
|
|||
unlink($tempFileName);
|
||||
|
||||
$message = sprintf(
|
||||
'<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
|
||||
'<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$s bytes of free space available</warning>',
|
||||
$tempFileName,
|
||||
$m[1],
|
||||
$m[2],
|
||||
@disk_free_space(dirname($tempFileName))
|
||||
function_exists('disk_free_space') ? @disk_free_space(dirname($tempFileName)) : 'unknown'
|
||||
);
|
||||
|
||||
$this->io->writeError($message);
|
||||
|
|
|
@ -370,6 +370,10 @@ EOT
|
|||
*/
|
||||
private function checkDiskSpace(Config $config)
|
||||
{
|
||||
if (!function_exists('disk_free_space')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$minSpaceFree = 1024 * 1024;
|
||||
if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|
||||
|| (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
|
||||
|
|
|
@ -386,7 +386,7 @@ class Application extends BaseApplication
|
|||
Silencer::suppress();
|
||||
try {
|
||||
$composer = $this->getComposer(false, true);
|
||||
if ($composer) {
|
||||
if (null !== $composer && function_exists('disk_free_space')) {
|
||||
$config = $composer->getConfig();
|
||||
|
||||
$minSpaceFree = 1024 * 1024;
|
||||
|
|
Loading…
Reference in New Issue