-
Notifications
You must be signed in to change notification settings - Fork 135
/
LocalSettings.KalturaPlatform.php
144 lines (120 loc) · 4.71 KB
/
LocalSettings.KalturaPlatform.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
/**
* This file store all of mwEmbed local configuration ( in a default svn check out this file is empty )
*
* See includes/DefaultSettings.php for a configuration options
*/
// Old kConf path
$kConfPath = '../../../app/alpha/config/kConf.php';
if( ! file_exists( $kConfPath ) ) {
// New kConf path
$kConfPath = '../../../app/infra/kConf.php';
if( ! file_exists( $kConfPath ) ) {
die('Error: Unable to find kConf.php at ' . $kConfPath);
}
}
// Load kaltura configuration file
require_once( $kConfPath );
$kConf = new kConf();
// Kaltura HTML5lib Version
$wgKalturaVersion = basename(getcwd()); // Gets the version by the folder name
// Get per partner cdn api host list
$partnerCdnApiHosts = kConf::getMap('partner_cdn_api_hosts');
$partnerId = null;
// get partner ID if available
if (isset($_REQUEST['wid']) && preg_match('#^_\d+$#', $_REQUEST['wid']) === 1) {
$partnerId = ltrim($_REQUEST['wid'], '_');
} elseif (isset($_REQUEST['partner_id'])) {
$partnerId = $_REQUEST['partner_id'];
} elseif( isset( $_SERVER['PATH_INFO'] ) ) {
$urlParts = explode( '/', $_SERVER['PATH_INFO'] );
$index = array_search('p', $urlParts);
if ($index !== false && isset($urlParts[$index + 1])) {
$partnerId = $urlParts[$index + 1];
}
}
// Check if partner has custom HTTP CDN API host
if ($partnerId && isset($partnerCdnApiHosts['http_hosts']) && isset($partnerCdnApiHosts['http_hosts'][$partnerId])) {
$wgKalturaServiceUrl = $partnerCdnApiHosts['http_hosts'][$partnerId];
} else {
// The default Kaltura HTTP service url:
$wgKalturaServiceUrl = wgGetUrl('cdn_api_host');
}
// Default Kaltura CDN url:
$wgKalturaCDNUrl = wgGetUrl('cdn_host');
// Default Stats URL
$wgKalturaStatsServiceUrl = wgGetUrl('stats_host');
// Default Live Stats URL
$wgKalturaLiveStatsServiceUrl = wgGetUrl('live_stats_host');
// Default Kaltura Analytics URL
$wgKalturaAnalyticsServiceUrl = wgGetUrl('analytics_host');
// SSL host names
if( $wgHTTPProtocol == 'https' ){
// Check if partner has custom HTTPS CDN API host
if ($partnerId && isset($partnerCdnApiHosts['https_hosts']) && isset($partnerCdnApiHosts['https_hosts'][$partnerId])) {
$wgKalturaServiceUrl = $partnerCdnApiHosts['https_hosts'][$partnerId];
} else {
// The default Kaltura HTTPS service url:
$wgKalturaServiceUrl = wgGetUrl('cdn_api_host_https');
}
$wgKalturaCDNUrl = wgGetUrl('cdn_host_https');
$wgKalturaStatsServiceUrl = wgGetUrl('stats_host_https');
$wgKalturaLiveStatsServiceUrl = wgGetUrl('live_stats_host_https');
$wgKalturaAnalyticsServiceUrl = wgGetUrl('analytics_host_https');
}
// Default Asset CDN Path (used in ResouceLoader.php):
$wgCDNAssetPath = $wgKalturaCDNUrl;
// Default Kaltura Cache Path
$wgScriptCacheDirectory = $kConf->get('cache_root_path') . '/html5/' . $wgKalturaVersion;
if (strpos($_SERVER["HTTP_HOST"], "kaltura.com")){
$wgLoadScript = $wgKalturaServiceUrl . '/html5/html5lib/' . $wgKalturaVersion . '/load.php';
$wgResourceLoaderUrl = $wgLoadScript;
}
// Salt for proxy the user IP address to Kaltura API
if( $kConf->hasParam('remote_addr_header_salt') ) {
$wgKalturaRemoteAddressSalt = $kConf->get('remote_addr_header_salt');
}
// Disable Apple HLS if defined in kConf
if( $kConf->hasParam('use_apple_adaptive') ) {
$wgKalturaUseAppleAdaptive = $kConf->get('use_apple_adaptive');
}
// Get Kaltura Supported API Features
if( $kConf->hasParam('features') ) {
$wgKalturaApiFeatures = $kConf->get('features');
}
// Allow Iframe to connect remote service
$wgKalturaAllowIframeRemoteService = false;
// Set debug for true (testing only)
$wgEnableScriptDebug = false;
// Get PlayReady License URL
if( $kConf->hasMap('playReady') ) {
$playReadyMap = $kConf->getMap('playReady');
if($playReadyMap)
$wgKalturaLicenseServerUrl = $playReadyMap['license_server_url'];
}
// Get PlayReady License URL
if( $kConf->hasMap('drm') ) {
$drmMap = $kConf->getMap('drm');
if($drmMap)
$wgKalturaUdrmLicenseServerUrl = $drmMap['license_server_url'];
}
if( $kConf->hasParam('overrideDomain') ) {
$wgEnableKalturaOverrideDomain = $kConf->get('overrideDomain');
}
if( $kConf->hasParam('enableEmbedServicesRouting') ) {
$wgEnableKalturaEmbedServicesRouting = $kConf->get('enableEmbedServicesRouting');
}
$wgUseMemcache = false;
$wgMemcacheConfiguration = $kConf->get('memcacheLocal','cache',null);
if( $wgMemcacheConfiguration )
{
$wgUseMemcache = true;
}
// A helper function to get full URL of host
function wgGetUrl( $hostKey = null ) {
global $wgHTTPProtocol, $wgServerPort, $kConf;
if( $hostKey && $kConf->hasParam($hostKey) ) {
return $wgHTTPProtocol . '://' . $kConf->get($hostKey) . $wgServerPort;
}
return null;
}