function drush_register_file_for_deletion

8.0.x filesystem.inc drush_register_file_for_deletion($file = NULL)
6.x filesystem.inc drush_register_file_for_deletion($file = NULL)
7.x filesystem.inc drush_register_file_for_deletion($file = NULL)
3.x drush.inc drush_register_file_for_deletion($file = NULL)
4.x drush.inc drush_register_file_for_deletion($file = NULL)
5.x filesystem.inc drush_register_file_for_deletion($file = NULL)
master filesystem.inc drush_register_file_for_deletion($file = NULL)

Any file passed in to this function will be deleted when drush exits.

Related topics

8 calls to drush_register_file_for_deletion()
drush_download_file in includes/drush.inc
Download a file using wget, curl or file_get_contents, or via download cache.
drush_find_tmp in includes/drush.inc
Returns the path to a temporary directory.
drush_save_data_to_temp_file in includes/drush.inc
Save a string to a temporary file. Does not depend on Drupal's API. The temporary file will be automatically deleted when drush exits.
drush_tarball_extract in includes/drush.inc
Extract a tarball.
drush_tempdir in includes/drush.inc
Creates a temporary directory and return its path.

... See full list

File

includes/drush.inc, line 1893
The drush API implementation and helpers.

Code

function drush_register_file_for_deletion($file = NULL) {
  static $registered_files = array();

  if (isset($file)) {
    if (empty($registered_files)) {
      register_shutdown_function('_drush_delete_registered_files');
    }
    $registered_files[] = $file;
  }

  return $registered_files;
}