File placement

A file can be placed relative to another file.

Placement modifiers

The full list of placement modifiers:

BEFORE
AFTER
PREPEND
APPEND
FORCE
RENAME
TYPESAFE
TYPESAFE_IF_POSSIBLE

Direction

You must always specify the placement direction:

  • BEFORE places the file before the target file, in the same bucket as its previous sibling.

  • AFTER places the file after the target file, in the same bucket as its next sibling.

  • PREPEND places the file into the target file, to the beginning of the chosen bucket. The bucket is either provided, is automatically calculated, or defaults to 0.

  • APPEND places the file into the target file, to the end of the chosen bucket. The bucket is either provided, is automatically calculated, or defaults to 0.

Conflict resolution

If a file already exists at the target location, the conflict may be handled in the following ways:

  • By default, the operation will fail.

  • RENAME instructs the system to find a name that doesn’t conflict. This typically means suffixing the name with -2 or similar, though file extensions are respected, so foo.jpg becomes foo-2.jpg.

  • FORCE removes the conflicting file and proceeds with the placement.

Type safety

Apps define what kinds of files they support to store. For example, a gallery may be able to display images but no zip files. The app is said to accept files that it supports. (See .Accept rules.) In such cases, the placement is typesafe, otherwise it’s not.

When placing a file, one can instruct Boomla to consider typesafety in one of the following ways:

  • By default, typesafety is not considered and the operation will proceed.

  • TYPESAFE instructs the system to only place the file if the placement is typesafe. Otherwise, the operation shall fail. Using APPEND or PREPEND will instruct Boomla to find the first accepting bucket so the operation can succeed in a typesafe manner.

  • TYPESAFE_IF_POSSIBLE is only effective for APPEND and PREPEND operations. It instructs the system to try placing the file in a typesafe manner. If that is not possible, place the file in bucket 0 regardless. The following steps are taken:

    • If the bucket is provided, and it is typesafe, use that bucket.

    • Otherwise, if there is any typesafe bucket, use the first.

    • Otherwise, if the bucket is provided, use that.

    • Finally, use bucket 0.

Subscribe to our newsletter!