Currently the file module looks at all stream wrappers and presents everyone except 'temporary' as a possible file upload destination.

This seems terribly foolish to hard-code this way.

Wee should expand the data returned by hook_stream_wrappers() to include those as flags.

Comments

aaron’s picture

this is an excellent idea.

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new3.89 KB

Here's a quick pass at what a change could look like.

pwolanin’s picture

StatusFileSize
new3.86 KB

missed git flag

aaron’s picture

this is looking very usable atm -- in contrib, this will make some things a lot easier, such as remote read-only streams. i haven't tested yet, but will look at it in more detail tomorrow. great work, @pwolanin!

Status: Needs review » Needs work

The last submitted patch, 685074-rough-2.patch, failed testing.

pwolanin’s picture

Priority: Normal » Critical

Stream wrappers won't be usable without some version of this fix.

dries’s picture

This makes sense.

+++ includes/file.inc
@@ -90,16 +90,24 @@ define('FILE_STATUS_PERMANENT', 1);
+ *  Optionally filter out all types except these.  Defaults to
+ *  STREAM_WRAPPER_WRITABLEL. Set to 0 to not filter.

Wrong constant? Haz typo?

+++ includes/stream_wrappers.inc
@@ -20,6 +20,18 @@
+define ('STREAM_WRAPPER_LOCAL', 0x0001);
+define ('STREAM_WRAPPER_REMOTE', 0x0002);
+define ('STREAM_WRAPPER_READ', 0x0004);
+define ('STREAM_WRAPPER_WRITE', 0x0008);
+define ('STREAM_WRAPPER_VISIBLE', 0x0010);

I don't understand what _VISIBLE stands for. Visible to whom?

pwolanin’s picture

Certainly typo in the code comment.

VISIBLE here means visible in the UI at a source/destination - e.g. the temporary:// is not visible. we could flip the logic I guess to HIDDEN, but that requires an additional check I think.

I was thinking in analogy to menu callbacks which don't get the MENU_VISIBLE_IN_TREE bit flag.

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new6.04 KB

added code comments and fixed systedm.admin.inc.

Default filter is now STREAM_WRAPPERS_ALL, so hopefully tests will pass.

aaron’s picture

OK, this patch works perfectly.

Without it, if you install Media: YouTube or Media: Flickr, then both those streams incorrectly show up at admin/config/media/file-system.

After patching, and adding

  'type' => STREAM_WRAPPERS_READ_VISIBLE,

to hook_stream_wrappers(), the stream wrappers no longer show up.

This is RTBC as soon as the test passes.

pwolanin’s picture

StatusFileSize
new6.75 KB

oops - missed adding the filx to image field as well as file field.

dries’s picture

Priority: Critical » Normal
Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks for adding documentation. Committed to CVS HEAD. Thanks! I'm marking this 'needs work' because it could use some extra tests.

Tor Arne Thune’s picture

Title: Some stream wrappers need to be hidden or read-only » (Tests needed) Some stream wrappers need to be hidden or read-only
Version: 7.x-dev » 8.x-dev
Category: bug » task

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • Dries committed d53f3e3 on 8.3.x
    - Patch #685074 by pwolanin: some stream wrappers need to be hidden or...

  • Dries committed d53f3e3 on 8.3.x
    - Patch #685074 by pwolanin: some stream wrappers need to be hidden or...

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • Dries committed d53f3e3 on 8.4.x
    - Patch #685074 by pwolanin: some stream wrappers need to be hidden or...

  • Dries committed d53f3e3 on 8.4.x
    - Patch #685074 by pwolanin: some stream wrappers need to be hidden or...

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

  • Dries committed d53f3e3 on 9.1.x
    - Patch #685074 by pwolanin: some stream wrappers need to be hidden or...

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

kim.pepper’s picture

Issue summary: View changes
Status: Needs work » Fixed

This was committed but never closed.

kim.pepper’s picture

If there are tests required still we should open a new issue.

quietone’s picture

Version: 11.x-dev » 7.x-dev

@kim.pepper, thanks for closing this issue.

I am updating the meta data and credit to the time of the commit.

commit d53f3e39d5da63f20a90f3a221da139b7afa7673
Author: Dries Buytaert <dries@buytaert.net>
Date:   Tue Jan 26 08:29:25 2010 +0000

    - Patch #685074 by pwolanin: some stream wrappers need to be hidden or read-only.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.