PHP Class BookStack\Services\AttachmentService

Inheritance: extends UploadService
Afficher le fichier Open project: ssddanbrown/bookstack

Méthodes publiques

Méthode Description
deleteFile ( Attachment $attachment ) Delete a File from the database and storage.
getAttachmentFromStorage ( Attachment $attachment ) : string Get an attachment from storage.
saveNewFromLink ( string $name, string $link, integer $page_id ) : Attachment Save a new File attachment from a given link and name.
saveNewUpload ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, integer $page_id ) : Attachment Store a new attachment upon user upload.
saveUpdatedUpload ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, Attachment $attachment ) : Attachment Store a upload, saving to a file and deleting any existing uploads attached to that file.
updateFile ( Attachment $attachment, $requestData ) : Attachment Update the details of a file.
updateFileOrderWithinPage ( array $attachmentList, $pageId ) Updates the file ordering for a listing of attached files.

Méthodes protégées

Méthode Description
deleteFileInStorage ( Attachment $attachment ) Delete a file from the filesystem it sits on.
putFileInStorage ( $attachmentName, Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile ) : string Store a file in storage with the given filename

Private Methods

Méthode Description
getStorageBasePath ( ) : string Get the file storage base path, amended for storage type.

Method Details

deleteFile() public méthode

Delete a File from the database and storage.
public deleteFile ( Attachment $attachment )
$attachment BookStack\Attachment

deleteFileInStorage() protected méthode

Cleans any empty leftover folders.
protected deleteFileInStorage ( Attachment $attachment )
$attachment BookStack\Attachment

getAttachmentFromStorage() public méthode

Get an attachment from storage.
public getAttachmentFromStorage ( Attachment $attachment ) : string
$attachment BookStack\Attachment
Résultat string

putFileInStorage() protected méthode

Store a file in storage with the given filename
protected putFileInStorage ( $attachmentName, Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile ) : string
$attachmentName
$uploadedFile Symfony\Component\HttpFoundation\File\UploadedFile
Résultat string

saveNewUpload() public méthode

Store a new attachment upon user upload.
public saveNewUpload ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, integer $page_id ) : Attachment
$uploadedFile Symfony\Component\HttpFoundation\File\UploadedFile
$page_id integer
Résultat BookStack\Attachment

saveUpdatedUpload() public méthode

Store a upload, saving to a file and deleting any existing uploads attached to that file.
public saveUpdatedUpload ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, Attachment $attachment ) : Attachment
$uploadedFile Symfony\Component\HttpFoundation\File\UploadedFile
$attachment BookStack\Attachment
Résultat BookStack\Attachment

updateFile() public méthode

Update the details of a file.
public updateFile ( Attachment $attachment, $requestData ) : Attachment
$attachment BookStack\Attachment
$requestData
Résultat BookStack\Attachment

updateFileOrderWithinPage() public méthode

Updates the file ordering for a listing of attached files.
public updateFileOrderWithinPage ( array $attachmentList, $pageId )
$attachmentList array
$pageId