Add stage_file_proxy stream wrapper

Created on 5 December 2017, over 6 years ago
Updated 28 November 2023, 7 months ago

Calls to Image::isValid() return false when the file doesn't exist on the local environment, regardless of whether or not it exists in the origin.

Expected behaviour:
stage_file_proxy should intercept calls to Image::isValid() and try to obtain the image from the origin if it doesn't exist locally.

Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

🇬🇧United Kingdom nicrodgers Monmouthshire, UK

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Merge Requests

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

    Not sure if it matters but 🐛 Add a lock around retrieving upstream files Fixed was merged

  • I tried patch #67 with version 1.1 and private images fail to download from origin server. Since there is no patch for version 2, is there any other approach to make private files work?

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • 🇮🇳India kunalkursija Mumbai

    Patch #67 on stage_file_proxy 8.x-1.1 worked for me. However, The application that I am working on serves the private files from the overridden path(not system/files). Hence I had to save the patch locally and make below changes:

    • The private files directory in my application is configured via settings.php in $settings['file_private_path'], So I updated the FetchManager.php file's code $file_dir = $this->fetchInfoService->getLocalSchemePath($fetchInfo->getScheme()); to $file_dir = \Drupal\Core\Site\Settings::get('file_private_path');. This ensures that stage_file_proxy saves the private files at the location from which they are read/served.
    • The functions getUrlBasePath() & getFetchInfo() of SfpPrivateStream.php class has hardcoded the paths system/files & system/files/styles respectively. However, In my case, the files were being served from different paths and hence I updated it to suit my need.

    The above changes made the patch #67 work for me.

  • 🇺🇸United States smustgrave

    This is the last ticket needed for the 2.0.3 release fyi.

  • 🇬🇧United Kingdom nicrodgers Monmouthshire, UK

    @smustgrave it may be worth carrying on with 2.0.3 without this one, and adding this in when it's ready.

  • 🇺🇸United States johnle

    I did my best to try to reroll this to version 2.1.1, there is quite a bit of code refactoring to 2.0 that made it a challenge. This is working, but probably could use some more tweaking + testing + cleanup. One thing I've notice is that some of the code from 1x. is no longer in 2.x like the webp support code.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update 8 months ago
    Patch Failed to Apply
  • 🇺🇸United States smustgrave

    Started a new branch for just this feature
    Rerolled what I could 🐛 Error retrieving images from styles that use ConvertImageEffect Fixed will have to be tested again as that was using the variables we removed.
    Also removed all deprecated functions and interfaces.

  • Merge request !59Draft: Reroll → (Open) created by smustgrave
  • 🇺🇸United States smustgrave

    Needs some work for upgrade paths but StageFileProxyServiceProvider needs some work as it's breaking the module from being installed and I can't see why.

Production build 0.69.0 2024