public function ContentHasherEventSubscriber::writeSourceHash in Tome 8
Maintains a hash of exported content to support partial imports.
Parameters
\Drupal\tome_sync\Event\ContentCrudEvent $event: The content CRUD event.
File
- modules/
tome_sync/ src/ EventSubscriber/ ContentHasherEventSubscriber.php, line 68
Class
- ContentHasherEventSubscriber
- Event subscriber that keeps the content hash table up to date.
Namespace
Drupal\tome_sync\EventSubscriberCode
public function writeSourceHash(ContentCrudEvent $event) {
$entity = $event
->getContent();
$content_name = TomeSyncHelper::getContentName($entity);
$file_path = $this->contentStorage
->getFilePath($content_name);
if (file_exists($file_path)) {
$encoded_content = file_get_contents($file_path);
$this->contentHasher
->writeHash($encoded_content, $content_name);
}
}