function drupal_unlink

Same name in other branches
  1. 7.x includes/file.inc \drupal_unlink()

Deletes a file.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystem::unlink().

See also

\Drupal\Core\File\FileSystem::unlink()

https://www.drupal.org/node/2418133

Related topics

1 call to drupal_unlink()
FileSystemDeprecationTest::testUnlink in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
Tests deprecation of the drupal_unlink() function.

File

core/includes/file.inc, line 1032

Code

function drupal_unlink($uri, $context = NULL) {
    @trigger_error('drupal_unlink() is deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\File\\FileSystemInterface::unlink(). See https://www.drupal.org/node/2418133.', E_USER_DEPRECATED);
    return \Drupal::service('file_system')->unlink($uri, $context);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.