• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfForeignMemcKey函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfForeignMemcKey函数的典型用法代码示例。如果您正苦于以下问题:PHP wfForeignMemcKey函数的具体用法?PHP wfForeignMemcKey怎么用?PHP wfForeignMemcKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wfForeignMemcKey函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: update_system_gifts

 /**
  * Adds awards for all registered users, updates statistics and purges
  * caches.
  * Special:PopulateAwards calls this function
  */
 public function update_system_gifts()
 {
     global $wgOut, $wgMemc;
     $dbw = wfGetDB(DB_MASTER);
     $stats = new UserStatsTrack(1, '');
     $this->categories = array_flip($this->categories);
     $res = $dbw->select('system_gift', array('gift_id', 'gift_category', 'gift_threshold', 'gift_name'), array(), __METHOD__, array('ORDER BY' => 'gift_category, gift_threshold ASC'));
     $x = 0;
     foreach ($res as $row) {
         if ($row->gift_category && !in_array($row->gift_category, $this->repeatableGifts)) {
             $res2 = $dbw->select('user_stats', array('stats_user_id', 'stats_user_name'), array($stats->stats_fields[$this->categories[$row->gift_category]] . " >= {$row->gift_threshold}", 'stats_user_id <> 0'), __METHOD__);
             foreach ($res2 as $row2) {
                 if ($this->doesUserHaveGift($row2->stats_user_id, $row->gift_id) == false) {
                     $dbw->insert('user_system_gift', array('sg_gift_id' => $row->gift_id, 'sg_user_id' => $row2->stats_user_id, 'sg_user_name' => $row2->stats_user_name, 'sg_status' => 0, 'sg_date' => date('Y-m-d H:i:s', time() - 60 * 60 * 24 * 3)), __METHOD__);
                     $sg_key = wfForeignMemcKey('huiji', '', 'user', 'profile', 'system_gifts', "{$row2->stats_user_id}");
                     $wgMemc->delete($sg_key);
                     // Update counters (bug #27981)
                     UserSystemGifts::incGiftGivenCount($row->gift_id);
                     $wgOut->addHTML(wfMessage('ga-user-got-awards', $row2->stats_user_name, $row->gift_name)->escaped() . '<br />');
                     $x++;
                 }
             }
         }
     }
     $wgOut->addHTML(wfMessage('ga-awards-given-out')->numParams($x)->parse());
 }
开发者ID:Reasno,项目名称:SocialProfile,代码行数:31,代码来源:SystemGiftsClass.php


示例2: getAllSitesRankFromDB

 static function getAllSitesRankFromDB($prefix, $yesterday)
 {
     global $wgMemc;
     wfDebug("Got site rank ( site = {$prefix},data = {$yesterday} ) from DB\n");
     $key = wfForeignMemcKey('huiji', '', 'site_rank', 'all_site_rank', $prefix, $yesterday);
     $allSiteRank = array();
     if ($prefix == '') {
         $dbr = wfGetDB(DB_SLAVE);
         $res = $dbr->select('site_rank', array('site_rank', 'site_score', 'site_prefix'), array('site_rank_date' => $yesterday), __METHOD__, array('ORDER BY' => 'site_rank ASC'));
         if ($res != false) {
             foreach ($res as $value) {
                 $result['site_prefix'] = $value->site_prefix;
                 $result['site_rank'] = $value->site_rank;
                 $result['site_score'] = $value->site_score;
                 $result['best_rank'] = AllSitesInfo::getSiteBestRank($value->site_prefix);
                 $allSiteRank[] = $result;
             }
         }
         $wgMemc->set($key, $allSiteRank);
         return $allSiteRank;
     } else {
         $dbr = wfGetDB(DB_SLAVE);
         $res = $dbr->select('site_rank', array('site_rank', 'site_score'), array('site_prefix' => $prefix, 'site_rank_date' => $yesterday), __METHOD__);
         if ($res != false) {
             foreach ($res as $value) {
                 $result['site_rank'] = $value->site_rank;
                 $result['site_score'] = $value->site_score;
                 $allSiteRank[] = $result;
             }
         }
         $wgMemc->set($key, $allSiteRank);
         return $allSiteRank;
     }
 }
