本文整理汇总了PHP中Perf类的典型用法代码示例。如果您正苦于以下问题:PHP Perf类的具体用法?PHP Perf怎么用?PHP Perf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Perf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateForumCount
function updateForumCount($fid, $topic, $replies, $tpost = 0)
{
global $db, $db_fcachenum;
$fm = $db->get_one("SELECT fup,type,password,allowvisit,f_type FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
if ($fm['type'] == 'category') {
return false;
}
delfcache($fid, $db_fcachenum);
$topic = intval($topic);
$article = $topic + intval($replies);
$tpost = intval($tpost);
$lastpost = '';
$lt = $db->get_one("SELECT tid,author,postdate,lastpost,lastposter,subject FROM pw_threads WHERE fid=" . S::sqlEscape($fid) . " AND specialsort='0' AND ifcheck='1' AND lastpost>0 ORDER BY lastpost DESC LIMIT 1");
if ($lt) {
if ($lt['postdate'] == $lt['lastpost']) {
$subject = substrs($lt['subject'], 26);
} else {
$subject = 'Re:' . substrs($lt['subject'], 26);
}
$lastpost = ",lastpost=" . S::sqlEscape($subject . "\t" . $lt['lastposter'] . "\t" . $lt['lastpost'] . "\t" . "read.php?tid={$lt['tid']}&page=e#a");
}
$db->update("UPDATE pw_forumdata SET article=article+'{$article}',topic=topic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid=" . S::sqlEscape($fid));
Perf::gatherInfo('changeForumData', array('fid' => $fid));
if (($fm['type'] == 'sub' || $fm['type'] == 'sub2') && ($fids = getUpFids($fid))) {
if ($fm['password'] != '' || $fm['allowvisit'] != '' || $fm['f_type'] == 'hidden') {
$lastpost = '';
}
$db->update("UPDATE pw_forumdata SET article=article+'{$article}',subtopic=subtopic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid IN(" . S::sqlImplode($fids) . ')');
Perf::gatherInfo('changeForumData', array('fid' => $fids));
}
}
示例2: _getThreadData
function _getThreadData($tid)
{
//* $threadService = L::loadClass('threads','forum');
//* return $threadService->getThreads($tid, true);
$_cacheService = Perf::gatherCache('pw_threads');
return $_cacheService->getThreadAndTmsgByThreadId($tid);
}
示例3: clearForumsCache
function clearForumsCache($tableName, $fields)
{
$fids = isset($fields['fid']) ? is_array($fields['fid']) ? $fields['fid'] : array($fields['fid']) : null;
$_cacheService = Perf::getCacheService();
switch ($tableName) {
case 'pw_forums':
$_cacheService->delete('all_forums_info');
break;
case 'pw_forumdata':
$_cacheService->delete('all_forums_info');
if ($fids) {
foreach ($fids as $fourmId) {
$_cacheService->delete('forumdata_announce_' . $fourmId);
}
break;
}
case 'pw_announce':
$query = $GLOBALS['db']->query('SELECT fid FROM pw_forumdata');
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$_cacheService->delete('forumdata_announce_' . $rt['fid']);
}
break;
default:
break;
}
}
示例4: getSendToUsernames
function getSendToUsernames($type, $tid)
{
global $windid, $db;
$usernames = array();
if (!$type || !$tid) {
return $usernames;
}
$remindUsernames = $db->get_value("SELECT db_value FROM pw_config WHERE db_name = 'report_remind'");
$remindUsernames = $remindUsernames ? unserialize($remindUsernames) : array();
foreach ($remindUsernames as $key => $value) {
if ($value['username'] == $windid) {
continue;
}
$usernames[] = $value['username'];
}
if ($type != 'topic') {
return $usernames;
}
$_cacheService = Perf::gatherCache('pw_threads');
$threads = $_cacheService->getThreadByThreadId($tid);
$fid = $threads['fid'];
L::loadClass('forum', 'forum', false);
$forumService = new PwForum($fid);
$foruminfo = $forumService->foruminfo;
$forumadmins = $foruminfo['forumadmin'];
$forumadmins = explode(',', $forumadmins);
foreach ($forumadmins as $forumadmin) {
if (!$forumadmin || $forumadmin == $windid) {
continue;
}
$usernames[] = $forumadmin;
}
return $usernames;
}
示例5: clearCacheForSpaceByUid
function clearCacheForSpaceByUid($tableName, $fields)
{
if (!isset($fields['uid'])) {
return false;
}
$cache = Perf::gatherCache('PW_Space');
$cache->clearCacheForSpaceByUid($fields['uid']);
}
示例6: clearCacheByName
function clearCacheByName($tableName, $fields)
{
if (!isset($fields['name'])) {
return false;
}
$cache = Perf::gatherCache('PW_Cache');
$cache->clearCacheByName($fields['name']);
}
示例7: cleanWeibocontentCacheWithMids
function cleanWeibocontentCacheWithMids($tableName, $fields)
{
if (!isset($fields['mid'])) {
return false;
}
$mids = is_array($fields['mid']) ? $fields['mid'] : array($fields['mid']);
$cache = Perf::gatherCache('pw_weibo_content');
$cache->clearCacheForWeiboContentsByMids($mids);
}
示例8: userApplist
/**
* 获取个人APP列表
*/
function userApplist($uids, $appids = '', $arrt = 0)
{
if (!$uids) {
return false;
}
$this->_app_array = array();
$this->_appslist = $this->getApplist();
$sql_uid = $sql_appid = '';
if (is_numeric($uids)) {
$sql_uid .= ' uid=' . S::sqlEscape($uids);
} elseif (is_array($uids)) {
$sql_uid .= ' uid IN(' . S::sqlImplode($uids) . ')';
}
if (is_numeric($appids)) {
$sql_appid .= ' AND appid=' . S::sqlEscape($appids);
} elseif (is_array($appids)) {
$sql_appid .= ' AND appid IN(' . S::sqlImplode($appids) . ')';
}
//$query = $this->_db->query("SELECT uid,appid,appname FROM pw_userapp WHERE $sql_uid $sql_appid");
if (perf::checkMemcache()) {
$appids = is_array($appids) ? $appids : array(intval($appids));
$_cacheService = Perf::gatherCache('pw_userapp');
$array = $_cacheService->getUserappsCacheByUids($uids);
foreach ($array as $v) {
if (in_array($v['appid'], $appids)) {
continue;
}
if ($this->_appslist[$v['appid']]) {
if ($arrt == 1) {
$this->_app_array[$v['appid']] = $v['appname'];
} elseif ($arrt == 2) {
$this->_app_array[$v['uid']][$v['appid']] = $v;
} else {
$this->_app_array[] = $v;
}
}
}
} else {
$query = $this->_db->query("SELECT uid,appid,appname FROM pw_userapp WHERE {$sql_uid} {$sql_appid}");
while ($rt = $this->_db->fetch_array($query)) {
if ($this->_appslist[$rt['appid']]) {
if ($arrt == 1) {
$this->_app_array[$rt['appid']] = $rt['appname'];
} elseif ($arrt == 2) {
$this->_app_array[$rt['uid']][$rt['appid']] = $rt;
} else {
$this->_app_array[] = $rt;
}
}
}
}
if (!$this->_app_array || !$this->appifopen) {
$this->_app_array = array();
}
return $this->_app_array;
}
示例9: run
function run()
{
$tid = $this->getVar('tid');
$db_htmifopen = $this->getVar('db_htmifopen');
$winduid = $this->getVar('winduid');
require_once R_P . 'require/functions.php';
$_cacheService = Perf::gatherCache('pw_threads');
$thread = $page > 1 ? $_cacheService->getThreadByThreadId($tid) : $_cacheService->getThreadAndTmsgByThreadId($tid);
initJob($winduid, "doReply", array('tid' => $tid, 'user' => $thread['author']));
}
示例10: getBbsInfoById
function getBbsInfoById($id)
{
$id = S::int($id);
if ($id < 1) {
return false;
}
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_bbsinfo');
return $_cacheService->getBbsInfoById($id);
}
$bbsInfoDb = $this->_getBbsInfoDB();
return $bbsInfoDb->get($id);
}
示例11: _postThread
function _postThread($id, $postAudit, $expand)
{
$postVerifyService = $this->getPostVerifyService();
$postVerifyService->insertPostVerify(1, $id, 0);
$GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . CLOUDWIND_SECURITY_SERVICE::sqlEscape($id));
if (class_exists("Perf")) {
Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $expand['fid']));
// 8.3+
} else {
$threadList = L::loadClass("threadlist", 'forum');
$threadList && $threadList->refreshThreadIdsByForumId($expand['fid']);
}
return true;
}
示例12: clearPingLogsCacheByTid
function clearPingLogsCacheByTid($fields)
{
global $tid, $db;
$id = isset($fields['id']) ? $fields['id'] : 1;
if (!$tid && !$id) {
return false;
}
if (!$tid) {
$id = is_array($id) ? end($id) : $id;
$tid = $db->get_value('SELECT tid FROM pw_pinglog WHERE id=' . S::sqlEscape($id));
}
$cache = Perf::gatherCache('pw_ping');
$cache->clearPingLogsCache($tid);
}
示例13: shieldThread
function shieldThread($tid, $fid)
{
list($tid, $fid) = array(intval($tid), intval($fid));
if ($tid < 1 || $fid < 1) {
return $this->buildResponse(THREAD_INVALID_PARAMS);
}
$GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . S::sqlEscape($tid));
if (class_exists("Perf")) {
Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
} else {
$threadList = L::loadClass("threadlist", 'forum');
$threadList && $threadList->refreshThreadIdsByForumId($fid);
}
return $this->buildResponse(0);
}
示例14: PwSpace
function PwSpace($uid)
{
global $db, $winduid, $db_phopen, $db_dopen, $db_groups_open;
$this->_db =& $db;
$this->uid = $uid;
$userService = L::loadClass('UserService', 'user');
if ($winduid && $winduid == $uid) {
$this->info = $GLOBALS['winddb'];
$this->info['isMe'] = 1;
} elseif ($userdb = $userService->get($this->uid, true, true, true)) {
//$userdb['rvrc'] /= 10;
$this->info = $userdb;
}
if ($this->info) {
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_space');
$space = $_cacheService->getSpaceByUid($this->uid);
} else {
$space = $this->_db->get_one("SELECT * FROM pw_space WHERE uid=" . S::sqlEscape($this->uid));
}
if ($space) {
$this->info = array_merge($this->info, $space);
if ($this->info['banner']) {
list($this->info['banner_s']) = geturl($this->info['banner'], 'lf');
}
} else {
$this->default = true;
}
$spaceGroupid = $this->info['groupid'] == -1 ? $this->info['memberid'] : $this->info['groupid'];
include pwCache::getPath(D_P . "data/groupdb/group_{$spaceGroupid}.php");
$this->info['generalRight'] = $_G;
!$this->info['name'] && ($this->info['name'] = $this->info['username'] . '的个人主页');
!$this->info['skin'] && ($this->info['skin'] = 'default85');
$GLOBALS['uskin'] =& $this->info['skin'];
}
if ($db_dopen) {
$this->models[] = 'diary';
}
if ($db_phopen) {
$this->models[] = 'photos';
}
if ($db_groups_open) {
$this->models[] = 'colony';
}
}
示例15: unserialize
if (is_numeric($o_u) && strlen($hash) == 18) {
require_once R_P . 'require/o_invite.php';
}
}
$visitors = unserialize($space['visitors']);
is_array($visitors) || ($visitors = array());
if (!isset($visitors[$winduid]) || $timestamp - $visitors[$winduid] > 900) {
$visitors[$winduid] = $timestamp;
arsort($visitors);
if (count($visitors) > 12) {
array_pop($visitors);
}
$db->pw_update("SELECT uid FROM pw_space WHERE uid=" . S::sqlEscape($uid), pwQuery::buildClause("UPDATE :pw_table SET visits=visits+1,visitors=:visitors WHERE uid=:uid", array('pw_space', serialize($visitors), intval($uid))), pwQuery::insertClause('pw_space', array('uid' => $uid, 'visits' => 1, 'visitors' => serialize($visitors))));
}
if (perf::checkMemcache()) {
$_cacheService = Perf::gatherCache('pw_space');
$tmp = $_cacheService->getSpaceByUid($winduid);
$tovisitors = $tmp['tovisitors'];
} else {
$tovisitors = $db->get_value("SELECT tovisitors FROM pw_space WHERE uid=" . S::sqlEscape($winduid));
}
$tovisitors = unserialize($tovisitors);
is_array($tovisitors) || ($tovisitors = array());
if (!isset($tovisitors[$uid]) || $timestamp - $tovisitors[$uid] > 900) {
$tovisitors[$uid] = $timestamp;
arsort($tovisitors);
if (count($tovisitors) > 12) {
array_pop($tovisitors);
}
//$db->update("UPDATE pw_space SET tovisits=tovisits+'1',tovisitors=" . S::sqlEscape(serialize($tovisitors),false) . " WHERE uid=" . S::sqlEscape($winduid));
$db->update(pwQuery::buildClause("UPDATE :pw_table SET tovisits=tovisits+1,tovisitors=:tovisitors WHERE uid=:uid", array('pw_space', serialize($tovisitors), $winduid)));