本文整理汇总了PHP中kDataCenterMgr::getCurrentDcUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP kDataCenterMgr::getCurrentDcUrl方法的具体用法?PHP kDataCenterMgr::getCurrentDcUrl怎么用?PHP kDataCenterMgr::getCurrentDcUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kDataCenterMgr
的用法示例。
在下文中一共展示了kDataCenterMgr::getCurrentDcUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createLiveReportExportDownloadUrl
protected static function createLiveReportExportDownloadUrl($partner_id, $file_name, $expiry, $applicationUrlTemplate)
{
// Extract simple download name
$regex = "/^{$partner_id}_Export_[a-zA-Z0-9]+_(?<fileName>[\\w\\-]+.csv)\$/";
if (!preg_match($regex, $file_name, $matches)) {
KalturaLog::err("File name doesn't match expected format");
return null;
}
$downloadName = $matches['fileName'];
// Add dc to enable redirection
$dc = kDataCenterMgr::getCurrentDc();
$file_name = $dc['id'] . "_" . $file_name;
$ksStr = "";
$partner = PartnerPeer::retrieveByPK($partner_id);
$secret = $partner->getSecret();
$privilege = ks::PRIVILEGE_DOWNLOAD . ":" . $file_name;
$ksStr = kSessionBase::generateSession($partner->getKSVersion(), $partner->getAdminSecret(), null, ks::TYPE_KS, $partner_id, $expiry, $privilege);
if ($applicationUrlTemplate) {
$url = str_replace("[ks]", $ksStr, $applicationUrlTemplate);
$url = str_replace("[id]", $file_name, $url);
} else {
//url is built with DC url in order to be directed to the same DC of the saved file
$url = kDataCenterMgr::getCurrentDcUrl() . "/api_v3/index.php/service/liveReports/action/serveReport/ks/{$ksStr}/id/{$file_name}/{$downloadName}";
}
return $url;
}
示例2: createUrl
private static function createUrl($partner_id, $file_name)
{
$ksStr = "";
$partner = PartnerPeer::retrieveByPK($partner_id);
$secret = $partner->getSecret();
$privilege = ks::PRIVILEGE_DOWNLOAD . ":" . $file_name;
$maxExpiry = 86400;
$expiry = $partner->getKsMaxExpiryInSeconds();
if (!$expiry || $expiry > $maxExpiry) {
$expiry = $maxExpiry;
}
$result = kSessionUtils::startKSession($partner_id, $secret, null, $ksStr, $expiry, false, "", $privilege);
if ($result < 0) {
throw new Exception("Failed to generate session for asset [" . $this->getId() . "] of type " . $this->getType());
}
//url is built with DC url in order to be directed to the same DC of the saved file
$url = kDataCenterMgr::getCurrentDcUrl() . "/api_v3/index.php/service/report/action/serve/ks/{$ksStr}/id/{$file_name}/report.csv";
return $url;
}
示例3: createFileName
private static function createFileName($partner_id)
{
$args = func_get_args();
$file_name = uniqid();
$time_suffix = date("Y-m-D-H", (int) (time() / 43200) * 43200);
// calculate for intervlas of half days (86400/2)
$folderPath = "/content/reports/{$partner_id}";
$fullPath = myContentStorage::getFSContentRootPath() . $folderPath;
if (!file_exists($fullPath)) {
kFile::fullMkfileDir($fullPath, 0777, true);
}
$fileName = "{$file_name}_{$time_suffix}";
//url is built with DC url in order to be directed to the same DC of the saved file
$url = kDataCenterMgr::getCurrentDcUrl() . "{$folderPath}/{$fileName}";
$file_path = "{$fullPath}/{$fileName}";
// $path = "/content/reports/$partner_id/{$file_name}_{$time_suffix}";
// $file_path = myContentStorage::getFSContentRootPath() . $path;
// $url = requestUtils::getHost() . $path;
return array($file_path, $url);
}