开发者ID:volvor,项目名称:SocialProfile,代码行数:34,代码来源:AllSitesInfoClass.php


示例3: getUserEditInfo

 public function getUserEditInfo($userId)
 {
     global $wgMemc;
     $key = wfForeignMemcKey('huiji', '', 'user_daily_edit', 'all_days', $userId);
     $today = date("Y-m-d");
     $oneYearAgo = date("Y-m-d", strtotime("-1 year"));
     $yesterday = date("Y-m-d", strtotime("-1 day"));
     $userEditInfo = self::getUserEditInfoCache($userId);
     if ($userEditInfo == '') {
         $receive = RecordStatistics::getEditRecordsFromUserIdGroupByDay($userId, $oneYearAgo, $yesterday);
         if ($receive->status == 'success') {
             $userEditInfo = $receive->result;
             $userEditInfo['lastSeen'] = $today;
             $wgMemc->set($key, $userEditInfo);
         } else {
             $userEditInfo = false;
         }
     } else {
         if ($today == $userEditInfo['lastSeen']) {
             return $userEditInfo;
         }
         $receive = RecordStatistics::getEditRecordsFromUserIdGroupByDay($userId, $userEditInfo['lastSeen'], $yesterday);
         if ($receive->status == 'success') {
             $EditSinceLastSeen = $receive->result;
             $userEditInfo = array_merge($userEditInfo, $EditSinceLastSeen);
             $userEditInfo['lastSeen'] = $today;
             $wgMemc->set($key, $userEditInfo);
         } else {
             $userEditInfo = false;
         }
     }
     return $userEditInfo;
 }
开发者ID:Reasno,项目名称:SocialProfile,代码行数:33,代码来源:UserEditBoxClass.php


示例4: updateMainEditsCount

 /**
  * Perform the queries necessary to update the social point counts and
  * purge memcached entries.
  */
 function updateMainEditsCount()
 {
     global $wgNamespacesForEditPoints;
     $out = $this->getOutput();
     $whereConds = array();
     $whereConds[] = 'rev_user <> 0';
     // If points are given out for editing non-main namespaces, take that
     // into account, too.
     if (isset($wgNamespacesForEditPoints) && is_array($wgNamespacesForEditPoints)) {
         foreach ($wgNamespacesForEditPoints as $pointNamespace) {
             $whereConds[] = 'page_namespace = ' . (int) $pointNamespace;
         }
     }
     $dbw = wfGetDB(DB_MASTER);
     $res = $dbw->select(array('revision', 'page'), array('rev_user_text', 'rev_user', 'COUNT(*) AS the_count'), $whereConds, __METHOD__, array('GROUP BY' => 'rev_user_text'), array('page' => array('INNER JOIN', 'page_id = rev_page')));
     foreach ($res as $row) {
         $user = User::newFromId($row->rev_user);
         $user->loadFromId();
         if (!$user->isAllowed('bot')) {
             $editCount = $row->the_count;
         } else {
             $editCount = 0;
         }
         $s = $dbw->selectRow('user_stats', array('stats_user_id'), array('stats_user_id' => $row->rev_user), __METHOD__);
         if (!$s->stats_user_id || $s === false) {
             $dbw->insert('user_stats', array('stats_year_id' => 0, 'stats_user_id' => $row->rev_user, 'stats_user_name' => $row->rev_user_text, 'stats_total_points' => 1000), __METHOD__);
         }
         $out->addWikiMsg('updateeditcounts-updating', $row->rev_user_text, $editCount);
         $dbw->update('user_stats', array('stats_edit_count = ' . $editCount), array('stats_user_id' => $row->rev_user), __METHOD__);
         global $wgMemc;
         // clear stats cache for current user
         $key = wfForeignMemcKey('huiji', '', 'user', 'stats', $row->rev_user);
         $wgMemc->delete($key);
     }
 }
开发者ID:Reasno,项目名称:SocialProfile,代码行数:39,代码来源:SpecialUpdateEditCounts.php


