Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eMPee584’s picture

Issue tags: +Usability, +API clean-up

(tagging)

sun’s picture

The same also for file_unmanaged_delete_recursive(), please.

eMPee584’s picture

np but still doubtful about the last doc change, is that *really* better English ?*g

sun’s picture

The recursive function invokes itself recursive - does that work with drupal_realpath()?

eMPee584’s picture

Yes all test cases passing.. there might be a few CPU instructions to save doing

function file_unmanaged_delete_recursive($path) {
  // Resolve streamwrapper URI to local path.
  if (!is_dir($path)) {
    drupal_realpath($path);
  }
  if (is_dir($path)) {
  ...

or not, don't think that's better though.

sun’s picture

The more I look into the local stream wrapper classes, the more I'm unsure whether these two functions aren't properly supporting streams already (so this would be a documentation-only issue). Are you sure?

If they really do not, then I guess we just have to instantiate proper stream wrappers instead of assuming all unmanaged files are local.

See also:
- http://php.net/manual/en/wrappers.file.php
- http://php.net/manual/en/streamwrapper.unlink.php

eMPee584’s picture

The more I look into the local stream wrapper classes, the more I'm unsure whether these two functions aren't properly supporting streams already (so this would be a documentation-only issue). Are you sure?

YES, i tried and it did not work. That's the point *g

drewish’s picture

i didn't apply this but the changes look sane.

sun’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +D7 API clean-up

Tagging absolutely critical clean-ups for D7. Do not touch this tag. Please either help with this or one of the other patches having this tag.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

This looks like a good change. Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

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

jbrown’s picture

Version: 7.x-dev » 8.x-dev
Category: task » bug
Status: Closed (fixed) » Needs review
FileSize
958 bytes

This patch was incorrect - it is up to the streamwrapper to delete the underlying file.

Currently, the only way for remote streamwrappers to be able delete a file is if they return the full URI from DrupalStreamWrapperInterface::realpath().

jbrown’s picture

jbrown’s picture

Status: Needs review » Closed (duplicate)
gisle’s picture

Issue summary: View changes
Issue tags: -D7 API clean-up

Removing non-canonical duplicate tag. See #2426171: Multiple tags similar to 'API clean-up' for background.