本文整理汇总了PHP中WikiFactory::getWikisByID方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::getWikisByID方法的具体用法?PHP WikiFactory::getWikisByID怎么用?PHP WikiFactory::getWikisByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::getWikisByID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWikiList
/**
* Get list of wiki that have classified pages
*/
public function getWikiList()
{
$api = new EntityAPIClient();
$api->setLogLevel(5);
$response = $api->get($api->getIndexedWikisEndpoint());
$list = array();
if (is_array($response['response'])) {
$wikis = WikiFactory::getWikisByID($response['response']);
foreach ($wikis as $wiki) {
$list[] = array('domain' => $wiki->city_url, 'wikiId' => $wiki->city_id);
}
}
return $list;
}
示例2: checkUserActivity
/**
* @brief Gets data for AJAX request for data to user contribution table
*
* @param boolean $addEditCount added in 20.07.2011 during SSW is a flag; will add additional array element with user's edits on a wiki plus will sort whole array by this value
*
* @author Bartek Lapinski <bartek@wikia.com>
* @author Piotr Molski <moli@wikia.com>
* @author Andrzej 'nAndy' Łukaszewski <nandy (at) wikia-inc.com>
*/
public function checkUserActivity($addEditCount = false, $order = null)
{
global $wgMemc, $wgContLang, $wgStatsDB, $wgStatsDBEnabled;
wfProfileIn(__METHOD__);
$userActivity = array('data' => array(), 'cnt' => 0);
if ($addEditCount) {
$sMemKey = __METHOD__ . ":{$this->mUserId}:dataWithEdits";
} else {
$sMemKey = __METHOD__ . ":{$this->mUserId}:data";
}
$data = $wgMemc->get($sMemKey);
if ((!is_array($data) || LOOKUPCONTRIBS_NO_CACHE) && !empty($wgStatsDBEnabled)) {
$dbr = wfGetDB(DB_SLAVE, "stats", $wgStatsDB);
if (!is_null($dbr)) {
//bugId:6196
$excludedWikis = $this->getExclusionList();
$where = array('user_id' => $this->mUserId, 'event_type' => array(1, 2));
if (!empty($excludedWikis) && is_array($excludedWikis)) {
$where[] = 'wiki_id NOT IN (' . $dbr->makeList($excludedWikis) . ')';
}
$options = array('GROUP BY' => 'wiki_id');
if ($addEditCount === true) {
$wikisIds = array();
$wikiEdits = $this->getEditCount($wikisIds);
$where['wiki_id'] = $wikisIds;
}
/* rows */
$res = $dbr->select(array('events'), array('wiki_id', 'max(unix_timestamp(rev_timestamp)) as last_edit'), $where, __METHOD__, $options);
if (empty($wikisIds)) {
$wikisIds = array();
while ($row = $dbr->fetchObject($res)) {
$wikisIds[] = $row->wiki_id;
}
$dbr->dataSeek($res, 0);
}
$wData = WikiFactory::getWikisByID($wikisIds);
$i = 0;
while ($row = $dbr->fetchObject($res)) {
if (!isset($wData[$row->wiki_id])) {
continue;
}
$aItem = array('id' => $row->wiki_id, 'url' => $wData[$row->wiki_id]->city_url, 'dbname' => $wData[$row->wiki_id]->city_dbname, 'title' => $wData[$row->wiki_id]->city_title, 'active' => $wData[$row->wiki_id]->city_public, 'last_edit' => $row->last_edit, 'edit_count' => 0);
if (isset($wikiEdits[$row->wiki_id]->edits)) {
$aItem['editcount'] = $wikiEdits[$row->wiki_id]->edits;
}
$userActivity['data'][] = $aItem;
}
$dbr->freeResult($res);
if (!LOOKUPCONTRIBS_NO_CACHE) {
$wgMemc->set($sMemKey, $userActivity, 60 * 10);
}
}
} else {
$userActivity = $data;
}
wfProfileOut(__METHOD__);
return $this->orderData($userActivity, $order, $addEditCount);
}