Added comments to CcFiles and CloudFile classes.

This commit is contained in:
drigato 2014-10-30 12:12:47 -04:00
parent 01ad2ab832
commit e23649173d
2 changed files with 29 additions and 4 deletions

View file

@ -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)
{