Avoid some disk writes with checksums
This commit is contained in:
parent
66356bfd78
commit
bb0fb1dadd
|
@ -189,6 +189,18 @@ private function renderFeed(): self
|
|||
|
||||
foreach ($result as $path => $content) {
|
||||
$this->output->write(sprintf('Rendering <info>%s</info> as feed... ', $path));
|
||||
|
||||
if ($this->targetDisk->exists($path)) {
|
||||
$fileChecksum = $this->targetDisk->checksum($path);
|
||||
$contentChecksum = md5($content);
|
||||
|
||||
if ($fileChecksum === $contentChecksum) {
|
||||
$this->info('Not changed');
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->targetDisk->put($path, $content);
|
||||
$this->info('OK');
|
||||
}
|
||||
|
@ -230,6 +242,15 @@ private function handleBundle(Bundle $bundle, $progress)
|
|||
$path = Str::finish($path, '/') . 'index.html';
|
||||
}
|
||||
|
||||
if ($this->targetDisk->exists($path)) {
|
||||
$fileChecksum = $this->targetDisk->checksum($path);
|
||||
$contentChecksum = md5($content);
|
||||
|
||||
if ($fileChecksum !== $contentChecksum) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->targetDisk->put($path, $content);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user