本文整理汇总了PHP中Wikia::getAllHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::getAllHeaders方法的具体用法?PHP Wikia::getAllHeaders怎么用?PHP Wikia::getAllHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikia
的用法示例。
在下文中一共展示了Wikia::getAllHeaders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
wfRunHooks('WikiFactory::executeBeforeTransferToGlobals', array(&$this));
/**
* transfer configuration variables from database to GLOBALS
*/
if (is_array($this->mVariables)) {
foreach ($this->mVariables as $key => $value) {
$tValue = $value;
#--- check, maybe there are variables in variable
if (is_string($tValue)) {
preg_match_all('/(\\$\\w+)[^\\w]*/', $tValue, $aMatches);
if (is_array($aMatches[1])) {
foreach ($aMatches[1] as $tKey) {
/**
* dolar sign in key should be removed
* (str_replace is faster than regexp)
*/
$tKeyParsed = str_replace('$', '', $tKey);
if (!is_numeric($tKeyParsed)) {
#--- replace only if key is not $1, $2 etc.
if (array_key_exists($tKeyParsed, $this->mVariables)) {
$tValue = str_replace($tKey, $this->mVariables[$tKeyParsed], $tValue);
} else {
if (isset($GLOBALS[$tKeyParsed])) {
$tValue = str_replace($tKey, $GLOBALS[$tKeyParsed], $tValue);
}
}
}
}
}
}
/**
* merge local values with global
*/
switch ($key) {
case "wgNamespacesWithSubpagesLocal":
$this->LocalToGlobalArray($tValue, $GLOBALS["wgNamespacesWithSubpages"]);
break;
case "wgExtraNamespacesLocal":
$this->LocalToGlobalArray($tValue, $GLOBALS["wgExtraNamespaces"]);
break;
case "wgFileExtensionsLocal":
$this->LocalToGlobalArray($tValue, $GLOBALS["wgFileExtensions"], true);
break;
case "wgTrustedMediaFormatsLocal":
$this->LocalToGlobalArray($tValue, $GLOBALS["wgTrustedMediaFormats"]);
break;
case "wgFileBlacklistLocal":
$this->LocalToGlobalArray($tValue, $GLOBALS["wgFileBlacklist"]);
break;
}
if ($key == 'wgServer') {
$headers = Wikia::getAllHeaders();
if (array_key_exists('X-Original-Host', $headers) && !empty($headers['X-Original-Host'])) {
global $wgConf;
$tValue = 'http://' . $headers['X-Original-Host'];
$wgConf->localVHosts = array_merge($wgConf->localVHosts, array($headers['X-Original-Host']));
}
}
try {
if ($this->mSaveDefaults) {
$GLOBALS['wgPreWikiFactoryValues'][$key] = $tValue;
}
$GLOBALS[$key] = $tValue;
} catch (Exception $e) {
#--- so far do nothing
}
}
}
$wgCityId = $this->mWikiID;
/**
* set/replace $wgDBname in $wgDBservers
*/
if (isset($wgDBservers) && is_array($wgDBservers) && isset($this->mVariables["wgDBname"])) {
foreach ($wgDBservers as $index => $server) {
$wgDBservers[$index]["dbname"] = $this->mVariables["wgDBname"];
}
}
if (isset($wgLBFactoryConf) && is_array($wgLBFactoryConf) && isset($this->mVariables["wgDBname"])) {
$wgLBFactoryConf['serverTemplate']['dbname'] = $this->mVariables["wgDBname"];
/**
* set wgDBserver for cluster based on $wgLBFactoryConf
*/
$cluster = isset($this->mVariables["wgDBcluster"]) ? $this->mVariables["wgDBcluster"] : "DEFAULT";
if (isset($wgLBFactoryConf["sectionLoads"][$cluster])) {
$keys = array_keys($wgLBFactoryConf["sectionLoads"][$cluster]);
$db = array_shift($keys);
if (isset($wgLBFactoryConf["hostsByName"][$db])) {
$wgDBserver = $wgLBFactoryConf["hostsByName"][$db];
$this->debug("wgDBserver for cluster {$cluster} set to {$wgDBserver}");
}
}
}
wfRunHooks('WikiFactory::onExecuteComplete', array(&$this));
wfProfileOut(__METHOD__);
/**
* cleanup and finally return wiki id
*/
LBFactory::destroyInstance();
return $this->mWikiID;
}