Fix require command crashing at the end if no lock file is present, fixes #11814
parent
bff129f4f5
commit
ef6c224ec2
|
@ -558,13 +558,15 @@ EOT
|
||||||
throw new \RuntimeException('Unable to read '.$this->json->getPath().' contents to update the lock file hash.');
|
throw new \RuntimeException('Unable to read '.$this->json->getPath().' contents to update the lock file hash.');
|
||||||
}
|
}
|
||||||
$lockFile = Factory::getLockFile($this->json->getPath());
|
$lockFile = Factory::getLockFile($this->json->getPath());
|
||||||
$lockMtime = filemtime($lockFile);
|
if (file_exists($lockFile)) {
|
||||||
$lock = new JsonFile($lockFile);
|
$lockMtime = filemtime($lockFile);
|
||||||
$lockData = $lock->read();
|
$lock = new JsonFile($lockFile);
|
||||||
$lockData['content-hash'] = Locker::getContentHash($contents);
|
$lockData = $lock->read();
|
||||||
$lock->write($lockData);
|
$lockData['content-hash'] = Locker::getContentHash($contents);
|
||||||
if (is_int($lockMtime)) {
|
$lock->write($lockData);
|
||||||
@touch($lockFile, $lockMtime);
|
if (is_int($lockMtime)) {
|
||||||
|
@touch($lockFile, $lockMtime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue