當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WikiFactory::getWikisByID方法代碼示例

本文整理匯總了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;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:17,代碼來源:PageClassificationData.class.php

示例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);
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:67,代碼來源:SpecialLookupContribs_helper.php


注:本文中的WikiFactory::getWikisByID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。