\CloudFileExtension
This is added to all File objects for shared functionality.
- Author: Mark Guinn <mark@adaircreative.com>
Synopsis
class CloudFileExtension
extends DataExtension
{
- // members
- private static array $db = ;
- protected File|CloudFileExtension $owner;
- private boolean $inUpdate = false;
- // methods
- public void onBeforeWrite()
- public void onAfterWrite()
- public void onAfterDelete()
- public File updateCloudStatus()
- public bool canBeInCloud()
- public bool containsPlaceholder()
- public void convertToPlaceholder()
- public CloudBucket getCloudBucket()
- public string getCloudURL()
- public array getCloudMeta()
- public File setCloudMeta()
- public void downloadFromCloud()
- public void createLocalIfNeeded()
- public bool isCloudPutNeeded()
- public bool isLocalMissing()
Hierarchy
Extends
- DataExtension
Members
Methods
public
- canBeInCloud()
- containsPlaceholder()
- convertToPlaceholder() — Wipes out the contents of this file and replaces with placeholder text
- createLocalIfNeeded() — If the file is present in the database and the cloud but not locally, create a placeholder for it. This can happen in a lot of cases such as load balanced servers and local development.
- downloadFromCloud() — If this file is stored in the cloud, downloads the cloud copy and replaces whatever is local.
- getCloudBucket()
- getCloudMeta()
- getCloudURL()
- isCloudPutNeeded()
- isLocalMissing() — Returns true if the local file is not available
- onAfterDelete() — Delete the file from the cloud (if it was ever there)
- onAfterWrite() — Update cloud status any time the file is written
- onBeforeWrite() — Handle renames
- setCloudMeta()
- updateCloudStatus() — Performs two functions: 1. Wraps this object in CloudFile (etc) by changing the classname if it should be and is not 2. Uploads the file to the cloud storage if it doesn't contain the placeholder