Deprecate \Drupal\Component\FileSystem\FileSystem::getOsTemporaryDirectory() and replace with sys_get_temp_dir()

Created on 24 June 2019, over 5 years ago
Updated 12 March 2023, over 1 year ago

Problem/Motivation

The method \Drupal\Component\FileSystem::getOsTemporaryDirectory() is trying to maintain multi-os compatibility instead of using php defaults.

Proposed resolution

Deprecate the method and replace it with sys_get_temp_dir().

Remaining tasks

None

User interface changes

None

API changes

The method \Drupal\Component\FileSystem::getOsTemporaryDirectory() is deprecated and replaced by
sys_get_temp_dir().

Data model changes

None

Release notes snippet

TBD

Original Issue

In #3039026-67: Deprecate file_directory_temp() and move to FileSystem service which adds "fallback" to configurable temporary dir the last fallback to this component which, according to https://www.php.net/manual/en/wrappers.php.php#wrappers.php.memory could be replaced with default stream wrapper
The whole component trying to maintain multi-os compatibility instead of using php defaults
The logic split into component & service could be simplified

📌 Task
Status

Needs work

Version

10.1

Component
File system 

Last updated about 11 hours ago

Created by

🇫🇷France andypost

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    Unfortunately missed the D10 window

    And still needs windows testing. (Can't do as I'm on a mac)

  • 🇮🇳India Akhil Yadav

    Added patch against #26 in 10.1 version

  • 🇫🇷France andypost
    +++ b/core/lib/Drupal/Component/FileSystem/FileSystem.php
    @@ -13,8 +13,14 @@ class FileSystem {
    +   * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
    ...
    +    @trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use sys_get_temp_dir() instead. See https://www.drupal.org/node/3225275', E_USER_DEPRECATED);
    

    message should be changed to 10.1.0 and 11.0.0

  • Made changes as per comment #35.

  • 🇫🇷France andypost

    See my patch in #26

    +++ b/core/tests/Drupal/Tests/Component/FileSystem/LegacyFileSystemTest.php
    @@ -0,0 +1,28 @@
    +  public function testDeprecatedGetOsTemporaryDirectory() {
    

    this test is missing in last reroll

  • First commit to issue fork.
  • @bhanu951 opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India bhanu951

    Raised a MR against 10.x branch from the patch in #26, addressed #35 and #37.

  • 🇧🇪Belgium BramDriesen Belgium 🇧🇪

    Came here for something else, decided to do a code review instead. 😇

    Merge request and changes looks good! @Bhanu951

    Still needs review for the manual Windows testing mentioned in #33 also on a Mac/Linux here.

  • 🇺🇸United States smustgrave

    Asked around and can't find anyone on a windows to do testing.

  • Status changed to Needs work over 1 year ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇧🇪Belgium BramDriesen Belgium 🇧🇪

    I have a Windows VM on which I could test it. Although it's not the "real deal" of course.

Production build 0.71.5 2024