示例5: getMemcacheKey

 /**
  * Get latest revision ID of articles from NS_MEDIAWIKI for a given wiki
  *
  * @param integer $dbName - wiki database name (defaults to local wiki)
  */
 private static function getMemcacheKey($dbName = null)
 {
     global $wgDBname;
     if (is_null($dbName)) {
         $dbName = $wgDBname;
     }
     $key = wfForeignMemcKey($dbName, null, 'JSMessages', 'MWrevID');
     return $key;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:JSMessagesHelper.class.php


示例6: getCacheKey

 function getCacheKey()
 {
     if ($this->repo->hasSharedCache()) {
         $hashedName = md5($this->name);
         return wfForeignMemcKey($this->repo->dbName, $this->repo->tablePrefix, 'file', $hashedName);
     } else {
         return false;
     }
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:9,代码来源:ForeignDBFile.php


示例7: getProfile

 /**
  * Loads social profile info for the current user.
  * First tries fetching the info from memcached and if that fails, queries
  * the database.
  * Fetched info is cached in memcached.
  */
 public function getProfile()
 {
     global $wgMemc;
     $user = User::newFromId($this->user_id);
     $user->loadFromId();
     // Try cache first
     $key = wfForeignMemcKey('huiji', '', 'user', 'profile', 'info', $this->user_id);
     $data = $wgMemc->get($key);
     if ($data) {
         wfDebug("Got user profile info for {$this->user_name} from cache\n");
         $profile = $data;
     } else {
         wfDebug("Got user profile info for {$this->user_name} from DB\n");
         $dbr = wfGetDB(DB_SLAVE);
         $row = $dbr->selectRow('user_profile', '*', array('up_user_id' => $this->user_id), __METHOD__, array('LIMIT' => 5));
         if ($row) {
             $profile['user_id'] = $this->user_id;
         } else {
             $profile['user_page_type'] = 1;
             $profile['user_id'] = 0;
         }
         $showYOB = $user->getIntOption('showyearofbirth', !isset($row->up_birthday)) == 1;
         $issetUpBirthday = isset($row->up_birthday) ? $row->up_birthday : '';
         $profile['location_city'] = isset($row->up_location_city) ? $row->up_location_city : '';
         $profile['location_state'] = isset($row->up_location_state) ? $row->up_location_state : '';
         $profile['location_country'] = isset($row->up_location_country) ? $row->up_location_country : '';
         $profile['hometown_city'] = isset($row->up_hometown_city) ? $row->up_hometown_city : '';
         $profile['hometown_state'] = isset($row->up_hometown_state) ? $row->up_hometown_state : '';
         $profile['hometown_country'] = isset($row->up_hometown_country) ? $row->up_hometown_country : '';
         $profile['birthday'] = $this->formatBirthday($issetUpBirthday, $showYOB);
         $profile['about'] = isset($row->up_about) ? $row->up_about : '';
         $profile['places_lived'] = isset($row->up_places_lived) ? $row->up_places_lived : '';
         $profile['websites'] = isset($row->up_websites) ? $row->up_websites : '';
         $profile['relationship'] = isset($row->up_relationship) ? $row->up_relationship : '';
         $profile['occupation'] = isset($row->up_occupation) ? $row->up_occupation : '';
         $profile['schools'] = isset($row->up_schools) ? $row->up_schools : '';
         $profile['movies'] = isset($row->up_movies) ? $row->up_movies : '';
         $profile['music'] = isset($row->up_music) ? $row->up_music : '';
         $profile['tv'] = isset($row->up_tv) ? $row->up_tv : '';
         $profile['books'] = isset($row->up_books) ? $row->up_books : '';
         $profile['magazines'] = isset($row->up_magazines) ? $row->up_magazines : '';
         $profile['video_games'] = isset($row->up_video_games) ? $row->up_video_games : '';
         $profile['snacks'] = isset($row->up_snacks) ? $row->up_snacks : '';
         $profile['drinks'] = isset($row->up_drinks) ? $row->up_drinks : '';
         $profile['custom_1'] = isset($row->up_custom_1) ? $row->up_custom_1 : '';
         $profile['custom_2'] = isset($row->up_custom_2) ? $row->up_custom_2 : '';
         $profile['custom_3'] = isset($row->up_custom_3) ? $row->up_custom_3 : '';
         $profile['custom_4'] = isset($row->up_custom_4) ? $row->up_custom_4 : '';
         $profile['custom_5'] = isset($row->up_custom_5) ? $row->up_custom_5 : '';
         $profile['user_page_type'] = isset($row->up_type) ? $row->up_type : '';
         $wgMemc->set($key, $profile);
     }
     $profile['real_name'] = $user->getRealName();
     $profile['email'] = $user->getEmail();
     return $profile;
 }
开发者ID:Reasno,项目名称:SocialProfile,代码行数:62,代码来源:UserProfileClass.php


示例8: execute

    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgMemc, $wgUploadPath;
        $out = $this->getOutput();
        $request = $this->getRequest();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Add CSS
        $out->addModuleStyles('ext.socialprofile.usergifts.css');
        $this->gift_id = $request->getInt('gift_id');
        $rel = new UserGifts($user->getName());
        // Make sure that we have a gift ID, can't do anything without that
        if (!$this->gift_id || !is_numeric($this->gift_id)) {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-message-invalid-link')->plain());
            return false;
        }
        // And also ensure that we're not trying to delete *someone else's* gift(s)...
        if ($rel->doesUserOwnGift($user->getID(), $this->gift_id) == false) {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-do-not-own')->plain());
            return false;
        }
        $gift = $rel->getUserGift($this->gift_id);
        if ($request->wasPosted() && $_SESSION['alreadysubmitted'] == false) {
            $_SESSION['alreadysubmitted'] = true;
            $user_page_link = Title::makeTitle(NS_USER, $user->getName());
            if ($rel->doesUserOwnGift($user->getID(), $this->gift_id) == true) {
                $wgMemc->delete(wfForeignMemcKey('huiji', '', 'user', 'profile', 'gifts', $user->getID()));
                $rel->deleteGift($this->gift_id);
            }
            $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt="" />';
            $out->setPageTitle($this->msg('g-remove-success-title', $gift['name'])->parse());
            $out = '<div class="back-links">
				<a href="' . htmlspecialchars($user->getUserPage()->getFullURL()) . '">' . $this->msg('g-back-link', $gift['user_name_to'])->parse() . '</a>
			</div>
			<div class="g-container">' . $gift_image . $this->msg('g-remove-success-message', $gift['name'])->parse() . '<div class="cleared"></div>
			</div>
			<div class="g-buttons">
				<input type="button" class="site-button" value="' . $this->msg('g-main-page')->plain() . '" size="20" onclick="window.location=\'index.php?title=' . $this->msg('mainpage')->inContentLanguage()->escaped() . '\'" />
				<input type="button" class="site-button" value="' . $this->msg('g-your-profile')->plain() . '" size="20" onclick="window.location=\'' . htmlspecialchars($user_page_link->getFullURL()) . '\'" />
			</div>';
            $out->addHTML($out);
        } else {
            $_SESSION['alreadysubmitted'] = false;
            $out->addHTML($this->displayForm());
        }
    }
开发者ID:Reasno,项目名称:SocialProfile,代码行数:54,代码来源:SpecialRemoveGift.php


示例9: getUserEditInfo

 public function getUserEditInfo($userId)
 {
     global $wgMemc;
     $key = wfForeignMemcKey('huiji', '', 'user_daily_edit', 'all_days', $userId);
     $today = date("Y-m-d");
     $oneYearAgo = date("Y-m-d", strtotime("-1 year"));
     $yesterday = date("Y-m-d", strtotime("-1 day"));
     $userEditInfo = self::getUserEditInfoCache($userId);
     if ($userEditInfo == '') {
         $receive = RecordStatistics::getEditRecordsFromUserIdGroupByDay($userId, $oneYearAgo, $yesterday);
         if ($receive->status == 'success') {
             $userEditInfo = $receive->result;
             $userEditInfo['lastSeen'] = $today;
             $wgMemc->set($key, $userEditInfo);
         } else {
             throw new Exception("Error getUserEditInfo/getEditRecordsFromUserIdGroupByDay Bad Request");
         }
     } else {
         if ($today == $userEditInfo['lastSeen']) {
             return $userEditInfo;
         }
         $Delres = array();
         if ($userEditInfo['lastSeen'] == $yesterday) {
             $receive = RecordStatistics::getPageEditCountOnWikiSiteFromUserId($userId, '', $yesterday, $yesterday);
             if ($receive->status == 'success') {
                 $Beres = $receive->result;
                 $Delres['_id'] = $yesterday;
                 $Delres['value'] = $Beres;
                 $resData[] = (object) $Delres;
                 $userEditInfo = array_merge($userEditInfo, $resData);
                 $userEditInfo['lastSeen'] = $today;
                 $wgMemc->set($key, $userEditInfo);
             } else {
                 throw new Exception("Error getUserEditInfo/getPageEditCountOnWikiSiteFromUserId Bad Request");
             }
         } else {
             $receive = RecordStatistics::getEditRecordsFromUserIdGroupByDay($userId, $userEditInfo['lastSeen'], $yesterday);
             if ($receive->status == 'success') {
                 $EditSinceLastSeen = $receive->result;
                 $userEditInfo = array_merge($userEditInfo, $EditSinceLastSeen);
                 $userEditInfo['lastSeen'] = $today;
                 $wgMemc->set($key, $userEditInfo);
             } else {
                 throw new Exception("Error getUserEditInfo/getEditRecordsFromUserIdGroupByDay Bad Request");
             }
         }
     }
     return $userEditInfo;
 }
开发者ID:volvor,项目名称:SocialProfile,代码行数:49,代码来源:UserEditBoxClass.php


示例10: getStats

 /**
  * count all site edits,files,pages,sites,users,
  * @return array 
  */
 public function getStats()
 {
     $key = wfForeignMemcKey('huiji', '', 'Huiji', 'getStats');
     $stats = $this->cache->get($key);
     if ($stats != '') {
         return $stats;
     } else {
         $stats['edits'] = AllSitesInfo::getAllSiteEditCount();
         $stats['files'] = AllSitesInfo::getAllUploadFileCount();
         $stats['pages'] = AllSitesInfo::getAllPageCount();
         $stats['sites'] = AllSitesInfo::getSiteCountNum();
         $stats['users'] = AllSitesInfo::getUserCountNum();
         $this->cache->set($key, $stats, 24 * 60 * 60);
     }
     return $stats;
 }
开发者ID:HuijiWiki,项目名称:HuijiMiddleware,代码行数:20,代码来源:HuijiClass.php


示例11: restoreDeletedEdits

/**
 * Updates user's points after a page in a namespace that is listed in the
 * $wgNamespacesForEditPoints array that they've edited has been restored after
 * it was originally deleted.
 */
function restoreDeletedEdits(&$title, $new)
{
    global $wgNamespacesForEditPoints, $wgMemc, $wgHuijiPrefix;
    // only keep tally for allowable namespaces
    if (!is_array($wgNamespacesForEditPoints) || in_array($title->getNamespace(), $wgNamespacesForEditPoints)) {
        $dbr = wfGetDB(DB_MASTER);
        $res = $dbr->select('revision', array('rev_user_text', 'rev_user', 'COUNT(*) AS the_count'), array('rev_page' => $title->getArticleID(), 'rev_user <> 0'), __METHOD__, array('GROUP BY' => 'rev_user_text'));
        foreach ($res as $row) {
            $stats = new UserStatsTrack($row->rev_user, $row->rev_user_text);
            $stats->incStatField('edit', $row->the_count);
            $key = wfForeignMemcKey('huiji', '', 'revision', 'high_edit_site_followed', $row->rev_user_text, $wgHuijiPrefix);
            $wgMemc->incr($key, $row->the_count);
        }
    }
    return true;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:21,代码来源:EditCount.php


示例12: get

 /**
  * @param string $key
  * @param array $ids
  * @param callable $loadCallback
  * @return array
  * @throws InvalidInputException
  */
 public function get($key, array $ids, $loadCallback)
 {
     $key = implode(':', (array) $key);
     $cacheKeys = array();
     foreach ($ids as $id) {
         if ($id instanceof UUID) {
             $cacheId = $id->getAlphadecimal();
         } elseif (!is_scalar($id)) {
             $type = is_object($id) ? get_class($id) : gettype($id);
             throw new InvalidInputException('Not scalar:' . $type, 'invalid-input');
         } else {
             $cacheId = $id;
         }
         $cacheKeys[wfForeignMemcKey('flow', '', $key, $cacheId, Container::get('cache.version'))] = $id;
     }
     return $this->getByKey($cacheKeys, $loadCallback);
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:24,代码来源:MultiGetList.php


示例13: prefixToSiteName

 /**
  * get site name by prefix, if exist this prefix return site name, else return this prefix
  * @param  string $prefix site prefix ex:'lotr'
  * @return string         [description]
  */
 public static function prefixToSiteName($prefix)
 {
     global $wgMemc;
     $key = wfForeignMemcKey('huiji', '', 'prefixToSiteName', $prefix);
     $data = $wgMemc->get($key);
     if ($data != '') {
         return $data;
     } else {
         $dbr = wfGetDB(DB_SLAVE);
         $s = $dbr->selectRow('domain', array('domain_id', 'domain_name'), array('domain_prefix' => $prefix), __METHOD__);
         if ($s !== false) {
             $wgMemc->set($key, $s->domain_name);
             return $s->domain_name;
         } else {
             return $prefix;
         }
     }
 }
开发者ID:HuijiWiki,项目名称:HuijiMiddleware,代码行数:23,代码来源:HuijiPrefix.php


示例14: getAvatarImage

 /**
  * Fetches the avatar image's name from the filesystem
  * @return Avatar image's file name (i.e. default_l.gif or wikidb_3_l.jpg;
  *			first part for non-default images is the database name, second
  *			part is the user's ID number and third part is the letter for
  *			image size (s, m, ml or l)
  */
 function getAvatarImage()
 {
     global $wgSiteAvatarKey, $wgUploadDirectory, $wgMemc;
     $key = wfForeignMemcKey('huiji', '', 'site', 'profile', 'avatar', $this->user_id, $this->avatar_size);
     $data = $wgMemc->get($key);
     // Load from memcached if possible
     if ($data) {
         $avatar_filename = $data;
     } else {
         $files = glob($wgUploadDirectory . '/avatars/' . $wgSiteAvatarKey . '_' . $this->user_id . '_' . $this->avatar_size . "*");
         if (!isset($files[0]) || !$files[0]) {
             $avatar_filename = 'site_default_' . $this->avatar_size . '.png';
         } else {
             $avatar_filename = basename($files[0]) . '?r=' . filemtime($files[0]);
         }
         $wgMemc->set($key, $avatar_filename, 60 * 60 * 24);
         // cache for 24 hours
     }
     return $avatar_filename;
 }
开发者ID:volvor,项目名称:SocialProfile,代码行数:27,代码来源:SiteAvatarClass.php


示例15: execute

 /**
  * Show the special page
  *
  * @param $params Mixed: parameter(s) passed to the page or null
  */
 public function execute($params)
 {
     global $wgMemc;
     $out = $this->getOutput();
     $user = $this->getUser();
     // This feature is only available to logged-in users.
     if (!$user->isLoggedIn()) {
         throw new ErrorPageError('error', 'badaccess');
     }
     // Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $out->readOnlyPage();
         return;
     }
     $dbw = wfGetDB(DB_MASTER);
     $s = $dbw->selectRow('user_profile', array('up_user_id'), array('up_user_id' => $user->getID()), __METHOD__);
     if ($s === false) {
         $dbw->insert('user_profile', array('up_user_id' => $user->getID()), __METHOD__);
     }
     $profile = new UserProfile($user->getName());
     $profile_data = $profile->getProfile();
     $user_page_type = $profile_data['user_page_type'] == 1 ? 0 : 1;
     $dbw->update('user_profile', array('up_type' => $user_page_type), array('up_user_id' => $user->getID()), __METHOD__);
     $key = wfForeignMemcKey('huiji', '', 'user', 'profile', 'info', $user->getID());
     $wgMemc->delete($key);
     if ($user_page_type == 1 && !$user->isBlocked()) {
         $user_page = Title::makeTitle(NS_USER, $user->getName());
         $article = new Article($user_page);
         $user_page_content = $article->getContent();
         $user_wiki_title = Title::makeTitle(NS_USER_WIKI, $user->getName());
         $user_wiki = new Article($user_wiki_title);
         if (!$user_wiki->exists()) {
             $user_wiki->doEdit($user_page_content, 'import user wiki');
         }
     }
     $title = Title::makeTitle(NS_USER, $user->getName());
     $out->redirect($title->getFullURL());
 }
开发者ID:Reasno,项目名称:SocialProfile,代码行数:43,代码来源:SpecialToggleUserPageType.php


示例16: getContentByTextId

 /**
  * Returns text contents by given text_id from foreign wiki
  *
  * @see Revision::loadText
  * @param $textId int Foreign wiki text id
  * @return String|false
  */
 protected function getContentByTextId($textId)
 {
     global $wgMemc;
     $key = wfForeignMemcKey($this->getDatabaseName(), null, 'revisiontext', 'textid', $textId);
     $text = $wgMemc->get($key);
     if (!empty($text)) {
         return $text;
     }
     $row = null;
     // copied from Article::loadText()
     if (!$row) {
         // Text data is immutable; check slaves first.
         $dbr = $this->getConnection(DB_SLAVE);
         $row = $dbr->selectRow('text', array('old_text', 'old_flags'), array('old_id' => $textId), __METHOD__);
     }
     if (!$row && wfGetLB()->getServerCount() > 1) {
         // Possible slave lag!
         $dbw = $this->getConnection(DB_MASTER);
         $row = $dbw->selectRow('text', array('old_text', 'old_flags'), array('old_id' => $textId), __METHOD__);
     }
     $text = Revision::getRevisionText($row);
     if (!is_string($text)) {
         $text = false;
     }
     return $text;
 }
开发者ID:yusufchang,项目名称:app,代码行数:33,代码来源:GlobalTitle.php


示例17: getCachedConfigVar

 /**
  * @param string $name
  * @return mixed
  */
 private function getCachedConfigVar($name)
 {
     global $wgConf, $wgMemc;
     if ($this->wiki === wfWikiID()) {
         return $GLOBALS[$name];
         // common case
     } else {
         list($db, $prefix) = wfSplitWikiID($this->wiki);
         $key = wfForeignMemcKey($db, $prefix, 'configvalue', $name);
         $value = $wgMemc->get($key);
         // ('v' => ...) or false
         if (is_array($value)) {
             return $value['v'];
         } else {
             $value = $wgConf->getConfig($this->wiki, $name);
             $wgMemc->set($key, array('v' => $value), 86400 + mt_rand(0, 86400));
             return $value;
         }
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:24,代码来源:JobQueueGroup.php


示例18: getCacheKey

 /**
  * @param string $property
  * @return string
  */
 private function getCacheKey($property)
 {
     list($db, $prefix) = wfSplitWikiID($this->wiki);
     $cluster = is_string($this->cluster) ? $this->cluster : 'main';
     return wfForeignMemcKey($db, $prefix, 'jobqueue', $cluster, $this->type, $property);
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:10,代码来源:JobQueueDB.php


示例19: testWfForeignMemcKey

 public function testWfForeignMemcKey()
 {
     $this->setMwGlobals(array('wgCachePrefix' => false, 'wgDBname' => 'example', 'wgDBprefix' => ''));
     $local = wfMemcKey('foo', 'bar');
     $this->setMwGlobals(array('wgDBname' => 'other', 'wgDBprefix' => 'mw_'));
     $this->assertEquals(wfForeignMemcKey('example', '', 'foo', 'bar'), $local, 'Match output of wfMemcKey from local wiki');
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:7,代码来源:GlobalTest.php


示例20: getRootJobCacheKey

 /**
  * @param string $signature Hash identifier of the root job
  * @return string
  */
 protected function getRootJobCacheKey($signature)
 {
     list($db, $prefix) = wfSplitWikiID($this->wiki);
     return wfForeignMemcKey($db, $prefix, 'jobqueue', $this->type, 'rootjob', $signature);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:9,代码来源:JobQueue.php



注:本文中的wfForeignMemcKey函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfFormatStackFrame函数代码示例发布时间:2022-05-23
下一篇:
PHP wfFixSessionID函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap