mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-09-29 20:59:09 +02:00
API Changed DMSDocument getters to be closer to existing File API
Reduces friction when migration from File records (which will be fairly common)
This commit is contained in:
parent
2038fb9829
commit
234ccb3b1c
@ -236,7 +236,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||||||
* Returns a link to download this document from the DMS store
|
* Returns a link to download this document from the DMS store
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function getDownloadLink() {
|
function getLink() {
|
||||||
return Controller::join_links(Director::baseURL(),'dmsdocument/'.$this->ID);
|
return Controller::join_links(Director::baseURL(),'dmsdocument/'.$this->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,14 +624,19 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||||||
/**
|
/**
|
||||||
* Return the extension of the file associated with the document
|
* Return the extension of the file associated with the document
|
||||||
*/
|
*/
|
||||||
function getFileExt() {
|
function getExtension() {
|
||||||
return strtolower(pathinfo($this->Filename, PATHINFO_EXTENSION));
|
return strtolower(pathinfo($this->Filename, PATHINFO_EXTENSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSize() {
|
||||||
|
$size = $this->getAbsoluteSize();
|
||||||
|
return ($size) ? File::format_size($size) : false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the size of the file associated with the document
|
* Return the size of the file associated with the document
|
||||||
*/
|
*/
|
||||||
function getFileSize() {
|
function getAbsoluteSize() {
|
||||||
return filesize($this->getFullPath());
|
return filesize($this->getFullPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,17 +130,26 @@ interface DMSDocumentInterface {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function getDownloadLink();
|
function getLink();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the extension of the file associated with the document
|
* Return the extension of the file associated with the document
|
||||||
*/
|
*/
|
||||||
function getFileExt();
|
function getExtension();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the size of the file associated with the document
|
* Returns the size of the file type in an appropriate format.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getFileSize();
|
function getSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the size of the file associated with the document, in bytes.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getAbsoluteSize();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user