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['webServerUser'] = $values['general']['web_server_user'];
|
||||||
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
|
$CC_CONFIG['rabbitmq'] = $values['rabbitmq'];
|
||||||
|
|
||||||
|
$CC_CONFIG['baseDir'] = $values['general']['base_dir'];
|
||||||
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
||||||
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
||||||
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
$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
|
* Get the URL to access this file
|
||||||
* this PHP script was invoked through.
|
|
||||||
*/
|
*/
|
||||||
public function getFileUrl()
|
public function getFileUrl()
|
||||||
{
|
{
|
||||||
$serverName = $_SERVER['SERVER_NAME'];
|
$CC_CONFIG = Config::getConfig();
|
||||||
$serverPort = $_SERVER['SERVER_PORT'];
|
|
||||||
|
$protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
|
||||||
return $this->constructGetFileUrl($serverName, $serverPort);
|
|
||||||
}
|
$serverName = $_SERVER['SERVER_NAME'];
|
||||||
|
$serverPort = $_SERVER['SERVER_PORT'];
|
||||||
/**
|
$subDir = $CC_CONFIG['baseDir'];
|
||||||
* 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
|
if ($subDir[0] === "/") {
|
||||||
* not specified, then use values provided by the $_SERVER global variable.
|
$subDir = substr($subDir, 1, strlen($subDir) - 1);
|
||||||
*/
|
}
|
||||||
public function getFileUrlUsingConfigAddress()
|
|
||||||
{
|
$baseUrl = "{$protocol}://{$serverName}:{$serverPort}/{$subDir}";
|
||||||
$CC_CONFIG = Config::getConfig();
|
|
||||||
|
return $this->getRelativeFileUrl($baseUrl);
|
||||||
if (isset($CC_CONFIG['baseUrl'])) {
|
|
||||||
$serverName = $CC_CONFIG['baseUrl'];
|
|
||||||
} else {
|
|
||||||
$serverName = $_SERVER['SERVER_NAME'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($CC_CONFIG['basePort'])) {
|
|
||||||
$serverPort = $CC_CONFIG['basePort'];
|
|
||||||
} else {
|
|
||||||
$serverPort = $_SERVER['SERVER_PORT'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->constructGetFileUrl($serverName, $serverPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function constructGetFileUrl($p_serverName, $p_serverPort)
|
|
||||||
{
|
|
||||||
return "http://$p_serverName:$p_serverPort/api/get-media/file/".$this->getId().".".$this->getFileExtension();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -547,6 +528,8 @@ SQL;
|
||||||
*/
|
*/
|
||||||
public function getRelativeFileUrl($baseUrl)
|
public function getRelativeFileUrl($baseUrl)
|
||||||
{
|
{
|
||||||
|
Logging::debug("Zend base url: $baseUrl");
|
||||||
|
|
||||||
return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension();
|
return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue