Targets, requirements, functional discription

This chapter contains all the requirements (what should it do), functional descriptions (what does what) and the targets (what we watn to achieve). Please log in to edit, this is a first draft.

Requirements

  • Any module should be able to use the uploads with any node (any node can contain an audio file)
  • A module should be able to carry a dedicated uplaod with a private node (node type audio can only contain audio files)
  • Any module can override the upload fields (image module might want to replace teh word ‘file’ with ‘image’)
  • Any module can add items to the upload fields (image module might want an extra ‘thumbnail upload’ field to override thunmbnails)
  • A custom node type can require an exact number of uploads. (I.e. a multimedia lesson type could require one video, one image, and 2 flash files).
  • Upload module will announce its file, on upload, to all modules via a hook. They can then use the mime or other field to decide if they want to modify the file
  • Upload module will announce its file, on download, to all modules via a hook. They can then use the mime or other field to decide if they want to modify the file, or trigger some event
  • On download, a module may deny access to the requested file.
  • Upload module will announce its file, on a cron run, to all modules via a hook. They can then use the mime or other field to decide if they want to modify the file, or trigger some event
  • Any module can add information and settings to the uplod configuration page

Targets

  • Make uplaod a general upload centre
  • Make the file system modular, so other modules can reuse its features.
  • Make suer all modules are aware of eachothers files on three events: uplaod, cron and download (aka view)

Functional descriptions

  • $files[$fid] is an array that contains files objects
  • Each file object contains:
    • filename
    • path
    • source: I don’t know why this is there now.
    • filemime
    • filesize
    • oid (node id, comment id, any object id)
    • vid (version id, for revisions)
    • inline (can the file be shown inline)
    • show (do we/user allow the file to show, now called “list”)
    • object_type (node, comment, term, user)
    • data (specific data, like ID3 tags, exif info, PDF metadata etc)
  • fileapi($file) (an api, modelled after nodeapi)
    • form: alter or add items to the uplaod form
    • validate: a file is uploaded, validate it
    • insert: a file is inserted/uploaded
    • delete: a file is deleted
    • cron: a cron is ran
    • download: a download is called (or a file is viewed outside of the page)
    • view: a file is viewed inline
    • settings: add stuff to the upload settings page. hook should retulrn a Form array. To modify the default form, just return a modified $form[‘settings_genera’]
  • file.inc calls file.protocol.description.inc, based on:
    • the stored ‘path’ in the files table
  • file.protocol.description.inc contains all the tough work, optimised for that file storage protocol. it is build up as:
    • file.protocol.description.inc: indicates its part of the file API
    • file.filemethod.description.inc: the method for storing. The path of the files in the files table contains the method too. Examples are:
      • file:// (file.file.unix.inc) local storage
      • http:// (file.http.remote.inc) a file on another site
      • mysql:// (file.mysql.database.inc) a file stored as binary in the database
      • smb:// (file.smb.database.inc) a file on a samba network share
      • yniip:// (file.yniip.database.inc) you name it, its possible
    • file.filemethod.description.inc: this is only there to be able to differentiate between various include files with the same method. An example is the difference between file.file.unix.inc and file.file.windows.inc. Another dialect could be file.file.peruser.inc wich stores files in directories like /files/1123/ for user 1123
  • To start, we have two methods: file.file.unix.inc and file.file.windows.inc
  • if someone volunteers we will have a file.http.remote.inc
  • The file.incs must support a range of API functions:
    • file_delete($file): removes the file from the FS
    • file_save($file, $file->filename): Save the file on the FS
    • file_check_uplaod($file): check if an uploaded file exists on the FS
    • file_copy: copies the file
    • file_move: moves the file
    • file_info: gives information about the file