OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Application\Model\File Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Application\Model\File:
+ Collaboration diagram for OxidEsales\EshopCommunity\Application\Model\File:

Public Member Functions

 __construct ()
 
 processFile ($sFileIndex)
 
 getStoreLocation ()
 
 isUnderDownloadFolder ()
 
 isUploaded ()
 
 delete ($sOxId=null)
 
 download ()
 
 exist ()
 
 hasValidDownloads ()
 
 getMaxDownloadsCount ()
 
 getMaxUnregisteredDownloadsCount ()
 
 getLinkExpirationTime ()
 
 getDownloadExpirationTime ()
 
 getSize ()
 

Public Attributes

const NO_USER = 2
 

Protected Member Functions

 _checkArticleFile ($aFileInfo)
 
 _getBaseDownloadDirPath ()
 
 _getFileLocation ()
 
 _getHashedFileDir ($sFileHash)
 
 _getFileHash ($sFileName)
 
 _uploadFile ($sSource, $sTarget)
 
 _deleteFile ()
 
 _getFilenameForUrl ()
 

Protected Attributes

 $_sCoreTable = 'oxfiles'
 
 $_sClassName = 'oxfile'
 
 $_sRelativeFilePath = null
 
 $_blIsPaid = null
 
 $_sDownloadLink = null
 
 $_blHasValidDownloads = null
 
 $_sManualUploadDir = "uploads"
 

Detailed Description

Article files manager.

Constructor & Destructor Documentation

◆ __construct()

OxidEsales\EshopCommunity\Application\Model\File::__construct ( )

Initialises the instance

Member Function Documentation

◆ _checkArticleFile()

OxidEsales\EshopCommunity\Application\Model\File::_checkArticleFile (   $aFileInfo)
protected

Checks if given file is valid upload file

Parameters
array$aFileInfoFile info array
Exceptions
oxExceptionThrows exception if file wasn't uploaded successfully.

◆ _deleteFile()

OxidEsales\EshopCommunity\Application\Model\File::_deleteFile ( )
protected

Checks if file is not used for other objects. If not used, unlink the file.

Returns
null|false

◆ _getBaseDownloadDirPath()

OxidEsales\EshopCommunity\Application\Model\File::_getBaseDownloadDirPath ( )
protected

Return full path of root dir where download files are stored

Returns
string

◆ _getFileHash()

OxidEsales\EshopCommunity\Application\Model\File::_getFileHash (   $sFileName)
protected

Calculates file hash. Currently MD5 is used.

Parameters
string$sFileNameFile name values
Returns
string

◆ _getFileLocation()

OxidEsales\EshopCommunity\Application\Model\File::_getFileLocation ( )
protected

Returns relative file path from oxConfig 'sDownloadsDir' variable.

Returns
string

◆ _getFilenameForUrl()

OxidEsales\EshopCommunity\Application\Model\File::_getFilenameForUrl ( )
protected

returns oxfile__oxfilename for URL usage converts spec symbols to xx combination

Returns
string

◆ _getHashedFileDir()

OxidEsales\EshopCommunity\Application\Model\File::_getHashedFileDir (   $sFileHash)
protected

Returns relative sub dir of oxconfig 'sDownloadsDir' of required file from supplied $sFileHash parameter. Creates dir in case it does not exist.

Parameters
string$sFileHashFile hash value
Returns
string

◆ _uploadFile()

OxidEsales\EshopCommunity\Application\Model\File::_uploadFile (   $sSource,
  $sTarget 
)
protected

Moves file from source to target and changes file mode. Returns true on success.

Parameters
string$sSourceSource filename
string$sTargetTarget filename
Returns
bool

◆ delete()

OxidEsales\EshopCommunity\Application\Model\File::delete (   $sOxId = null)

Deletes oxFile record from DB, removes orphan files.

Parameters
string$sOxIddefault null
Returns
bool

◆ download()

OxidEsales\EshopCommunity\Application\Model\File::download ( )

Supplies the downloadable file for client and exits

◆ exist()

OxidEsales\EshopCommunity\Application\Model\File::exist ( )

Check if file exist

Returns
bool

◆ getDownloadExpirationTime()

OxidEsales\EshopCommunity\Application\Model\File::getDownloadExpirationTime ( )

Returns download link expiration time in hours, after the first download

Returns
int

◆ getLinkExpirationTime()

OxidEsales\EshopCommunity\Application\Model\File::getLinkExpirationTime ( )

Returns ordered file link expiration time in hours

Returns
int

◆ getMaxDownloadsCount()

OxidEsales\EshopCommunity\Application\Model\File::getMaxDownloadsCount ( )

Returns max download count of file

Returns
int

◆ getMaxUnregisteredDownloadsCount()

OxidEsales\EshopCommunity\Application\Model\File::getMaxUnregisteredDownloadsCount ( )

Returns max download count of file, if user is not registered

Returns
int

◆ getSize()

OxidEsales\EshopCommunity\Application\Model\File::getSize ( )

Returns file size in bytes

Returns
int

◆ getStoreLocation()

OxidEsales\EshopCommunity\Application\Model\File::getStoreLocation ( )

Returns full filesystem path where files are stored. Make sure that object oxfiles__oxstorehash or oxfiles__oxfilename attribute is set before calling this method

Returns
string

◆ hasValidDownloads()

OxidEsales\EshopCommunity\Application\Model\File::hasValidDownloads ( )

Checks if this file has valid ordered downloads

Returns
bool

◆ isUnderDownloadFolder()

OxidEsales\EshopCommunity\Application\Model\File::isUnderDownloadFolder ( )

Return true if file is under download folder. Return false if file is above download folder or if file does not exist.

Returns
bool

◆ isUploaded()

OxidEsales\EshopCommunity\Application\Model\File::isUploaded ( )

Checks whether the file has been uploaded over admin area. Returns true in case file is uploaded (and hashed) over admin area. Returns false in case file is placed manually (ftp) to "out/downloads/uploads" dir. It's similar so don't get confused here.

Returns
bool

◆ processFile()

OxidEsales\EshopCommunity\Application\Model\File::processFile (   $sFileIndex)

Sets oxefile__oxstorehash with file hash. Moves file to desired location and change its access rights.

Parameters
int$sFileIndexFile index
Exceptions
oxExceptionThrows exception if file wasn't moved or if rights wasn't changed.

Member Data Documentation

◆ $_blHasValidDownloads

OxidEsales\EshopCommunity\Application\Model\File::$_blHasValidDownloads = null
protected

◆ $_blIsPaid

OxidEsales\EshopCommunity\Application\Model\File::$_blIsPaid = null
protected

◆ $_sClassName

OxidEsales\EshopCommunity\Application\Model\File::$_sClassName = 'oxfile'
protected

◆ $_sCoreTable

OxidEsales\EshopCommunity\Application\Model\File::$_sCoreTable = 'oxfiles'
protected

◆ $_sDownloadLink

OxidEsales\EshopCommunity\Application\Model\File::$_sDownloadLink = null
protected

◆ $_sManualUploadDir

OxidEsales\EshopCommunity\Application\Model\File::$_sManualUploadDir = "uploads"
protected

◆ $_sRelativeFilePath

OxidEsales\EshopCommunity\Application\Model\File::$_sRelativeFilePath = null
protected

◆ NO_USER

const OxidEsales\EshopCommunity\Application\Model\File::NO_USER = 2

No active user exception code.


The documentation for this class was generated from the following file: