本文整理汇总了PHP中WikiFactory::redirectDomains方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::redirectDomains方法的具体用法?PHP WikiFactory::redirectDomains怎么用?PHP WikiFactory::redirectDomains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::redirectDomains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doClose
/**
* close Wiki(s)
* @access private
*/
private function doClose($newWiki = "")
{
global $wgRequest, $wgOut;
wfProfileIn(__METHOD__);
$WFTitle = Title::makeTitle(NS_SPECIAL, 'WikiFactory');
#---
$output = "";
if (!empty($this->mWikis)) {
$output = Xml::openElement('ul', null);
foreach ($this->mWikis as $wiki) {
Wikia::log(__METHOD__, "Closing: {$wiki->city_title} (url: {$wiki->city_url}) (id: {$wiki->city_id}) (dbname: {$wiki->city_dbname}) ");
#-- move to archive
$message = wfMsgExt('closewiki-wiki-closed', array('parse'), $wiki->city_title, $wiki->city_url);
if (!empty($newWiki)) {
Wikia::log(__METHOD__, " ... and redirecting to: {$this->mRedirect} (id: {$newWiki})");
$this->moveOldDomains($wiki->city_id, $newWiki);
#-- add "old" prefix to main domain and set is as primary
$prefixedDomain = $this->prefixMainDomain($wiki->city_id);
Wikia::log(__METHOD__, " ... primary domain set to: {$prefixedDomain}");
#-- set new city ID in city_domains (except for just created "old" domain)
$isMoved = WikiFactory::redirectDomains($wiki->city_id, $newWiki, !empty($prefixedDomain) ? array($prefixedDomain) : array());
#---
$message = wfMsgExt('closewiki-wiki-closed_redirect', array('parse'), $wiki->city_title, $wiki->city_url, sprintf("%s%s", "http://", $this->mRedirect));
}
#-- set public to 0
$status = isset($this->mFlags[WikiFactory::FLAG_HIDE_DB_IMAGES]) ? WikiFactory::HIDE_ACTION : WikiFactory::CLOSE_ACTION;
#-- set flags as a number
if (!empty($this->mFlags)) {
$city_flags = 0;
foreach ($this->mFlags as $flag) {
$city_flags |= $flag;
}
WikiFactory::setFlags($wiki->city_id, $city_flags);
}
// Let's request the XML dump if needed
if (isset($this->mFlags[WikiFactory::FLAG_CREATE_DB_DUMP])) {
DumpsOnDemand::queueDump($wiki->city_id, isset($this->mFlags[WikiFactory::FLAG_HIDE_DB_IMAGES]), true);
}
if (empty($this->mReason)) {
$this->mReason = "-";
}
$res = WikiFactory::setPublicStatus($status, $wiki->city_id, $this->mReason);
if ($res === $status) {
$output .= Xml::tags('li', array('style' => 'padding:4px;'), $message);
WikiFactory::clearCache($wiki->city_id);
if (!empty($newWiki)) {
WikiFactory::clearCache($newWiki);
}
}
}
$output .= Xml::closeElement('ul');
}
$output .= Xml::element('input', array('name' => 'wiki-return', 'type' => 'button', 'value' => wfMsg('closewiki-return', wfMsg('wikifactory')), 'onclick' => "window.location='{$WFTitle->getFullURL()}'"));
$wgOut->addHtml($output);
$aHookParams = ['city_id' => $wiki->city_id];
wfRunHooks('WikiFactoryWikiClosed', array($aHookParams));
wfProfileOut(__METHOD__);
}