Issue #3015687 by idebr: Replaced deprecated drupal_set_message() with messenger service; replaced drupal_tempnam() and drupal_basename() with file system service.