Commit 2ab6621c authored by samuel.mortenson's avatar samuel.mortenson Committed by Sam Mortenson

Issue #3054218 by samuel.mortenson, jigish.addweb: Replace deprecated code

parent f83bb2b9
......@@ -3,7 +3,7 @@
namespace Drupal\Tests\tome_base\Kernel;
use Drupal\Core\Site\Settings;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\NodeType;
......
......@@ -31,6 +31,11 @@ class TomeStaticCronTest extends BrowserTestBase {
'node',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
......@@ -101,7 +106,7 @@ class TomeStaticCronTest extends BrowserTestBase {
$this->cronRun();
$this->assertFileExists($filename);
$this->assertFileExists($image_filename);
$this->assertContains('Test node', file_get_contents($filename));
$this->assertStringContainsString('Test node', file_get_contents($filename));
}
}
......@@ -5,6 +5,7 @@ namespace Drupal\tome_static\Controller;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Archiver\ArchiveTar;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Url;
use Drupal\tome_static\StaticGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -25,14 +26,24 @@ class StaticDownloadController extends ControllerBase {
*/
protected $static;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* StaticGeneratorForm constructor.
*
* @param \Drupal\tome_static\StaticGeneratorInterface $static
* The static generator.
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(StaticGeneratorInterface $static) {
public function __construct(StaticGeneratorInterface $static, FileSystemInterface $file_system) {
$this->static = $static;
$this->fileSystem = $file_system;
}
/**
......@@ -40,7 +51,8 @@ class StaticDownloadController extends ControllerBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('tome_static.generator')
$container->get('tome_static.generator'),
$container->get('file_system')
);
}
......@@ -79,9 +91,9 @@ class StaticDownloadController extends ControllerBase {
* Downloads a tarball of the static build.
*/
public function download() {
$path = file_directory_temp() . '/tome_static_export.tar.gz';
$path = $this->fileSystem->getTempDirectory() . '/tome_static_export.tar.gz';
$static_directory = $this->static->getStaticDirectory();
file_unmanaged_delete($path);
$this->fileSystem->delete($path);
$archiver = new ArchiveTar($path, 'gz');
$archiver->addModify([$static_directory], '', $static_directory);
......
......@@ -3,6 +3,7 @@
namespace Drupal\tome_static;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\File\Exception\FileException;
use Drupal\Core\Session\AccountSwitcherInterface;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Site\Settings;
......@@ -20,6 +21,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Drupal\Core\File\FileSystemInterface;
/**
* Handles static site generation.
......@@ -65,6 +67,13 @@ class StaticGenerator implements StaticGeneratorInterface {
*/
protected $accountSwitcher;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* The request stack.
*
......@@ -85,14 +94,18 @@ class StaticGenerator implements StaticGeneratorInterface {
* The static cache.
* @param \Drupal\Core\Session\AccountSwitcherInterface $account_switcher
* The account switcher.
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(HttpKernelInterface $http_kernel, RequestStack $request_stack, EventDispatcherInterface $event_dispatcher, StaticCacheInterface $cache, AccountSwitcherInterface $account_switcher) {
public function __construct(HttpKernelInterface $http_kernel, RequestStack $request_stack, EventDispatcherInterface $event_dispatcher, StaticCacheInterface $cache, AccountSwitcherInterface $account_switcher, FileSystemInterface $file_system) {
$this->httpKernel = $http_kernel;
$this->currentRequest = $request_stack->getCurrentRequest();
$this->eventDispatcher = $event_dispatcher;
$this->cache = $cache;
$this->accountSwitcher = $account_switcher;
$this->requestStack = $request_stack;
$this->fileSystem = $file_system;
}
/**
......@@ -114,7 +127,7 @@ class StaticGenerator implements StaticGeneratorInterface {
*/
public function cleanupStaticDirectory() {
foreach ($this->cache->getExpiredFiles() as $file) {
file_unmanaged_delete($file);
$this->fileSystem->delete($file);
}
}
......@@ -155,7 +168,7 @@ class StaticGenerator implements StaticGeneratorInterface {
$destination = $this->getDestination($path);
if ($response->isRedirection() || $response->isOk()) {
$directory = dirname($destination);
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
// This is probably an image style derivative.
if ($response instanceof BinaryFileResponse) {
$file_path = $response->getFile()->getPathname();
......@@ -233,11 +246,22 @@ class StaticGenerator implements StaticGeneratorInterface {
public function prepareStaticDirectory() {
$directory = $this->getStaticDirectory();
if ($this->cache->isCacheEmpty()) {
if (file_exists($directory) && !file_unmanaged_delete_recursive($directory)) {
return FALSE;
if (file_exists($directory)) {
try {
$this->fileSystem->deleteRecursive($directory);
}
catch (FileException $e) {
return FALSE;
}
}
}
return file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
try {
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
}
catch (FileException $e) {
return FALSE;
}
return TRUE;
}
/**
......@@ -503,8 +527,8 @@ class StaticGenerator implements StaticGeneratorInterface {
}
if (file_exists($path)) {
$directory = dirname($destination);
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
file_unmanaged_copy($path, $destination, FILE_EXISTS_REPLACE);
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
$this->fileSystem->copy($path, $destination, FileSystemInterface::CREATE_DIRECTORY);
return TRUE;
}
return FALSE;
......
complex_page:
version: VERSION
version: 1
js:
js/complex.js: {}
css:
......
......@@ -31,6 +31,11 @@ class TomeStaticGeneratorFormTest extends BrowserTestBase {
'node',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
......@@ -103,7 +108,7 @@ class TomeStaticGeneratorFormTest extends BrowserTestBase {
$this->assertFileExists($filename);
$this->assertFileExists($image_filename);
$this->assertContains('Test node', file_get_contents($filename));
$this->assertStringContainsString('Test node', file_get_contents($filename));
}
}
......@@ -2,6 +2,7 @@
namespace Drupal\Tests\tome_static\Functional;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Tests\BrowserTestBase;
/**
......@@ -18,6 +19,11 @@ class TomeStaticPreviewTest extends BrowserTestBase {
*/
public static $modules = ['tome_static'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the static preview.
*/
......@@ -31,7 +37,7 @@ class TomeStaticPreviewTest extends BrowserTestBase {
$this->drupalLogin($this->createUser(['use tome static']));
$directory .= '/foo';
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
\Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
file_put_contents($directory . '/index.html', '<html><body>Hello world!</body></html>');
$this->drupalGet('/admin/config/tome/static/preview');
......
......@@ -89,8 +89,8 @@ class StaticGeneratorTest extends TestBase {
$static->requestPath('_entity:node:fr:1');
$this->assertFileExists("$base_dir/french/node/1/index.html");
file_unmanaged_delete("$base_dir/node/1/index.html");
file_unmanaged_delete("$base_dir/french/node/1/index.html");
\Drupal::service('file_system')->delete("$base_dir/node/1/index.html");
\Drupal::service('file_system')->delete("$base_dir/french/node/1/index.html");
$article->setUnpublished();
$article->save();
\Drupal::entityTypeManager()->getAccessControlHandler('node')->resetCache();
......@@ -195,7 +195,7 @@ class StaticGeneratorTest extends TestBase {
$static = \Drupal::service('tome_static.generator');
$static->requestPath('/tome-test/page');
$this->assertContains('Hello, world', file_get_contents(Settings::get('tome_static_directory') . '/tome-test/page/index.html'));
$this->assertStringContainsString('Hello, world', file_get_contents(Settings::get('tome_static_directory') . '/tome-test/page/index.html'));
}
/**
......@@ -212,6 +212,7 @@ class StaticGeneratorTest extends TestBase {
$invoke_paths = $static->requestPath('/tome-test/complex-page');
$module_path = drupal_get_path('module', 'tome_test');
$base_dir = Settings::get('tome_static_directory');
$this->assertContains("/$module_path/assets/srcset-test1.png", $invoke_paths);
$this->assertContains("/$module_path/assets/srcset-test2.png", $invoke_paths);
......@@ -222,21 +223,19 @@ class StaticGeneratorTest extends TestBase {
$this->assertNotContains('http://www.google.com/external/path', $invoke_paths);
$this->assertContains('/path/with/destination?bar=baz', $invoke_paths);
$this->assertContains('/random/iframe', $invoke_paths);
$this->assertContains('/core/assets/vendor/html5shiv/html5shiv.min.js?v=3.7.3', $invoke_paths);
$this->assertContains("/$module_path/js/complex.js?v=1", $invoke_paths);
$this->assertContains('/use.svg', $invoke_paths);
$this->assertContains('/twitter_image.png', $invoke_paths);
$this->assertContains('/og_image.png', $invoke_paths);
$this->assertNotContains('data:image/jpeg;base64,x', $invoke_paths);
$static->exportPaths($invoke_paths);
$base_dir = Settings::get('tome_static_directory');
$this->assertContains('Hello, complex world', file_get_contents("$base_dir/tome-test/complex-page/index.html"));
$this->assertStringContainsString('Hello, complex world', file_get_contents("$base_dir/tome-test/complex-page/index.html"));
$this->assertFileExists("$base_dir/$module_path/css/complex.css");
$this->assertFileExists("$base_dir/$module_path/js/complex.js");
$this->assertFileExists("$base_dir/$module_path/assets/druplicon-1.png");
$this->assertFileExists("$base_dir/$module_path/assets/file with space.png");
$this->assertFileExists("$base_dir/core/misc/druplicon.png");
$this->assertFileExists("$base_dir/core/assets/vendor/html5shiv/html5shiv.min.js");
}
/**
......@@ -256,9 +255,9 @@ class StaticGeneratorTest extends TestBase {
$this->assertContains('/foobar?page=2', $invoke_paths);
$base_dir = Settings::get('tome_static_directory');
$contents = file_get_contents("$base_dir/tome-test/pager-page/index.html");
$this->assertContains('href="/tome-test/pager-page"', $contents);
$this->assertContains('href="/tome-test/pager-page/page/2"', $contents);
$this->assertContains('href="/foobar/page/3"', $contents);
$this->assertStringContainsString('href="/tome-test/pager-page"', $contents);
$this->assertStringContainsString('href="/tome-test/pager-page/page/2"', $contents);
$this->assertStringContainsString('href="/foobar/page/3"', $contents);
}
/**
......@@ -282,7 +281,7 @@ class StaticGeneratorTest extends TestBase {
$base_dir = Settings::get('tome_static_directory');
$modified_path = "/media/oembed/" . md5(urldecode($query));
$contents = file_get_contents("$base_dir/tome-test/oembed-page/index.html");
$this->assertContains("src='$modified_path'", $contents);
$this->assertStringContainsString("src='$modified_path'", $contents);
$this->assertFileExists("$base_dir/$modified_path" . '/index.html');
}
......
......@@ -21,6 +21,7 @@ class StaticRedirectTest extends TestBase {
'tome_static',
'link',
'redirect',
'path_alias',
];
/**
......@@ -51,7 +52,7 @@ class StaticRedirectTest extends TestBase {
$invoke_paths = $static->requestPath('_redirect:' . $redirect->id());
$this->assertFileExists("$base_dir/test/index.html");
$this->assertContains('<meta http-equiv="refresh"', file_get_contents("$base_dir/test/index.html"));
$this->assertStringContainsString('<meta http-equiv="refresh"', file_get_contents("$base_dir/test/index.html"));
$this->assertContains('/node', $invoke_paths);
}
......
services:
tome_static.generator:
class: Drupal\tome_static\StaticGenerator
arguments: ['@http_kernel', '@request_stack', '@event_dispatcher', '@cache.tome_static', '@account_switcher']
arguments: ['@http_kernel', '@request_stack', '@event_dispatcher', '@cache.tome_static', '@account_switcher', '@file_system']
cache.tome_static:
class: Drupal\tome_static\StaticCache
arguments: ['@database', '@cache_tags.invalidator.checksum', 'tome_static']
......
......@@ -2,14 +2,15 @@
namespace Drupal\tome_sync\Commands;
use Drupal\Core\Config\StorageInterface;
use Drupal\tome_base\CommandBase;
use Drupal\tome_base\PathTrait;
use Drupal\tome_sync\ContentIndexerTrait;
use Drupal\tome_sync\FileSyncInterface;
use Drupal\tome_base\CommandBase;
use Drupal\tome_sync\TomeSyncHelper;
use Drupal\tome_sync\FileSyncInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\tome_sync\ContentIndexerTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManager;
/**
* Contains the tome:clean-files command.
......@@ -35,6 +36,13 @@ class CleanFilesCommand extends CommandBase {
*/
protected $configStorage;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* The file sync service.
*
......@@ -101,7 +109,7 @@ class CleanFilesCommand extends CommandBase {
foreach ($names as $name) {
$data = $this->contentStorage->read($name);
list(, $uuid) = TomeSyncHelper::getPartsFromContentName($name);
$files[$uuid] = file_uri_target($data['uri'][0]['value']);
$files[$uuid] = StreamWrapperManager::getTarget($data['uri'][0]['value']);
}
$callback = function ($value) use (&$files) {
if (is_string($value)) {
......
......@@ -7,6 +7,7 @@ use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\TypedData\Type\UriInterface;
use Drupal\Core\File\FileSystemInterface;
/**
* Provides methods for reading and writing the index file.
......@@ -133,7 +134,7 @@ trait ContentIndexerTrait {
protected function acquireContentIndexLock() {
$destination = $this->getContentIndexFilePath();
$directory = dirname($destination);
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
$handle = fopen($destination, 'c+');
if (!flock($handle, LOCK_EX)) {
throw new \Exception('Unable to acquire lock for the index file.');
......
......@@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Site\Settings;
use Drupal\tome_sync\Event\TomeSyncEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\Core\File\FileSystemInterface;
/**
* Event subscriber that keep book outlines in sync with content changes.
......@@ -32,6 +33,13 @@ class BookEventSubscriber implements EventSubscriberInterface {
*/
protected $entityTypeManager;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* Creates a BookEventSubscriber object.
*
......@@ -39,10 +47,13 @@ class BookEventSubscriber implements EventSubscriberInterface {
* The database connection.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(Connection $connection, EntityTypeManagerInterface $entity_type_manager) {
public function __construct(Connection $connection, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system) {
$this->connection = $connection;
$this->entityTypeManager = $entity_type_manager;
$this->fileSystem = $file_system;
}
/**
......@@ -72,7 +83,7 @@ class BookEventSubscriber implements EventSubscriberInterface {
$rows[] = $row;
}
$directory = $this->getExportDirectory();
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
file_put_contents("$directory/book_outlines.json", json_encode($rows, JSON_PRETTY_PRINT));
}
......
......@@ -12,6 +12,7 @@ use Drupal\tome_sync\Event\ContentCrudEvent;
use Drupal\tome_sync\Event\TomeSyncEvents;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Serializer\Serializer;
use Drupal\Core\File\FileSystemInterface;
/**
* Handles exporting of content and file entities.
......@@ -52,6 +53,13 @@ class Exporter implements ExporterInterface {
*/
protected $eventDispatcher;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* The file sync service.
*
......@@ -83,14 +91,17 @@ class Exporter implements ExporterInterface {
* The account switcher.
* @param \Drupal\tome_sync\FileSyncInterface $file_sync
* The file sync service.
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(StorageInterface $content_storage, Serializer $serializer, EntityTypeManagerInterface $entity_type_manager, EventDispatcherInterface $event_dispatcher, AccountSwitcherInterface $account_switcher, FileSyncInterface $file_sync) {
public function __construct(StorageInterface $content_storage, Serializer $serializer, EntityTypeManagerInterface $entity_type_manager, EventDispatcherInterface $event_dispatcher, AccountSwitcherInterface $account_switcher, FileSyncInterface $file_sync, FileSystemInterface $file_system) {
$this->contentStorage = $content_storage;
$this->serializer = $serializer;
$this->entityTypeManager = $entity_type_manager;
$this->eventDispatcher = $event_dispatcher;
$this->accountSwitcher = $account_switcher;
$this->fileSync = $file_sync;
$this->fileSystem = $file_system;
}
/**
......
......@@ -2,10 +2,13 @@
namespace Drupal\tome_sync;
use Drupal\Core\Config\StorageException;
use Drupal\Core\Site\Settings;
use Drupal\file\FileInterface;
use Drupal\tome_base\PathTrait;
use Drupal\Core\Config\StorageException;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Component\FileSecurity\FileSecurity;
use Drupal\Core\StreamWrapper\StreamWrapperManager;
/**
* Handles file import and exports by keeping a file export directory in sync.
......@@ -16,17 +19,37 @@ class FileSync implements FileSyncInterface {
use PathTrait;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* Creates an FileSync object.
*
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.
*/
public function __construct(FileSystemInterface $file_system) {
$this->fileSystem = $file_system;
}
/**
* {@inheritdoc}
*/
public function importFiles() {
$file_directory = $this->getFileDirectory();
if (!is_dir($file_directory)) {
return;
}
/** @var \Drupal\file\FileInterface $file */
foreach (file_scan_directory($file_directory, '/.*/') as $file) {
foreach ($this->fileSystem->scanDirectory($file_directory, '/.*/') as $file) {
$destination = 'public://' . ltrim(str_replace($file_directory, '', $file->uri), '/');
$directory = dirname($destination);
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
file_unmanaged_copy($file->uri, $destination, FILE_EXISTS_REPLACE);
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
$this->fileSystem->copy($file->uri, $destination, FileSystemInterface::EXISTS_REPLACE);
}
}
......@@ -36,7 +59,7 @@ class FileSync implements FileSyncInterface {
public function deleteExportDirectory() {
$file_directory = $this->getFileDirectory();
if (file_exists($file_directory)) {
if (!file_unmanaged_delete_recursive($file_directory)) {
if (!$this->fileSystem->deleteRecursive($file_directory)) {
return FALSE;
}
}
......@@ -50,10 +73,10 @@ class FileSync implements FileSyncInterface {
$this->ensureFileDirectory();
$file_directory = $this->getFileDirectory();
if (strpos($file->getFileUri(), 'public://') === 0 && file_exists($file->getFileUri())) {
$destination = $this->joinPaths($file_directory, file_uri_target($file->getFileUri()));
$destination = $this->joinPaths($file_directory, StreamWrapperManager::getTarget($file->getFileUri()));
$directory = dirname($destination);
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
file_unmanaged_copy($file->getFileUri(), $destination, FILE_EXISTS_REPLACE);
$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
$this->fileSystem->copy($file->getFileUri(), $destination, FileSystemInterface::EXISTS_REPLACE);
}
}
......@@ -63,9 +86,9 @@ class FileSync implements FileSyncInterface {
public function deleteFileExport(FileInterface $file) {
$file_directory = $this->getFileDirectory();
if (strpos($file->getFileUri(), 'public://') === 0) {
$path = $this->joinPaths($file_directory, file_uri_target($file->getFileUri()));
$path = $this->joinPaths($file_directory, StreamWrapperManager::getTarget($file->getFileUri()));
if (file_exists($path)) {
file_unmanaged_delete($path);
$this->fileSystem->delete($path);
}
}
}
......@@ -76,7 +99,7 @@ class FileSync implements FileSyncInterface {
public function deleteFile($filename) {
$path = $this->joinPaths($this->getFileDirectory(), $filename);
if (file_exists($path)) {
file_unmanaged_delete($path);
$this->fileSystem->delete($path);
}
}
......@@ -95,8 +118,8 @@ class FileSync implements FileSyncInterface {
*/
protected function ensureFileDirectory() {
$file_directory = $this->getFileDirectory();
file_prepare_directory($file_directory, FILE_CREATE_DIRECTORY);
file_save_htaccess($file_directory);
$this->fileSystem->prepareDirectory($file_directory, FileSystemInterface::CREATE_DIRECTORY);
FileSecurity::writeHtaccess($file_directory);
if (!file_exists($file_directory)) {
throw new StorageException('Failed to create config directory ' . $file_directory);
}
......
......@@ -13,6 +13,7 @@ use Drupal\tome_sync\Event\ContentCrudEvent;
use Drupal\tome_sync\Event\TomeSyncEvents;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Serializer\Serializer;
use Drupal\Core\File\FileSystemInterface;
/**
* Handles importing of content and file entities.
......@@ -59,6 +60,13 @@ class Importer implements ImporterInterface {
*/
protected $eventDispatcher;
/**
* The file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected $fileSystem;
/**
* The file sync service.
*
......@@ -81,8 +89,10 @@ class Importer implements ImporterInterface {
* The account switcher.
* @param \Drupal\tome_sync\FileSyncInterface $file_sync
* The file sync service.
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system.