class File implements ObjectInterface (View source)

Constants

CREATE_NEW_VERSION_THRESHOLD

Properties

$fID
$fDateAdded
$fPassword
$versions
$fOverrideSetPermissions
$ocID Originally placed on which page.
$author
$folderTreeNodeID
$storageLocation

Methods

__construct()

No description

__call($nm, $a)

For all methods that file does not implement, we pass through to the currently active file version object.

getPermissionObjectIdentifier()

Returns the identifier for the object, in this case the File ID.

string
getPassword()

Password used to protect the file if set.

int
getStorageLocationID()

Returns the FSL ID for the current file.

getFileVersions()

No description

reindex()

Reindex the attributes on this file.

save()

Persist any object changes to the database.

setStorageLocation(StorageLocation $location)

Set the storage location for the file.

bool
setFileStorageLocation(StorageLocation $newLocation)

Move a file from its current FSL to a new FSL.

setPassword($pw)

Sets the access password on a file.

setOriginalPage($ocID)

No description

getOriginalPageObject()

No description

bool
resetPermissions($fOverrideSetPermissions)

No description

int|null
getUserID()

Get the user ID of the author of the file (if available).

User|null
getUser()

Get the author of the file (if available).

setUser(User $user)

Set the user who authored the file.

int[]
getFileSetIDs()

Get the IDs of the file sets that this file belongs to.

FileSet[]
getFileSets()

Get the file sets that this file belongs to.

bool
isStarred(bool|User $u = false)

Tell if a file is starred by a user.

setDateAdded($fDateAdded)

Set the date a file was added Must call save() to persist.

getDateAdded()

No description

createNewVersion(bool $copyUnderlyingFile = false)

Create a new version of a file.

getVersionToModify(bool $forceCreateNew = false)

Returns a file version object that is to be written to. Computes whether we can use the current most recent version, OR a new one should be created.

int
getFileID()

File ID of the file.

setFileFolder(FileFolder $folder)

Folder to put the file in.

getFileFolderObject()

No description

getFileNodeObject()

No description

duplicate()

Duplicate a file The new file will have no version history.

Version|null
getApprovedVersion()

No description

bool
inFileSet(Set $fs)

If a file is in a particular file set.

bool
delete($removeNode = true)

Removes a file, including all of its versions.

getRecentVersion()

Returns the most recent FileVersion object.

getVersion(int $fvID = null)

returns the FileVersion object for the provided fvID if none provided returns the approved version.

getVersionList()

Returns an array of all FileVersion objects owned by this file.

int
getTotalDownloads()

Total number of downloads for a file.

array
getDownloadStatistics(int $limit = 20)

Get the download statistics for the current file.

trackDownload(int $rcID = null)

Tracks File Download, takes the cID of the page that the file was downloaded from.

isError() deprecated

No description

Details

__construct()

__call($nm, $a)

For all methods that file does not implement, we pass through to the currently active file version object.

Parameters

$nm
$a

getPermissionResponseClassName()

getPermissionAssignmentClassName()

getPermissionObjectKeyCategoryHandle()

getPermissionObjectIdentifier()

Returns the identifier for the object, in this case the File ID.

string getPassword()

Password used to protect the file if set.

Return Value

string

int getStorageLocationID()

Returns the FSL ID for the current file.

Return Value

int

StorageLocation getFileStorageLocationObject()

Return Value

StorageLocation

Version[] getFileVersions()

Return Value

Version[]

reindex()

Reindex the attributes on this file.

protected save()

Persist any object changes to the database.

setStorageLocation(StorageLocation $location)

Set the storage location for the file.

THIS DOES NOT MOVE THE FILE to move the file use setFileStorageLocation() Must call save() to persist changes.

Parameters

StorageLocation $location

bool setFileStorageLocation(StorageLocation $newLocation)

Move a file from its current FSL to a new FSL.

Parameters

StorageLocation $newLocation

Return Value

bool false if the storage location is the same

Exceptions

Exception

setPassword($pw)

Sets the access password on a file.

Parameters

$pw string

setOriginalPage($ocID)

Parameters

$ocID

getOriginalPageObject()

bool overrideFileFolderPermissions()

Return Value

bool

resetPermissions($fOverrideSetPermissions)

Parameters

$fOverrideSetPermissions

int|null getUserID()

Get the user ID of the author of the file (if available).

Return Value

int|null

User|null getUser()

Get the author of the file (if available).

Return Value

User|null

setUser(User $user)

Set the user who authored the file.

Parameters

User $user

int[] getFileSetIDs()

Get the IDs of the file sets that this file belongs to.

Return Value

int[]

FileSet[] getFileSets()

Get the file sets that this file belongs to.

Return Value

FileSet[]

bool isStarred(bool|User $u = false)

Tell if a file is starred by a user.

Parameters

bool|User $u User to check against if they starred a file, If no user is provided we used the current user

Return Value

bool true if the user starred

setDateAdded($fDateAdded)

Set the date a file was added Must call save() to persist.

Parameters

$fDateAdded

getDateAdded()

Version createNewVersion(bool $copyUnderlyingFile = false)

Create a new version of a file.

Parameters

bool $copyUnderlyingFile If we should copy the underlying file, or reference the original

Return Value

Version

Version getVersionToModify(bool $forceCreateNew = false)

Returns a file version object that is to be written to. Computes whether we can use the current most recent version, OR a new one should be created.

Parameters

bool $forceCreateNew If we should always create a new version even if we are below the threshold

Return Value

Version

int getFileID()

File ID of the file.

Return Value

int

setFileFolder(FileFolder $folder)

Folder to put the file in.

Parameters

FileFolder $folder

NodeType getFileFolderObject()

Return Value

NodeType

NodeType getFileNodeObject()

Return Value

NodeType

File duplicate()

Duplicate a file The new file will have no version history.

Return Value

File

Version|null getApprovedVersion()

Return Value

Version|null

bool inFileSet(Set $fs)

If a file is in a particular file set.

Parameters

Set $fs

Return Value

bool true if its in the set

bool delete($removeNode = true)

Removes a file, including all of its versions.

Parameters

$removeNode

Return Value

bool returns false if the on_file_delete event says not to proceed, returns true on success

Exceptions

Exception contains the exception type and message of why the deletion fails

Version getRecentVersion()

Returns the most recent FileVersion object.

Return Value

Version

Version getVersion(int $fvID = null)

returns the FileVersion object for the provided fvID if none provided returns the approved version.

Parameters

int $fvID

Return Value

Version

Version[] getVersionList()

Returns an array of all FileVersion objects owned by this file.

Return Value

Version[]

int getTotalDownloads()

Total number of downloads for a file.

Return Value

int

array getDownloadStatistics(int $limit = 20)

Get the download statistics for the current file.

Parameters

int $limit max number of stats to retrieve

Return Value

array

trackDownload(int $rcID = null)

Tracks File Download, takes the cID of the page that the file was downloaded from.

Parameters

int $rcID

isError() deprecated

deprecated