// Before 8.7.0 only this was possible.
file_unmanaged_copy($source, $destination);

// After 8.7.0 this is the new way. The prior code still works but is deprecated.
\Drupal::service('file_system')->copy($source, $destination);

We should switch to the new code at some point.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oknate created an issue. See original summary.

oknate’s picture

Component: Miscellaneous » Deprecation updates
oknate’s picture

Issue tags: +Novice
R.shaikh’s picture

Assigned: Unassigned » R.shaikh
R.shaikh’s picture

@Nate Andersen (oknate).. I have made changes as you suggested.
Kindly review.

R.shaikh’s picture

Status: Active » Needs review
oknate’s picture

Status: Needs review » Reviewed & tested by the community

Looks goods.

  • oknate committed f3f8367 on 8.x-1.x authored by R.shaikh
    Issue #3054210 by R.shaikh: file_unmanaged_copy Deprecated in Drupal 8.7
    

  • oknate committed 7dc41e0 on 8.x-2.x authored by R.shaikh
    Issue #3054210 by R.shaikh: file_unmanaged_copy Deprecated in Drupal 8.7
    
oknate’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks. Since this only affects the tests, I think it's fine to commit. Most likely no one will be running the tests for the module on less than Drupal 8.7.

Status: Fixed » Closed (fixed)

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