本文整理汇总了PHP中WikiFactory::DBtoUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::DBtoUrl方法的具体用法?PHP WikiFactory::DBtoUrl怎么用?PHP WikiFactory::DBtoUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::DBtoUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emailFollowNotifications
public function emailFollowNotifications($initiatingUser, $aWatchers, $iUserId, $iNamespace, $sMessage, $sAction)
{
$wg = F::app()->wg;
$wg->DBname = WikiFactory::IDtoDB($this->getWikiId());
$wg->Server = trim(WikiFactory::DBtoUrl(F::app()->wg->DBname), '/');
if (!empty($wg->DevelEnvironment)) {
$wg->Server = WikiFactory::getLocalEnvURL($wg->Server);
}
$wg->User = User::newFromId($initiatingUser);
$targetUser = User::newFromId($iUserId);
$this->logWatchers($aWatchers, $sAction);
foreach ($aWatchers as $sKey => $sValue) {
$oTitle = Title::makeTitle($iNamespace, $sKey);
$oEmailNotification = new EmailNotification($targetUser, $oTitle, wfTimestampNow(), $sMessage, false, $currentRevId = 0, $previousRevId = 0, $sAction, ['notisnull' => 1, 'childTitle' => $this->title]);
$oEmailNotification->notifyOnPageChange();
}
}
示例2: getArticleDetails
public function getArticleDetails($wikiId, $articleId, $url)
{
$domain = WikiFactory::DBtoUrl(WikiFactory::IDtoDB($wikiId));
//TODO: REFACTOR THE HACK
if ($domain) {
$callUrl = sprintf('%sapi/v1/Articles/Details?ids=%u', $domain, $articleId);
$details = Http::get($callUrl);
if (empty($details)) {
$details = file_get_contents($callUrl);
}
$data = json_decode($details);
if ($data) {
return $data;
}
return false;
}
return false;
}
示例3: getContentUrl
protected function getContentUrl($wikiId, $articleId)
{
return $this->getEpisodeService()->replaceHostUrl(WikiFactory::DBtoUrl(WikiFactory::IDtoDB($wikiId)) . EpisodeEntitySearchService::API_URL . $articleId);
}
示例4: getCommunityUrl
/**
* @desc Get url to community wiki
*
* @return url
*/
public function getCommunityUrl()
{
return WikiFactory::DBtoUrl($this->getCommunityDbName());
}
示例5: getWikiaArticles
protected function getWikiaArticles($episodes)
{
global $wgStagingEnvironment, $wgDevelEnvironment;
$data = [];
foreach ($episodes as $i => $episode) {
try {
$response = $this->sendRequest('TvApiController', 'getEpisode', ['seriesName' => $episode['title'], 'episodeName' => $episode['episode_title'], 'minArticleQuality' => self::MIN_ARTICLE_QUALITY]);
$item = $response->getData();
$item['wikia_id'] = $item['wikiId'];
$item['page_id'] = $item['articleId'];
$item['series_name'] = $episode['title'];
$item['episode_name'] = $episode['episode_title'];
$item['source'] = self::SOURCE_TVRAGE;
unset($item['wikiId'], $item['articleId']);
if ($wgStagingEnvironment || $wgDevelEnvironment) {
$url = WikiFactory::DBtoUrl(WikiFactory::IDtoDB($item['wikia_id']));
if (strpos($item['url'], $url) !== 0) {
$item['url'] = preg_replace('~http://[^\\.]+\\.~', 'http://', $item['url']);
}
}
$data[] = $item;
} catch (Exception $e) {
\Wikia\Logger\WikiaLogger::instance()->error(__METHOD__ . " : " . $e->getMessage());
}
}
return $data;
}
示例6: run
public static function run(DatabaseMysql $db, $test = false, $verbose = false, $params)
{
$dbname = $params['dbname'];
// Don't bother getting stats for the video wiki
if ($dbname == 'video151') {
return;
}
// Get total local videos
$sql = 'SELECT COUNT(*) as local_count FROM video_info WHERE premium = 0';
$result = $db->query($sql);
$local_count = 0;
while ($row = $db->fetchObject($result)) {
$local_count = $row->local_count;
}
// Get number of matching videos and total number of matches
$sql = 'SELECT page_id, props
FROM page_wikia_props
WHERE propname = ' . WPP_LVS_SUGGEST;
$result = $db->query($sql);
$num_matching = 0;
$total_matches = 0;
$countedPages = array();
while ($row = $db->fetchObject($result)) {
$info = unserialize($row->props);
$num_matching++;
$total_matches += count($info);
$countedPages[$row->page_id] = 1;
}
$sql = 'SELECT page_id, props
FROM page_wikia_props
WHERE propname = ' . WPP_LVS_STATUS_INFO;
$result = $db->query($sql);
/*
* Constants made available by LicensedVideoSwapHelper
const STATUS_KEEP = 1; // set bit to 1 = kept video
const STATUS_SWAP = 2; // set bit to 1 = swapped video
const STATUS_EXACT = 4; // set bit to 0 = normal swap, 1 = swap with an exact match
const STATUS_SWAPPABLE = 8; // set bit to 1 = video with suggestions
const STATUS_NEW = 16; // set bit to 1 = video with new suggestions
const STATUS_FOREVER = 32; // set bit to 1 = no more matches
*/
$num_keeps = 0;
$num_swaps = 0;
while ($row = $db->fetchObject($result)) {
$info = unserialize($row->props);
if ($info['status'] & LicensedVideoSwapHelper::STATUS_KEEP) {
$num_keeps++;
} else {
if ($info['status'] & LicensedVideoSwapHelper::STATUS_SWAP) {
$num_swaps++;
}
}
// If this page wasn't counted above as having or more suggestions,
// count it here. This can happen if the suggestions get cleared out
// after the video has been kept/swapped
if (!array_key_exists($row->page_id, $countedPages)) {
$num_matching++;
}
}
$url = WikiFactory::DBtoUrl($dbname);
echo "{$dbname},{$url},{$local_count},{$num_matching},{$total_matches},{$num_keeps},{$num_swaps}\n";
}
示例7: onGlobalUsageFormatItemWikiLink
/**
* Hook: get wiki link for SpecialGlobalUsage::formatItem()
* @param array $item
* @param string $page
* @param string|false $link
* @return bool true
*/
public static function onGlobalUsageFormatItemWikiLink($item, $page, &$link)
{
$link = WikiFactory::DBtoUrl($item['wiki']);
if ($link) {
$link .= 'wiki/' . $page;
$link = Xml::element('a', array('href' => $link), str_replace('_', ' ', $page));
}
return true;
}