CC-2972: Find better way to determine domain which pypo should download from.

-Done
This commit is contained in:
Martin Konecny 2011-10-14 00:07:53 +02:00
parent 38f2290214
commit d8bcb3f03d
4 changed files with 25 additions and 5 deletions

View file

@ -435,14 +435,32 @@ class StoredFile {
}
/**
* Get the URL to access this file.
* Get the URL to access this file using the server name/address that
* this PHP script was invoked through.
*/
public function getFileUrl()
{
$serverName = $_SERVER['SERVER_NAME'];
$serverPort = $_SERVER['SERVER_PORT'];
return "http://$serverName:$serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
return constructGetFileUrl($serverName, $serverPort);
}
/**
* Get the URL to access this file using the server name/address that
* is specified in the airtime.conf config file.
*/
public function getFileUrlUsingConfigAddress(){
global $CC_CONFIG;
$serverName = $CC_CONFIG['baseUrl'];
$serverPort = $CC_CONFIG['basePort'];
return constructGetFileUrl($serverName, $serverPort);
}
private function constructGetFileUrl($p_serverName, $p_serverPort){
return "http://$p_serverName:$p_serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
}
/**