diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 77458a1..dfcfeac 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -3472,7 +3472,7 @@ function drupal_php_storage($name = 'default') { $configuration['bin'] = $name; } if (!isset($configuration['directory'])) { - $configuration['directory'] = DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php'; + $configuration['directory'] = DRUPAL_ROOT . '/' . config('system.file')->get('path.public') . '/php'; } $storage_controllers[$name] = new $class($configuration); } diff --git a/core/includes/file.inc b/core/includes/file.inc index f1c6ac9..2cf707b 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -314,16 +314,6 @@ function file_uri_target($uri) { } /** - * Gets the default file stream implementation. - * - * @return - * 'public', 'private' or any other file scheme defined as the default. - */ -function file_default_scheme() { - return variable_get('file_default_scheme', 'public'); -} - -/** * Normalizes a URI by making it syntactically correct. * * A stream is referenced as "scheme://target". @@ -526,7 +516,7 @@ function file_prepare_directory(&$directory, $options = FILE_MODIFY_PERMISSIONS) */ function file_ensure_htaccess() { file_save_htaccess('public://', FALSE); - if (variable_get('file_private_path', FALSE)) { + if (config('system.file')->get('path.private')) { file_save_htaccess('private://', TRUE); } file_save_htaccess('temporary://', TRUE); @@ -708,7 +698,7 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST * Constructs a URI to Drupal's default files location given a relative path. */ function file_build_uri($path) { - $uri = file_default_scheme() . '://' . $path; + $uri = config('system.file')->get('default_scheme') . '://' . $path; return file_stream_wrapper_uri_normalize($uri); } @@ -1554,10 +1544,10 @@ function file_get_mimetype($uri, $mapping = NULL) { function drupal_chmod($uri, $mode = NULL) { if (!isset($mode)) { if (is_dir($uri)) { - $mode = variable_get('file_chmod_directory', 0775); + $mode = config('system.file')->get('chmod.directory'); } else { - $mode = variable_get('file_chmod_file', 0664); + $mode = config('system.file')->get('chmod.file'); } } @@ -1734,7 +1724,7 @@ function drupal_basename($uri, $suffix = NULL) { */ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) { if (!isset($mode)) { - $mode = variable_get('file_chmod_directory', 0775); + $mode = config('system.file')->get('chmod.directory'); } if (!isset($context)) { @@ -1820,7 +1810,7 @@ function drupal_tempnam($directory, $prefix) { * Gets the path of system-appropriate temporary directory. */ function file_directory_temp() { - $temporary_directory = variable_get('file_temporary_path', NULL); + $temporary_directory = config('system.file')->get('path.temporary'); if (empty($temporary_directory)) { $directories = array(); @@ -1850,7 +1840,7 @@ function file_directory_temp() { if (empty($temporary_directory)) { // If no directory has been found default to 'files/tmp'. - $temporary_directory = variable_get('file_public_path', conf_path() . '/files') . '/tmp'; + $temporary_directory = config('system.file')->get('path.public') . '/tmp'; // Windows accepts paths with either slash (/) or backslash (\), but will // not accept a path which contains both a slash and a backslash. Since @@ -1858,8 +1848,9 @@ function file_directory_temp() { // everything to use slash which is supported on all platforms. $temporary_directory = str_replace('\\', '/', $temporary_directory); } + // Save the path of the discovered directory. - variable_set('file_temporary_path', $temporary_directory); + config('system.file')->set('path.temporary', $temporary_directory)->save(); } return $temporary_directory; diff --git a/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php b/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php index 87316eb..833580f 100644 --- a/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php @@ -19,7 +19,7 @@ class PrivateStream extends LocalStream { * Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath() */ public function getDirectoryPath() { - return variable_get('file_private_path', ''); + return config('system.file')->get('path.private'); } /** diff --git a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php index 207b77a..dade4e9 100644 --- a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php @@ -19,7 +19,7 @@ class PublicStream extends LocalStream { * Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath() */ public function getDirectoryPath() { - return variable_get('file_public_path', conf_path() . '/files'); + return config('system.file')->get('path.public'); } /** diff --git a/core/lib/Drupal/Core/StreamWrapper/TemporaryStream.php b/core/lib/Drupal/Core/StreamWrapper/TemporaryStream.php index 52a6321..fd23619 100644 --- a/core/lib/Drupal/Core/StreamWrapper/TemporaryStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/TemporaryStream.php @@ -19,7 +19,12 @@ class TemporaryStream extends LocalStream { * Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath() */ public function getDirectoryPath() { - return variable_get('file_temporary_path', file_directory_temp()); + $temporary_path = config('system.file')->get('path.temporary'); + if (empty($temporary_path)) { + // Determine a temporary path. This will save the value to config for next time. + $temporary_path = file_directory_temp(); + } + return $temporary_path; } /** diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc index cbc2246..e133755 100644 --- a/core/modules/file/file.field.inc +++ b/core/modules/file/file.field.inc @@ -16,7 +16,7 @@ function file_field_info() { 'settings' => array( 'display_field' => 0, 'display_default' => 0, - 'uri_scheme' => variable_get('file_default_scheme', 'public'), + 'uri_scheme' => config('system.file')->get('default_scheme'), ), 'instance_settings' => array( 'file_extensions' => 'txt', diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 0f6cb64..51abc91 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -647,7 +647,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM global $user; if (empty($destination)) { - $destination = file_default_scheme() . '://'; + $destination = config('system.file')->get('default_scheme') . '://'; } if (!file_valid_uri($destination)) { watchdog('file', 'The data could not be saved because the destination %destination is invalid. This may be caused by improper use of file_save_data() or a missing stream wrapper.', array('%destination' => $destination)); diff --git a/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php index ed587d2..fb5e68b 100644 --- a/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote')->save(); } } diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php index ecdb201..8ccf5c0 100644 --- a/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php @@ -28,7 +28,7 @@ function testWithoutFilename() { $result = file_save_data($contents); $this->assertTrue($result, t('Unnamed file saved correctly.')); - $this->assertEqual(file_default_scheme(), file_uri_scheme($result->uri), t("File was placed in Drupal's files directory.")); + $this->assertEqual(config('system.file')->get('default_scheme'), file_uri_scheme($result->uri), t("File was placed in Drupal's files directory.")); $this->assertEqual($result->filename, drupal_basename($result->uri), t("Filename was set to the file's basename.")); $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.')); $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.')); diff --git a/core/modules/image/image.field.inc b/core/modules/image/image.field.inc index 09b07eb..3a8b0f9 100644 --- a/core/modules/image/image.field.inc +++ b/core/modules/image/image.field.inc @@ -14,7 +14,7 @@ function image_field_info() { 'label' => t('Image'), 'description' => t('This field stores the ID of an image file as an integer value.'), 'settings' => array( - 'uri_scheme' => variable_get('file_default_scheme', 'public'), + 'uri_scheme' => config('system.file')->get('default_scheme'), 'default_image' => 0, ), 'instance_settings' => array( diff --git a/core/modules/image/image.install b/core/modules/image/image.install index 88f05a1..4462fed 100644 --- a/core/modules/image/image.install +++ b/core/modules/image/image.install @@ -12,7 +12,7 @@ */ function image_install() { // Create the styles directory and ensure it's writable. - $directory = file_default_scheme() . '://styles'; + $directory = config('system.file')->get('default_scheme') . '://styles'; file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); } @@ -21,7 +21,7 @@ function image_install() { */ function image_uninstall() { // Remove the styles directory and generated images. - file_unmanaged_delete_recursive(file_default_scheme() . '://styles'); + file_unmanaged_delete_recursive(config('system.file')->get('default_scheme') . '://styles'); } /** diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 01d2b3b..b289ad7 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -891,7 +891,7 @@ function image_style_transform_dimensions($style_name, array &$dimensions) { * An image style array. */ function image_style_flush($style) { - $style_directory = drupal_realpath(file_default_scheme() . '://styles/' . $style['name']); + $style_directory = drupal_realpath(config('system.file')->get('default_scheme') . '://styles/' . $style['name']); if (is_dir($style_directory)) { file_unmanaged_delete_recursive($style_directory); } @@ -964,7 +964,7 @@ function image_style_path($style_name, $uri) { } else { $path = $uri; - $scheme = file_default_scheme(); + $scheme = config('system.file')->get('default_scheme');; } return $scheme . '://styles/' . $style_name . '/' . $scheme . '/' . $path; } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php index 7437b10..d226157 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php @@ -209,7 +209,7 @@ function testStyle() { $this->drupalPost('admin/config/media/image-styles/delete/' . $style_name, array(), t('Delete')); // Confirm the style directory has been removed. - $directory = file_default_scheme() . '://styles/' . $style_name; + $directory = config('system.file')->get('default_scheme') . '://styles/' . $style_name; $this->assertFalse(is_dir($directory), format_string('Image style %style directory removed on style deletion.', array('%style' => $style['label']))); drupal_static_reset('image_styles'); diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php index f38df1e..2bd083a 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php @@ -91,7 +91,7 @@ function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE) { // Make the default scheme neither "public" nor "private" to verify the // functions work for other than the default scheme. - variable_set('file_default_scheme', 'temporary'); + config('system.file')->set('default_scheme', 'temporary')->save(); // Create the directories for the styles. $directory = $scheme . '://styles/' . $this->style_name; diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index 7320a74..bfd7099 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -565,7 +565,7 @@ public function run(array $methods = array()) { if ($simpletest_config->get('verbose')) { // Initialize verbose debugging. $this->verbose = TRUE; - $this->verboseDirectory = variable_get('file_public_path', conf_path() . '/files') . '/simpletest/verbose'; + $this->verboseDirectory = config('system.file')->get('path.public') . '/simpletest/verbose'; if (file_prepare_directory($this->verboseDirectory, FILE_CREATE_DIRECTORY) && !file_exists($this->verboseDirectory . '/.htaccess')) { file_put_contents($this->verboseDirectory . '/.htaccess', "\nExpiresActive Off\n\n"); } @@ -733,7 +733,7 @@ protected function prepareEnvironment() { $this->originalTheme = $GLOBALS['theme']; // Save further contextual information. - $this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files'); + $this->originalFileDirectory = config('system.file')->get('path.public'); $this->originalProfile = drupal_get_profile(); $this->originalUser = clone $user; diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php index f49868b..157f207 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/FolderTest.php @@ -30,7 +30,7 @@ public static function getInfo() { } function testFolderSetup() { - $directory = file_default_scheme() . '://styles'; + $directory = config('system.file')->get('default_scheme') . '://styles'; $this->assertTrue(file_prepare_directory($directory, FALSE), "Directory created."); } } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 24bf1f2..9f812b8 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -694,9 +694,11 @@ protected function setUp() { unset($conf['lock_backend']); // Set path variables. - variable_set('file_public_path', $this->public_files_directory); - variable_set('file_private_path', $this->private_files_directory); - variable_set('file_temporary_path', $this->temp_files_directory); + config('system.file') + ->set('path.public', $this->public_files_directory) + ->set('path.private', $this->private_files_directory) + ->set('path.temporary', $this->temp_files_directory) + ->save(); variable_set('locale_translate_file_directory', $this->translation_files_directory); // Set 'parent_profile' of simpletest to add the parent profile's diff --git a/core/modules/system/config/system.file.yml b/core/modules/system/config/system.file.yml new file mode 100644 index 0000000..31018e8 --- /dev/null +++ b/core/modules/system/config/system.file.yml @@ -0,0 +1,12 @@ +# File system paths. +path: + public: 'sites/default/files' + private: '' + temporary: '' +default_scheme: 'public' + +# Directory and file modes. +# 0775 is 509, as converted from octal, and 664 is 436. +chmod: + directory: 509 + file: 436 diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php index 878dae4..cd59ddf 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php @@ -24,7 +24,8 @@ public static function getInfo() { */ function testFileCheckDirectoryHandling() { // A directory to operate on. - $directory = file_default_scheme() . '://' . $this->randomName() . '/' . $this->randomName(); + $default_scheme = config('system.file')->get('default_scheme'); + $directory = $default_scheme . '://' . $this->randomName() . '/' . $this->randomName(); $this->assertFalse(is_dir($directory), t('Directory does not exist prior to testing.')); // Non-existent directory. @@ -51,15 +52,15 @@ function testFileCheckDirectoryHandling() { } // Test that the directory has the correct permissions. - $this->assertDirectoryPermissions($directory, variable_get('file_chmod_directory', 0775)); + $this->assertDirectoryPermissions($directory, config('system.file')->get('chmod.directory')); // Remove .htaccess file to then test that it gets re-created. - @drupal_unlink(file_default_scheme() . '://.htaccess'); - $this->assertFalse(is_file(file_default_scheme() . '://.htaccess'), t('Successfully removed the .htaccess file in the files directory.'), 'File'); + @drupal_unlink($default_scheme . '://.htaccess'); + $this->assertFalse(is_file($default_scheme . '://.htaccess'), t('Successfully removed the .htaccess file in the files directory.'), 'File'); file_ensure_htaccess(); - $this->assertTrue(is_file(file_default_scheme() . '://.htaccess'), t('Successfully re-created the .htaccess file in the files directory.'), 'File'); + $this->assertTrue(is_file($default_scheme . '://.htaccess'), t('Successfully re-created the .htaccess file in the files directory.'), 'File'); // Verify contents of .htaccess file. - $file = file_get_contents(file_default_scheme() . '://.htaccess'); + $file = file_get_contents($default_scheme . '://.htaccess'); $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", t('The .htaccess file contains the proper content.'), 'File'); } @@ -122,10 +123,10 @@ function testFileDestination() { */ function testFileDirectoryTemp() { // Start with an empty variable to ensure we have a clean slate. - variable_set('file_temporary_path', ''); + config('system.file')->set('path.temporary', ''); $tmp_directory = file_directory_temp(); $this->assertEqual(empty($tmp_directory), FALSE, t('file_directory_temp() returned a non-empty value.')); - $setting = variable_get('file_temporary_path', ''); - $this->assertEqual($setting, $tmp_directory, "The 'file_temporary_path' variable has the same value that file_directory_temp() returned."); + $setting = config('system.file')->get('path.temporary'); + $this->assertEqual($setting, $tmp_directory, "The 'path.temporary' variable has the same value that file_directory_temp() returned."); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php index b1d5c6d..ebf92d4 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php @@ -152,7 +152,7 @@ function assertDirectoryPermissions($directory, $expected_mode, $message = NULL) function createDirectory($path = NULL) { // A directory to operate on. if (!isset($path)) { - $path = file_default_scheme() . '://' . $this->randomName(); + $path = config('system.file')->get('default_scheme') . '://' . $this->randomName(); } $this->assertTrue(drupal_mkdir($path) && is_dir($path), 'Directory was created successfully.'); return $path; @@ -180,7 +180,7 @@ function createUri($filepath = NULL, $contents = NULL, $scheme = NULL) { $filepath = 'Файл для тестирования ' . $this->randomName(); } if (!isset($scheme)) { - $scheme = file_default_scheme(); + $scheme = config('system.file')->get('default_scheme'); } $filepath = $scheme . '://' . $filepath; diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileDirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileDirectoryTest.php index 89f9019..3434463 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileDirectoryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileDirectoryTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileScanDirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileScanDirectoryTest.php index 279d722..4aaf805 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileScanDirectoryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileScanDirectoryTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedCopyTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedCopyTest.php index 3f58ef4..897ab92 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedCopyTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedCopyTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php index d45210e..1b0c253 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteRecursiveTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteTest.php index ea52cfe..515b6e8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedDeleteTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedMoveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedMoveTest.php index c900fcf..b592401 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedMoveTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedMoveTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedSaveDataTest.php b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedSaveDataTest.php index b66932b..9e77e85 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedSaveDataTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/RemoteFileUnmanagedSaveDataTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - variable_set('file_default_scheme', 'dummy-remote'); + config('system.file')->set('default_scheme', 'dummy-remote'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php index f94d7b1..2c18b7e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php @@ -80,10 +80,10 @@ function testUriFunctions() { // Test file_build_uri() and // Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath(). $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.'); - $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), variable_get('file_public_path'), 'Expected default directory path was returned.'); - $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), variable_get('file_temporary_path'), 'Expected temporary directory path was returned.'); + $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), config('system.file')->get('path.public'), 'Expected default directory path was returned.'); + $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), config('system.file')->get('path.temporary'), 'Expected temporary directory path was returned.'); - variable_set('file_default_scheme', 'private'); + config('system.file')->set('default_scheme', 'private'); $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.'); } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php index ca01900..e9ae0e0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php @@ -25,6 +25,7 @@ public static function getInfo() { function testNormal() { // Create a file for testing $uri = $this->createUri(); + $file_chmod_file = config('system.file')->get('chmod.file'); // Copying to a new name. $desired_filepath = 'public://' . $this->randomName(); @@ -33,7 +34,7 @@ function testNormal() { $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.'); $this->assertTrue(file_exists($uri), 'Original file remains.'); $this->assertTrue(file_exists($new_filepath), 'New file exists.'); - $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($new_filepath, $file_chmod_file); // Copying with rename. $desired_filepath = 'public://' . $this->randomName(); @@ -43,7 +44,7 @@ function testNormal() { $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.'); $this->assertTrue(file_exists($uri), 'Original file remains.'); $this->assertTrue(file_exists($newer_filepath), 'New file exists.'); - $this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($newer_filepath, $file_chmod_file); // TODO: test copying to a directory (rather than full directory/file path) // TODO: test copying normal files using normal paths (rather than only streams) @@ -66,6 +67,7 @@ function testNonExistent() { function testOverwriteSelf() { // Create a file for testing $uri = $this->createUri(); + $file_chmod_file = config('system.file')->get('chmod.file'); // Copy the file onto itself with renaming works. $new_filepath = file_unmanaged_copy($uri, $uri, FILE_EXISTS_RENAME); @@ -73,7 +75,7 @@ function testOverwriteSelf() { $this->assertNotEqual($new_filepath, $uri, 'Copied file has a new name.'); $this->assertTrue(file_exists($uri), 'Original file exists after copying onto itself.'); $this->assertTrue(file_exists($new_filepath), 'Copied file exists after copying onto itself.'); - $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($new_filepath, $file_chmod_file); // Copy the file onto itself without renaming fails. $new_filepath = file_unmanaged_copy($uri, $uri, FILE_EXISTS_ERROR); @@ -91,6 +93,6 @@ function testOverwriteSelf() { $this->assertNotEqual($new_filepath, $uri, 'Copied file has a new name.'); $this->assertTrue(file_exists($uri), 'Original file exists after copying onto itself.'); $this->assertTrue(file_exists($new_filepath), 'Copied file exists after copying onto itself.'); - $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($new_filepath, $file_chmod_file); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php index 2a93ac6..e9245fe 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php @@ -24,7 +24,7 @@ public static function getInfo() { */ function testSingleFile() { // Create a file for testing - $filepath = file_default_scheme() . '://' . $this->randomName(); + $filepath = config('system.file')->get('default_scheme') . '://' . $this->randomName(); file_put_contents($filepath, ''); // Delete the file. diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php index 005cba0..da732e3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php @@ -36,7 +36,7 @@ function testNormal() { */ function testMissing() { // Try to delete a non-existing file - $this->assertTrue(file_unmanaged_delete(file_default_scheme() . '/' . $this->randomName()), 'Returns true when deleting a non-existent file.'); + $this->assertTrue(file_unmanaged_delete(config('system.file')->get('default_scheme') . '/' . $this->randomName()), 'Returns true when deleting a non-existent file.'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php index 6e0ec14..6d49900 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php @@ -25,6 +25,7 @@ public static function getInfo() { function testNormal() { // Create a file for testing $uri = $this->createUri(); + $file_chmod_file = config('system.file')->get('chmod.file'); // Moving to a new name. $desired_filepath = 'public://' . $this->randomName(); @@ -33,7 +34,7 @@ function testNormal() { $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.'); $this->assertTrue(file_exists($new_filepath), 'File exists at the new location.'); $this->assertFalse(file_exists($uri), 'No file remains at the old location.'); - $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($new_filepath, $file_chmod_file); // Moving with rename. $desired_filepath = 'public://' . $this->randomName(); @@ -44,7 +45,7 @@ function testNormal() { $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.'); $this->assertTrue(file_exists($newer_filepath), 'File exists at the new location.'); $this->assertFalse(file_exists($new_filepath), 'No file remains at the old location.'); - $this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($newer_filepath, $file_chmod_file); // TODO: test moving to a directory (rather than full directory/file path) // TODO: test creating and moving normal files (rather than streams) diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php index cde75c7..47acba3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php @@ -28,7 +28,7 @@ function testFileSaveData() { // No filename. $filepath = file_unmanaged_save_data($contents); $this->assertTrue($filepath, 'Unnamed file saved correctly.'); - $this->assertEqual(file_uri_scheme($filepath), file_default_scheme(), "File was placed in Drupal's files directory."); + $this->assertEqual(file_uri_scheme($filepath), config('system.file')->get('default_scheme'), "File was placed in Drupal's files directory."); $this->assertEqual($contents, file_get_contents($filepath), 'Contents of the file are correct.'); // Provide a filename. @@ -36,6 +36,6 @@ function testFileSaveData() { $this->assertTrue($filepath, 'Unnamed file saved correctly.'); $this->assertEqual('asdf.txt', drupal_basename($filepath), 'File was named correctly.'); $this->assertEqual($contents, file_get_contents($filepath), 'Contents of the file are correct.'); - $this->assertFilePermissions($filepath, variable_get('file_chmod_file', 0664)); + $this->assertFilePermissions($filepath, config('system.file')->get('chmod.file')); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/FileTransfer/FileTransferTest.php b/core/modules/system/lib/Drupal/system/Tests/FileTransfer/FileTransferTest.php index e106e04..2f73f15 100644 --- a/core/modules/system/lib/Drupal/system/Tests/FileTransfer/FileTransferTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/FileTransfer/FileTransferTest.php @@ -91,7 +91,7 @@ function testJail() { $gotit = TRUE; try { - $this->testConnection->copyDirectory($source, DRUPAL_ROOT . '/'. variable_get('file_public_path', conf_path() . '/files')); + $this->testConnection->copyDirectory($source, DRUPAL_ROOT . '/'. config('system.file')->get('path.public')); } catch (FileTransferException $e) { $gotit = FALSE; diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php index 611126d..8557cc2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php @@ -244,7 +244,7 @@ function testManipulations() { $correct_dimensions_object = FALSE; } - $directory = file_default_scheme() . '://imagetests'; + $directory = config('system.file')->get('default_scheme') . '://imagetests'; file_prepare_directory($directory, FILE_CREATE_DIRECTORY); image_save($image, $directory . '/' . $op . '.' . $image->info['extension']); diff --git a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php index 6280cc4..125393f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/FileStorageTest.php @@ -25,11 +25,11 @@ function setUp() { parent::setUp(); $conf['php_storage']['simpletest'] = array( 'class' => 'Drupal\Component\PhpStorage\FileStorage', - 'directory' => DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php', + 'directory' => DRUPAL_ROOT . '/' . config('system.file')->get('path.public') . '/php', ); $conf['php_storage']['readonly'] = array( 'class' => 'Drupal\Component\PhpStorage\FileReadOnlyStorage', - 'directory' => DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php', + 'directory' => DRUPAL_ROOT . '/' . config('system.file')->get('path.public') . '/php', // Let this read from the bin where the other instance is writing. 'bin' => 'simpletest', ); diff --git a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php index a0649cb..8a3998c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/PhpStorage/MTimeProtectedFileStorageTest.php @@ -36,7 +36,7 @@ function setUp() { $this->secret = $this->randomName(); $conf['php_storage']['simpletest'] = array( 'class' => $this->storageClass, - 'directory' => DRUPAL_ROOT . '/' . variable_get('file_public_path', conf_path() . '/files') . '/php', + 'directory' => DRUPAL_ROOT . '/' . config('system.file')->get('path.public') . '/php', 'secret' => $this->secret, ); } @@ -60,7 +60,7 @@ function testSecurity() { $php = drupal_php_storage('simpletest'); $name = 'simpletest.php'; $php->save($name, 'get('path.public') . '/php/simpletest'; $expected_directory = $expected_root_directory . '/' . $name; $directory_mtime = filemtime($expected_directory); $expected_filename = $expected_directory . '/' . hash_hmac('sha256', $name, $this->secret . $directory_mtime) . '.php'; diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php index 3d0188d..1262a97 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -45,7 +45,7 @@ function setUp() { function testThemeSettings() { // Specify a filesystem path to be used for the logo. $file = current($this->drupalGetTestFiles('image')); - $file_relative = strtr($file->uri, array('public:/' => variable_get('file_public_path', conf_path() . '/files'))); + $file_relative = strtr($file->uri, array('public:/' => config('system.file')->get('path.public'))); $default_theme_path = 'core/themes/stark'; $supported_paths = array( @@ -97,7 +97,7 @@ function testThemeSettings() { if (file_uri_scheme($input) == 'public') { $implicit_public_file = file_uri_target($input); $explicit_file = $input; - $local_file = strtr($input, array('public:/' => variable_get('file_public_path', conf_path() . '/files'))); + $local_file = strtr($input, array('public:/' => config('system.file')->get('path.public'))); } // Adjust for fully qualified stream wrapper URI elsewhere. elseif (file_uri_scheme($input) !== FALSE) { @@ -107,7 +107,7 @@ function testThemeSettings() { elseif ($input == file_uri_target($file->uri)) { $implicit_public_file = $input; $explicit_file = 'public://' . $input; - $local_file = variable_get('file_public_path', conf_path() . '/files') . '/' . $input; + $local_file = config('system.file')->get('path.public') . '/' . $input; } $this->assertEqual((string) $elements[0], $implicit_public_file); $this->assertEqual((string) $elements[1], $explicit_file); @@ -132,9 +132,9 @@ function testThemeSettings() { // Relative path within the public filesystem to non-existing file. 'whatever.png', // Relative path to non-existing file in public filesystem. - variable_get('file_public_path', conf_path() . '/files') . '/whatever.png', + config('system.file')->get('path.public') . '/whatever.png', // Semi-absolute path to non-existing file in public filesystem. - '/' . variable_get('file_public_path', conf_path() . '/files') . '/whatever.png', + '/' . config('system.file')->get('path.public') . '/whatever.png', // Relative path to arbitrary non-existing file. 'core/misc/whatever.png', // Semi-absolute path to arbitrary non-existing file. diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php index 812bde7..f30c7a0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php @@ -115,9 +115,9 @@ protected function setUp() { } // Set path variables. - $this->variable_set('file_public_path', $this->public_files_directory); - $this->variable_set('file_private_path', $this->private_files_directory); - $this->variable_set('file_temporary_path', $this->temp_files_directory); + config('system.file')->set('path.public', $this->public_files_directory); + config('system.file')->set('path.private', $this->private_files_directory); + config('system.file')->set('path.temporary', $this->temp_files_directory); $this->pass('Finished loading the dump.'); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 2d7e194..fea1405 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -523,7 +523,7 @@ function system_theme_settings($form, &$form_state, $key = '') { // Prepare local file path for description. if ($original_path && isset($friendly_path)) { - $local_file = strtr($original_path, array('public:/' => variable_get('file_public_path', conf_path() . '/files'))); + $local_file = strtr($original_path, array('public:/' => config('system.file')->get('path.public'))); } elseif ($key) { $local_file = drupal_get_path('theme', $key) . '/' . $default; @@ -1715,11 +1715,11 @@ function system_clear_page_cache_submit($form, &$form_state) { * @ingroup forms * @see system_settings_form() */ -function system_file_system_settings() { +function system_file_system_settings($form, &$form_state) { $form['file_public_path'] = array( '#type' => 'textfield', '#title' => t('Public file system path'), - '#default_value' => variable_get('file_public_path', conf_path() . '/files'), + '#default_value' => config('system.file')->get('path.public'), '#maxlength' => 255, '#description' => t('A local file system path where public files will be stored. This directory must exist and be writable by Drupal. This directory must be relative to the Drupal installation directory and be accessible over the web.'), '#after_build' => array('system_check_directory'), @@ -1728,16 +1728,17 @@ function system_file_system_settings() { $form['file_private_path'] = array( '#type' => 'textfield', '#title' => t('Private file system path'), - '#default_value' => variable_get('file_private_path', ''), + '#default_value' => config('system.file')->get('path.private'), '#maxlength' => 255, '#description' => t('An existing local file system path for storing private files. It should be writable by Drupal and not accessible over the web. See the online handbook for more information about securing private files.', array('@handbook' => 'http://drupal.org/documentation/modules/file')), '#after_build' => array('system_check_directory'), ); + $temporary_path = config('system.file')->get('path.temporary'); $form['file_temporary_path'] = array( '#type' => 'textfield', '#title' => t('Temporary directory'), - '#default_value' => variable_get('file_temporary_path', file_directory_temp()), + '#default_value' => ($temporary_path == NULL) ? file_directory_temp() : $temporary_path, '#maxlength' => 255, '#description' => t('A local file system path where temporary files will be stored. This directory should not be accessible over the web.'), '#after_build' => array('system_check_directory'), @@ -1748,17 +1749,32 @@ function system_file_system_settings() { $options[$scheme] = check_plain($info['description']); } + $default_scheme = config('system.file')->get('default_scheme'); if (!empty($options)) { $form['file_default_scheme'] = array( '#type' => 'radios', '#title' => t('Default download method'), - '#default_value' => variable_get('file_default_scheme', isset($options['public']) ? 'public' : key($options)), + '#default_value' => isset($options[$default_scheme]) ? $default_scheme : key($options), '#options' => $options, '#description' => t('This setting is used as the preferred download method. The use of public files is more efficient, but does not provide any access control.'), ); } - return system_settings_form($form); + return system_config_form($form, $form_state); +} + +/** + * Submit handler for the site file handling form. + * + * @see system_file_system_settings() + */ +function system_file_system_settings_submit($form, &$form_state) { + config('system.file') + ->set('path.public', $form_state['values']['file_public_path']) + ->set('path.private', $form_state['values']['file_private_path']) + ->set('path.temporary', $form_state['values']['file_temporary_path']) + ->set('default_scheme', $form_state['values']['file_default_scheme']) + ->save(); } /** diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 28d95da..027fa08 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -314,7 +314,7 @@ function system_requirements($phase) { variable_get('file_public_path', conf_path($require_settings, $reset_cache) . '/files'), // By default no private files directory is configured. For private files // to be secure the admin needs to provide a path outside the webroot. - variable_get('file_private_path', FALSE), + config('system.file')->get('path.private'), ); // Do not check for the temporary files directory during installation @@ -383,7 +383,7 @@ function system_requirements($phase) { } } else { - if (file_default_scheme() == 'public') { + if (config('system.file')->get('default_scheme') == 'public') { $requirements['file system']['value'] = $t('Writable (public download method)'); } else { @@ -2185,6 +2185,20 @@ function system_update_8023() { } /** + * Moves file system settings from variables to config. + */ +function system_update_8024() { + update_variables_to_config('system.file', array( + 'file_default_scheme' => 'default_scheme', + 'file_chmod_file' => 'chmod.file', + 'file_chmod_directory' => 'chmod.directory', + 'file_public_path' => 'path.public', + 'file_private_path' => 'path.private', + 'file_temporary_path' => 'path.temporary', + )); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 34e36fe..f71b8bf 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1959,7 +1959,7 @@ function system_stream_wrappers() { ); // Only register the private file stream wrapper if a file path has been set. - if (variable_get('file_private_path', FALSE)) { + if (config('system.file')->get('path.private')) { $wrappers['private'] = array( 'name' => t('Private files'), 'class' => 'Drupal\Core\StreamWrapper\PrivateStream', diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php index 2660300..9fa9b27 100644 --- a/core/modules/user/lib/Drupal/user/UserStorageController.php +++ b/core/modules/user/lib/Drupal/user/UserStorageController.php @@ -117,7 +117,7 @@ protected function preSave(EntityInterface $entity) { // and make it permanent. if (!$picture->status) { $info = image_get_info($picture->uri); - $picture_directory = file_default_scheme() . '://' . variable_get('user_picture_path', 'pictures'); + $picture_directory = config('system.file')->get('default_scheme') . '://' . variable_get('user_picture_path', 'pictures'); // Prepare the pictures directory. file_prepare_directory($picture_directory, FILE_CREATE_DIRECTORY); diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index 180b9f1..0718881 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -350,7 +350,7 @@ function user_admin_settings($form, &$form_state) { ); // If picture support is enabled, check whether the picture directory exists. if (variable_get('user_pictures', 0)) { - $picture_path = file_default_scheme() . '://' . variable_get('user_picture_path', 'pictures'); + $picture_path = config('system.file')->get('default_scheme') . '://' . variable_get('user_picture_path', 'pictures'); if (!file_prepare_directory($picture_path, FILE_CREATE_DIRECTORY)) { form_set_error('user_picture_path', t('The directory %directory does not exist or is not writable.', array('%directory' => $picture_path))); watchdog('file system', 'The directory %directory does not exist or is not writable.', array('%directory' => $picture_path), WATCHDOG_ERROR); diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 2395a84..d453179 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -464,7 +464,7 @@ function simpletest_script_cleanup($test_id, $test_class, $exitcode) { // Check whether a test file directory was setup already. // @see prepareEnvironment() - $public_files = variable_get('file_public_path', conf_path() . '/files'); + $public_files = config('system.file')->get('path.public'); $test_directory = $public_files . '/simpletest/' . substr($db_prefix, 10); if (is_dir($test_directory)) { // Output the error_log.