diff --git a/core/includes/file.inc b/core/includes/file.inc index a9dc44bb4d..70b2661c68 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -44,7 +44,7 @@ */ /** - * Flag used by \Drupal::service('file_system')->prepareDirectory() -- create directory if not present. + * Flag used by \Drupal\Core\File\FileSystemInterface::prepareDirectory() -- create directory if not present. * * @deprecated in Drupal 8.7.0, will be removed before Drupal 9.0.0. * Use \Drupal\Core\File\FileSystemInterface::FILE_CREATE_DIRECTORY. @@ -52,7 +52,7 @@ const FILE_CREATE_DIRECTORY = FileSystemInterface::FILE_CREATE_DIRECTORY; /** - * Flag used by \Drupal::service('file_system')->prepareDirectory() -- file permissions may be changed. + * Flag used by \Drupal\Core\File\FileSystemInterface::prepareDirectory() -- file permissions may be changed. * * @deprecated in Drupal 8.7.0, will be removed before Drupal 9.0.0. * Use \Drupal\Core\File\FileSystemInterface::FILE_MODIFY_PERMISSIONS. @@ -310,7 +310,7 @@ function file_url_transform_relative($file_url) { * @deprecated in Drupal 8.7.0, will be removed before Drupal 9.0.0. * Use \Drupal\Core\File\FileSystemInterface::prepareDirectory(). */ -function file_prepare_directory(&$directory, $options = FILE_MODIFY_PERMISSIONS) { +function file_prepare_directory(&$directory, $options = FileSystemInterface::FILE_MODIFY_PERMISSIONS) { @trigger_error('file_prepare_directory() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::prepareDirectory(). See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED); return \Drupal::service('file_system')->prepareDirectory($directory, $options); } @@ -516,17 +516,17 @@ function file_build_uri($path) { function file_destination($destination, $replace) { if (file_exists($destination)) { switch ($replace) { - case FILE_EXISTS_REPLACE: + case FileSystemInterface::FILE_EXISTS_REPLACE: // Do nothing here, we want to overwrite the existing file. break; - case FILE_EXISTS_RENAME: + case FileSystemInterface::FILE_EXISTS_RENAME: $basename = drupal_basename($destination); $directory = drupal_dirname($destination); $destination = file_create_filename($basename, $directory); break; - case FILE_EXISTS_ERROR: + case FileSystemInterface::FILE_EXISTS_ERROR: // Error reporting handled by calling function. return FALSE; } diff --git a/core/lib/Drupal/Core/Config/FileStorage.php b/core/lib/Drupal/Core/Config/FileStorage.php index 31bf5ace1e..58e2cfb186 100644 --- a/core/lib/Drupal/Core/Config/FileStorage.php +++ b/core/lib/Drupal/Core/Config/FileStorage.php @@ -76,7 +76,7 @@ public static function getFileExtension() { */ protected function ensureStorage() { $dir = $this->getCollectionDirectory(); - $success = \Drupal::service('file_system')->prepareDirectory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + $success = \Drupal::service('file_system')->prepareDirectory($dir, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); // Only create .htaccess file in root directory. if ($dir == $this->directory) { $success = $success && file_save_htaccess($this->directory, TRUE, TRUE); diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php index 388fb08423..49a1d6e2c1 100644 --- a/core/lib/Drupal/Core/Extension/module.api.php +++ b/core/lib/Drupal/Core/Extension/module.api.php @@ -226,7 +226,7 @@ function hook_modules_installed($modules) { function hook_install() { // Create the styles directory and ensure it's writable. $directory = file_default_scheme() . '://styles'; - \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); } /** diff --git a/core/lib/Drupal/Core/File/FileSystem.php b/core/lib/Drupal/Core/File/FileSystem.php index 83f36564d8..f01b0515b0 100644 --- a/core/lib/Drupal/Core/File/FileSystem.php +++ b/core/lib/Drupal/Core/File/FileSystem.php @@ -545,7 +545,7 @@ public function saveData($data, $destination = NULL, $replace = self::FILE_EXIST /** * {@inheritdoc} */ - public function prepareDirectory($directory, $options = FILE_MODIFY_PERMISSIONS) { + public function prepareDirectory($directory, $options = FileSystemInterface::FILE_MODIFY_PERMISSIONS) { if (!$this->validScheme($this->uriScheme($directory))) { // Only trim if we're not dealing with a stream. $directory = rtrim($directory, '/\\'); diff --git a/core/lib/Drupal/Core/File/FileSystemInterface.php b/core/lib/Drupal/Core/File/FileSystemInterface.php index fe5b4997f8..03d0109392 100644 --- a/core/lib/Drupal/Core/File/FileSystemInterface.php +++ b/core/lib/Drupal/Core/File/FileSystemInterface.php @@ -423,6 +423,6 @@ public function saveData($data, $destination = NULL, $replace = self::FILE_EXIST * TRUE if the directory exists (or was created) and is writable. FALSE * otherwise. */ - public function prepareDirectory($directory, $options = FILE_MODIFY_PERMISSIONS); + public function prepareDirectory($directory, $options = FileSystemInterface::FILE_MODIFY_PERMISSIONS); } diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php index ecac35737e..bb6385006a 100644 --- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php @@ -8,6 +8,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\DrupalKernel; use Drupal\Core\Extension\MissingDependencyException; +use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Serialization\Yaml; use Drupal\Core\Session\UserSession; use Drupal\Core\Site\Settings; @@ -575,7 +576,7 @@ protected function prepareEnvironment() { // Create test directory ahead of installation so fatal errors and debug // information can be logged during installation process. - \Drupal::service('file_system')->prepareDirectory($this->siteDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($this->siteDirectory, FileSystemInterface::FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); // Prepare filesystem directory paths. $this->publicFilesDirectory = $this->siteDirectory . '/files'; diff --git a/core/modules/image/image.install b/core/modules/image/image.install index 26ebf65b88..85a2c262b2 100644 --- a/core/modules/image/image.install +++ b/core/modules/image/image.install @@ -11,7 +11,7 @@ function image_install() { // Create the styles directory and ensure it's writable. $directory = file_default_scheme() . '://styles'; - \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); } /** diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index f341ead3c2..f6de48b1c6 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -294,7 +294,7 @@ public function createDerivative($original_uri, $derivative_uri) { $directory = drupal_dirname($derivative_uri); // Build the destination folder tree if it doesn't already exist. - if (!\Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { + if (!\Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS)) { \Drupal::logger('image')->error('Failed to create style directory: %directory', ['%directory' => $directory]); return FALSE; } diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 187d79157a..27ec301ed0 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -17,7 +17,7 @@ function locale_install() { $directory = $site_path . '/files/translations'; \Drupal::configFactory()->getEditable('locale.settings')->set('translation.path', $directory)->save(); } - \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); } /** diff --git a/core/modules/media/media.install b/core/modules/media/media.install index 6254d206a3..d1a8f331d5 100644 --- a/core/modules/media/media.install +++ b/core/modules/media/media.install @@ -17,7 +17,7 @@ function media_install() { $source = drupal_get_path('module', 'media') . '/images/icons'; $destination = \Drupal::config('media.settings')->get('icon_base_uri'); - \Drupal::service('file_system')->prepareDirectory($destination, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($destination, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); $files = file_scan_directory($source, '/.*\.(svg|png|jpg|jpeg|gif)$/'); foreach ($files as $file) { @@ -46,7 +46,7 @@ function media_requirements($phase) { $requirements = []; if ($phase == 'install') { $destination = 'public://media-icons/generic'; - \Drupal::service('file_system')->prepareDirectory($destination, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($destination, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); $is_writable = is_writable($destination); $is_directory = is_dir($destination); if (!$is_writable || !$is_directory) { diff --git a/core/modules/media/src/Plugin/media/Source/OEmbed.php b/core/modules/media/src/Plugin/media/Source/OEmbed.php index 031516f0bc..6209184ae5 100644 --- a/core/modules/media/src/Plugin/media/Source/OEmbed.php +++ b/core/modules/media/src/Plugin/media/Source/OEmbed.php @@ -381,7 +381,7 @@ protected function getLocalThumbnailUri(Resource $resource) { // The local thumbnail doesn't exist yet, so try to download it. First, // ensure that the destination directory is writable, and if it's not, // log an error and bail out. - if (!\Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { + if (!\Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS)) { $this->logger->warning('Could not prepare thumbnail destination directory @dir for oEmbed media.', [ '@dir' => $directory, ]); diff --git a/core/modules/migrate/src/Plugin/migrate/process/Download.php b/core/modules/migrate/src/Plugin/migrate/process/Download.php index 55746e4bad..60c62fd3c1 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/Download.php +++ b/core/modules/migrate/src/Plugin/migrate/process/Download.php @@ -134,7 +134,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable if (!$destination_stream) { // If fopen didn't work, make sure there's a writable directory in place. $dir = $this->fileSystem->dirname($final_destination); - if (!\Drupal::service('file_system')->prepareDirectory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { + if (!\Drupal::service('file_system')->prepareDirectory($dir, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS)) { throw new MigrateException("Could not create or write to directory '$dir'"); } // Let's try that fopen again. diff --git a/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php b/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php index dde6b65374..899f185819 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php +++ b/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php @@ -141,10 +141,11 @@ public function transform($value, MigrateExecutableInterface $migrate_executable // Check if a writable directory exists, and if not try to create it. $dir = $this->getDirectory($destination); - // If the directory exists and is writable, avoid \Drupal::service('file_system')->prepareDirectory() - // call and write the file to destination. + // If the directory exists and is writable, avoid + // \Drupal\Core\File\FileSystemInterface::prepareDirectory() call and write + // the file to destination. if (!is_dir($dir) || !is_writable($dir)) { - if (!\Drupal::service('file_system')->prepareDirectory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { + if (!\Drupal::service('file_system')->prepareDirectory($dir, FileSystemInterface::FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS)) { throw new MigrateException("Could not create or write to directory '$dir'"); } } @@ -169,7 +170,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable * @return string|bool * File destination on success, FALSE on failure. */ - protected function writeFile($source, $destination, $replace = FILE_EXISTS_REPLACE) { + protected function writeFile($source, $destination, $replace = FileSystemInterface::FILE_EXISTS_REPLACE) { // Check if there is a destination available for copying. If there isn't, // it already exists at the destination and the replace flag tells us to not // replace it. In that case, return the original destination. @@ -189,7 +190,8 @@ protected function writeFile($source, $destination, $replace = FILE_EXISTS_REPLA * * For URIs like public://foo.txt, the full physical path of public:// * will be returned, since a scheme by itself will trip up certain file - * API functions (such as \Drupal::service('file_system')->prepareDirectory()). + * API functions (such as + * \Drupal\Core\File\FileSystemInterface::prepareDirectory()). * * @param string $uri * The URI or path. diff --git a/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php b/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php index 8b7d810000..9ba80e3839 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php +++ b/core/modules/migrate/src/Plugin/migrate/process/FileProcessBase.php @@ -2,6 +2,7 @@ namespace Drupal\migrate\Plugin\migrate\process; +use Drupal\Core\File\FileSystemInterface; use Drupal\migrate\ProcessPluginBase; /** @@ -31,28 +32,28 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi if (array_key_exists('file_exists', $configuration)) { switch ($configuration['file_exists']) { case 'use existing': - $configuration['file_exists'] = FILE_EXISTS_ERROR; + $configuration['file_exists'] = FileSystemInterface::FILE_EXISTS_ERROR; break; case 'rename': - $configuration['file_exists'] = FILE_EXISTS_RENAME; + $configuration['file_exists'] = FileSystemInterface::FILE_EXISTS_RENAME; break; default: - $configuration['file_exists'] = FILE_EXISTS_REPLACE; + $configuration['file_exists'] = FileSystemInterface::FILE_EXISTS_REPLACE; } } if (array_key_exists('reuse', $configuration)) { @trigger_error("Using the key 'reuse' is deprecated, use 'file_exists' => 'use existing' instead. See https://www.drupal.org/node/2981389.", E_USER_DEPRECATED); if (!empty($configuration['reuse'])) { - $configuration['file_exists'] = FILE_EXISTS_ERROR; + $configuration['file_exists'] = FileSystemInterface::FILE_EXISTS_ERROR; } } if (array_key_exists('rename', $configuration)) { @trigger_error("Using the key 'rename' is deprecated, use 'file_exists' => 'rename' instead. See https://www.drupal.org/node/2981389.", E_USER_DEPRECATED); if (!empty($configuration['rename'])) { - $configuration['file_exists'] = FILE_EXISTS_RENAME; + $configuration['file_exists'] = FileSystemInterface::FILE_EXISTS_RENAME; } } - $configuration += ['file_exists' => FILE_EXISTS_REPLACE]; + $configuration += ['file_exists' => FileSystemInterface::FILE_EXISTS_REPLACE]; parent::__construct($configuration, $plugin_id, $plugin_definition); } diff --git a/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php b/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php index 07a953b53c..fe39f59b9e 100644 --- a/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php +++ b/core/modules/migrate/tests/src/Unit/process/FileCopyTest.php @@ -7,21 +7,6 @@ use Drupal\migrate\Plugin\migrate\process\FileCopy; use Drupal\migrate\Plugin\MigrateProcessInterface; -/** - * Flag for dealing with existing files: Appends number until name is unique. - */ -define('FILE_EXISTS_RENAME', 0); - -/** - * Flag for dealing with existing files: Replace the existing file. - */ -define('FILE_EXISTS_REPLACE', 1); - -/** - * Flag for dealing with existing files: Do nothing and return FALSE. - */ -define('FILE_EXISTS_ERROR', 2); - /** * Tests the file copy process plugin. * @@ -53,8 +38,8 @@ public function testDeprecationNoticeRename($configuration, $expected) { */ public function providerDeprecationNoticeRename() { return [ - [['rename' => TRUE], FILE_EXISTS_RENAME], - [['rename' => FALSE], FILE_EXISTS_REPLACE], + [['rename' => TRUE], FileSystemInterface::FILE_EXISTS_RENAME], + [['rename' => FALSE], FileSystemInterface::FILE_EXISTS_REPLACE], ]; } @@ -79,8 +64,8 @@ public function testDeprecationNoticeReuse($configuration, $expected) { */ public function providerDeprecationNoticeReuse() { return [ - [['reuse' => TRUE], FILE_EXISTS_ERROR], - [['reuse' => FALSE], FILE_EXISTS_REPLACE], + [['reuse' => TRUE], FileSystemInterface::FILE_EXISTS_ERROR], + [['reuse' => FALSE], FileSystemInterface::FILE_EXISTS_REPLACE], ]; } @@ -103,11 +88,11 @@ public function testFileProcessBaseConstructor($configuration, $expected) { */ public function providerFileProcessBaseConstructor() { return [ - [['file_exists' => 'replace'], FILE_EXISTS_REPLACE], - [['file_exists' => 'rename'], FILE_EXISTS_RENAME], - [['file_exists' => 'use existing'], FILE_EXISTS_ERROR], - [['file_exists' => 'foobar'], FILE_EXISTS_REPLACE], - [[], FILE_EXISTS_REPLACE], + [['file_exists' => 'replace'], FileSystemInterface::FILE_EXISTS_REPLACE], + [['file_exists' => 'rename'], FileSystemInterface::FILE_EXISTS_RENAME], + [['file_exists' => 'use existing'], FileSystemInterface::FILE_EXISTS_ERROR], + [['file_exists' => 'foobar'], FileSystemInterface::FILE_EXISTS_REPLACE], + [[], FileSystemInterface::FILE_EXISTS_REPLACE], ]; } diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php index 6ae7b58745..f8c2e1715d 100644 --- a/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -149,7 +149,7 @@ protected function prepareConfigDirectories() { $path = $this->siteDirectory . '/config_' . CONFIG_SYNC_DIRECTORY; $GLOBALS['config_directories'][CONFIG_SYNC_DIRECTORY] = $path; // Ensure the directory can be created and is writeable. - if (!\Drupal::service('file_system')->prepareDirectory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { + if (!\Drupal::service('file_system')->prepareDirectory($path, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS)) { throw new \RuntimeException("Failed to create '" . CONFIG_SYNC_DIRECTORY . "' config directory $path"); } // Provide the already resolved path for tests. @@ -287,7 +287,7 @@ protected function setUp() { // StreamWrapper APIs. // @todo Move StreamWrapper management into DrupalKernel. // @see https://www.drupal.org/node/2028109 - \Drupal::service('file_system')->prepareDirectory($this->publicFilesDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($this->publicFilesDirectory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); $this->settingsSet('file_public_path', $this->publicFilesDirectory); $this->streamWrappers = []; $this->registerStreamWrapper('public', 'Drupal\Core\StreamWrapper\PublicStream'); diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 01cfdb3ddb..a469325799 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1125,7 +1125,7 @@ private function prepareEnvironment() { // Create test directory ahead of installation so fatal errors and debug // information can be logged during installation process. - \Drupal::service('file_system')->prepareDirectory($this->siteDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($this->siteDirectory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); // Prepare filesystem directory paths. $this->publicFilesDirectory = $this->siteDirectory . '/files'; diff --git a/core/modules/system/system.install b/core/modules/system/system.install index fd34b8ae05..8b78e01a20 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -627,7 +627,7 @@ function system_requirements($phase) { $directory = config_get_config_directory($type); // If we're installing Drupal try and create the config sync directory. if (!is_dir($directory) && $phase == 'install') { - \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); } if (!is_dir($directory)) { if ($phase == 'install') { @@ -664,7 +664,7 @@ function system_requirements($phase) { continue; } if ($phase == 'install') { - \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); } $is_writable = is_writable($directory); $is_directory = is_dir($directory); diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 0c41fd7e37..fc3fd0ffcd 100644 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -1565,7 +1565,7 @@ function simpletest_script_open_browser() { // Ensure we have assets verbose directory - tests with no verbose output will // not have created one. $directory = PublicStream::basePath() . '/simpletest/verbose'; - \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); + \Drupal::service('file_system')->prepareDirectory($directory, FILE_CREATE_DIRECTORY | FileSystemInterface::FILE_MODIFY_PERMISSIONS); $php = new Php(); $uuid = $php->generate(); $filename = $directory . '/results-' . $uuid . '.html'; diff --git a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php index e34caac69d..071d38baf1 100644 --- a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php @@ -79,7 +79,7 @@ public function testFileCheckDirectoryHandling() { // Test directory permission modification. $this->setSetting('file_chmod_directory', 0777); - $this->assertTrue(\Drupal::service('file_system')->prepareDirectory($directory, FILE_MODIFY_PERMISSIONS), 'No error reported when making directory writeable.', 'File'); + $this->assertTrue(\Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::FILE_MODIFY_PERMISSIONS), 'No error reported when making directory writeable.', 'File'); } // Test that the directory has the correct permissions.