CC-5896: Store cloud files in separate table, inherited from cc_files

This commit is contained in:
drigato 2014-07-24 16:56:15 -04:00
parent b38f3d7e03
commit f1ea100411
11 changed files with 165 additions and 130 deletions

View file

@ -15,4 +15,39 @@
*/
class CloudFile extends BaseCloudFile
{
public function getAbsoluteFilePath()
{
$CC_CONFIG = Config::getConfig();
return $CC_CONFIG["cloud_storage"]["host"]."/".$CC_CONFIG["cloud_storage"]["bucket"]."/" . urlencode($this->getResourceId());
}
public function getFileSize()
{
return strlen(file_get_contents($this->getAbsoluteFilePath()));
}
public function getFilename()
{
return $this->getResourceId();
}
public function isValidFile()
{
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $this->getAbsoluteFilePath(),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_VERBOSE => false
));
curl_exec($ch);
$http_status = curl_getinfo($ch);
if ($http_status["http_code"] === 200)
{
return true;
} else {
return false;
}
}
}