check_file() is a tiny wrapper around PHP's is_uploaded_file().

function check_file($filename) {
  return is_uploaded_file($filename);
}

According to api.drupal.org it has been around for since at least Drupal 4.6, but it has not been used anywhere in core in 4.6 or later.

The function name indicates that it returns an HTML-encoded string like check_plain(), check_markup() and check_url(), but it returns a boolean. Also, the name doesn't tell what kind of check is done. I think calling is_uploaded_file() directly is simpler and more readable, so I suggest removing the function.

CommentFileSizeAuthor
check_file-1.patch954 bytesc960657
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

It's true, it's never used and this is the proove you need to put this rtbc :)

searching: "check_file("

C:\Users\bram\workspace\drupal\includes\common.inc
    1176  function check_file($filename) {
1 match in C:\Users\bram\workspace\drupal\includes\common.inc
TOTAL:    1 match in 1 file  (1264 other files without matches not listed)

Nice catch c960657!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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