public function get_file_by_id($fileid) {
        global $DB;

        $sql = "SELECT ".self::instance_sql_fields('f', 'r')."
                  FROM {files} f
             LEFT JOIN {files_reference} r
                       ON f.referencefileid = r.id
                 WHERE f.id = ?";
        if ($filerecord = $DB->get_record_sql($sql, array($fileid))) {
            return $this->get_file_instance($filerecord);
        } else {
            return false;
        }
    }
public function get_file_by_id($fileid) {
        global $DB;

        $sql = "SELECT ".self::instance_sql_fields('f', 'r')."
                  FROM {files} f
             LEFT JOIN {files_reference} r
                       ON f.referencefileid = r.id
                 WHERE f.id = ?";
        if ($filerecord = $DB->get_record_sql($sql, array($fileid))) {
            return $this->get_file_instance($filerecord);
        } else {
            return false;
        }
    }
public function get_file_by_id ( $ fileid ) { global $ DB ; $ sql = "SELECT " . self :: instance_sql_fields ( 'f' , 'r' ) . "
                  FROM {files} f
             LEFT JOIN {files_reference} r
                       ON f.referencefileid = r.id
                 WHERE f.id = ?" ; if ( $ filerecord = $ DB -> get_record_sql ( $ sql , array ( $ fileid ) ) ) { return $ this -> get_file_instance ( $ filerecord ) ; } else { return false ; } }
Fetch file using local file id.

Please do not rely on file ids, it is usually easier to use
pathname hashes instead.

@param int $fileid file ID
@return stored_file|bool stored_file instance if exists, false if not
Fetch file using local file id .