function file_unmanaged_delete
Same name in other branches
- 7.x includes/file.inc \file_unmanaged_delete()
Deletes a file without database changes or hook invocations.
This function should be used when the file to be deleted does not have an entry recorded in the files table.
Parameters
$path: A string containing a file path or (streamwrapper) URI.
Return value
TRUE for success or path does not exist, or FALSE in the event of an error.
Deprecated
in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::delete().
See also
file_unmanaged_delete_recursive()
https://www.drupal.org/node/3006851
Related topics
1 call to file_unmanaged_delete()
- FileSystemDeprecationTest::testDeprecatedUnmanagedFileDelete in core/
tests/ Drupal/ KernelTests/ Core/ File/ FileSystemDeprecationTest.php - @expectedDeprecation file_unmanaged_delete() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::delete(). See https://www.drupal.org/node/3006851.
File
-
core/
includes/ file.inc, line 828
Code
function file_unmanaged_delete($path) {
@trigger_error('file_unmanaged_delete() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::delete(). See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
try {
return \Drupal::service('file_system')->delete($path);
} catch (FileException $e) {
return FALSE;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.