Merge branch '2.4.x' of dev.sourcefabric.org:airtime into 2.4.x
This commit is contained in:
commit
dd28c8ae31
2 changed files with 19 additions and 35 deletions
|
@ -26,6 +26,7 @@ class Config {
|
|||
$CC_CONFIG['webServerUser'] = $values['general']['web_server_user'];
|
||||
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
|
||||
|
||||
$CC_CONFIG['baseDir'] = $values['general']['base_dir'];
|
||||
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
||||
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
||||
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||
|
|
|
@ -501,44 +501,25 @@ SQL;
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the URL to access this file using the server name/address that
|
||||
* this PHP script was invoked through.
|
||||
* Get the URL to access this file
|
||||
*/
|
||||
public function getFileUrl()
|
||||
{
|
||||
$serverName = $_SERVER['SERVER_NAME'];
|
||||
$serverPort = $_SERVER['SERVER_PORT'];
|
||||
|
||||
return $this->constructGetFileUrl($serverName, $serverPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL to access this file using the server name/address that
|
||||
* is specified in the airtime.conf config file. If either of these is
|
||||
* not specified, then use values provided by the $_SERVER global variable.
|
||||
*/
|
||||
public function getFileUrlUsingConfigAddress()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
||||
if (isset($CC_CONFIG['baseUrl'])) {
|
||||
$serverName = $CC_CONFIG['baseUrl'];
|
||||
} else {
|
||||
$protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
||||
|
||||
$serverName = $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
|
||||
if (isset($CC_CONFIG['basePort'])) {
|
||||
$serverPort = $CC_CONFIG['basePort'];
|
||||
} else {
|
||||
$serverPort = $_SERVER['SERVER_PORT'];
|
||||
$subDir = $CC_CONFIG['baseDir'];
|
||||
|
||||
if ($subDir[0] === "/") {
|
||||
$subDir = substr($subDir, 1, strlen($subDir) - 1);
|
||||
}
|
||||
|
||||
return $this->constructGetFileUrl($serverName, $serverPort);
|
||||
}
|
||||
$baseUrl = "{$protocol}://{$serverName}:{$serverPort}/{$subDir}";
|
||||
|
||||
private function constructGetFileUrl($p_serverName, $p_serverPort)
|
||||
{
|
||||
return "http://$p_serverName:$p_serverPort/api/get-media/file/".$this->getId().".".$this->getFileExtension();
|
||||
return $this->getRelativeFileUrl($baseUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -547,6 +528,8 @@ SQL;
|
|||
*/
|
||||
public function getRelativeFileUrl($baseUrl)
|
||||
{
|
||||
Logging::debug("Zend base url: $baseUrl");
|
||||
|
||||
return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue