Added comments to CcFiles and CloudFile classes.
This commit is contained in:
parent
01ad2ab832
commit
e23649173d
2 changed files with 29 additions and 4 deletions
|
@ -71,6 +71,9 @@ class CcFiles extends BaseCcFiles {
|
|||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file size in bytes.
|
||||
*/
|
||||
public function getFileSize()
|
||||
{
|
||||
return filesize($this->getAbsoluteFilePath());
|
||||
|
@ -82,11 +85,17 @@ class CcFiles extends BaseCcFiles {
|
|||
return $info['filename'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file's absolute file path stored on disk.
|
||||
*/
|
||||
public function getURLForTrackPreviewOrDownload()
|
||||
{
|
||||
return $this->getAbsoluteFilePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file's absolute file path stored on disk.
|
||||
*/
|
||||
public function getAbsoluteFilePath()
|
||||
{
|
||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->getDbDirectory());
|
||||
|
@ -99,6 +108,9 @@ class CcFiles extends BaseCcFiles {
|
|||
return Application_Common_OsPath::join($directory, $filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the file is a regular file that can be previewed and downloaded.
|
||||
*/
|
||||
public function isValidFile()
|
||||
{
|
||||
return is_file($this->getAbsoluteFilePath());
|
||||
|
@ -106,7 +118,7 @@ class CcFiles extends BaseCcFiles {
|
|||
|
||||
/**
|
||||
*
|
||||
* Deletes the file from the stor directory
|
||||
* Deletes the file from the stor directory on disk.
|
||||
*/
|
||||
public function deletePhysicalFile()
|
||||
{
|
||||
|
|
|
@ -5,7 +5,9 @@ require_once 'Amazon_S3.php';
|
|||
/**
|
||||
* Skeleton subclass for representing a row from the 'cloud_file' table.
|
||||
*
|
||||
*
|
||||
* Each cloud_file has a corresponding cc_file referenced as a foreign key.
|
||||
* The file's metadata is stored in the cc_file table. This, cloud_file,
|
||||
* table represents files that are stored on Amazon S3.
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
|
@ -16,6 +18,11 @@ require_once 'Amazon_S3.php';
|
|||
class CloudFile extends BaseCloudFile
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a signed URL to the file's object on Amazon S3. Since we are
|
||||
* requesting the file's object via this URL, it needs to be signed because
|
||||
* all objects stored on Amazon S3 are private.
|
||||
*/
|
||||
public function getURLForTrackPreviewOrDownload()
|
||||
{
|
||||
return $this->getAbsoluteFilePath()."?".$this->getAuthenticationParams();
|
||||
|
@ -23,7 +30,7 @@ class CloudFile extends BaseCloudFile
|
|||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* Returns a url to the file's object on Amazon S3.
|
||||
*/
|
||||
public function getAbsoluteFilePath()
|
||||
{
|
||||
|
@ -62,6 +69,9 @@ class CloudFile extends BaseCloudFile
|
|||
return "AWSAccessKeyId=$s3_access_key&Expires=$expires&Signature=$signature";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file size in bytes.
|
||||
*/
|
||||
public function getFileSize()
|
||||
{
|
||||
$amazon_s3 = new Amazon_S3();
|
||||
|
@ -80,6 +90,9 @@ class CloudFile extends BaseCloudFile
|
|||
return $this->getDbFilepath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the file is a regular file that can be previewed and downloaded.
|
||||
*/
|
||||
public function isValidFile()
|
||||
{
|
||||
$ch = curl_init();
|
||||
|
@ -125,7 +138,7 @@ class CloudFile extends BaseCloudFile
|
|||
|
||||
/**
|
||||
*
|
||||
* Deletes the cloud_file's 'parent' object before itself
|
||||
* Deletes the cc_file and cloud_file entries from the database.
|
||||
*/
|
||||
public function delete(PropelPDO $con = NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue