本文整理汇总了PHP中Wekit::cache方法的典型用法代码示例。如果您正苦于以下问题:PHP Wekit::cache方法的具体用法?PHP Wekit::cache怎么用?PHP Wekit::cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wekit
的用法示例。
在下文中一共展示了Wekit::cache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initInfo
private function _initInfo()
{
$this->uid = wekit::getLoginUser()->info['uid'];
// dump($this->uid);
$this->username = wekit::getLoginUser()->info['username'];
$this->onlinetime = intval(intval(wekit::getLoginUser()->info['onlinetime']) / 3600);
// $this->ip= wekit::getLoginUser()->info['lastloginip'];
// $this->ip=$_SERVER["REMOTE_ADDR"];
$this->ip = $this->GetIP();
Wind::import('SRV:credit.bo.PwCreditBo');
$userBelongSrv = Wekit::load('SRV:user.PwUserBelong');
// dump($userBelongSrv->getUserBelongs(7));
$this->gid = wekit::getLoginUser()->info['groupid'];
//$this->gid=8;//0 NULL 1会员2游客3管理员4总版主5论坛版主6禁止发言7未验证会员
if (($group = Wekit::cache()->get('group', $this->gid)) === false) {
$group = Wekit::cache()->get('group', 1);
}
// dump(Wekit::$_app);
// dump($this->gid);
//2015.1.17关闭group
if ($group) {
$this->groupInfo = array('name' => $group['name'], 'type' => $group['type'], 'image' => $group['image'], 'points' => $group['points']);
$this->permission = $group['permission'];
}
// dump($this->groupInfo);
$this->avatarPath = str_replace('_middle', '', Pw::getAvatar($this->uid));
//获取头像 √
}
示例2: getActiveUser
/**
* 获取版块活跃用户
*
* @param int $fid
* @param int $day
* @param int $num
* @return array
*/
public function getActiveUser($fid, $day = 7, $num = 12)
{
$key = "active_user_{$fid}_{$day}_{$num}";
if (!($result = Wekit::cache()->get($key))) {
$result = $this->_getActiveUser($fid, $day, $num);
Wekit::cache()->set($key, $result, array(), 3600);
}
return $result;
}
示例3: doFtpAction
public function doFtpAction()
{
try {
$config = $this->getInput(array('server', 'port', 'user', 'pwd', 'dir', 'sftp'), 'post', true);
$ftp = $config['sftp'] ? new PwSftpSave($config) : new PwFtpSave($config);
} catch (WindFtpException $e) {
$this->showError(array('APPCENTER:upgrade.ftp.fail', array($e->getMessage())));
}
$ftp->close();
Wekit::cache()->set('system_patch_ftp', $config);
$this->showMessage('success', 'appcenter/fixup/run', true);
}
示例4: _setPreCache
protected function _setPreCache($m, $mc, $mca)
{
$precache = Wekit::V('precache');
if (isset($precache[$m])) {
Wekit::cache()->preset($precache[$m]);
}
if (isset($precache[$mc])) {
Wekit::cache()->preset($precache[$mc]);
}
if (isset($precache[$mca])) {
Wekit::cache()->preset($precache[$mca]);
}
}
示例5: compile
/**
* do ---> go
*
* @return void boolean
*/
public function compile($force = false)
{
if (!$this->inDevMode1()) {
return;
}
$manifests = $this->_read();
if (empty($manifests)) {
return;
}
$logs = Wekit::cache()->get('app_debug');
$logs || ($logs = array());
foreach ($manifests as $alias => $manifest) {
$this->_copyRes($alias, $manifest);
if (!isset($logs[$alias]) || md5_file($manifest) != $logs[$alias] || $force) {
$this->_upgrade($alias, $manifest);
$logs[$alias] = md5_file($manifest);
}
}
Wekit::cache()->set('app_debug', $logs);
return true;
}
示例6: getConfig
/**
* 获取全局配置
*
* @return array
*/
public function getConfig()
{
return Wekit::cache()->get('config');
}
示例7: after
public function after($fileList, $useFtp, $oldList)
{
if (Wekit::cache()->get('system_upgrade_replace')) {
return true;
}
$relativePath_1 = PwSystemHelper::resolveRelativePath(PUBLIC_PATH, Wind::getRealPath('SRC:wekit'));
$relativePath_2 = PwSystemHelper::resolveRelativePath(PUBLIC_PATH . 'aCloud', Wind::getRealPath('SRC:wekit'));
$strtr = $this->getMoveWay();
$move = array();
$entrance = array('index.php', 'read.php', 'install.php', 'windid.php', 'admin.php', 'alipay.php', 'pay99bill.php', 'paypal.php', 'tenpay.php');
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
foreach ($oldList as $v) {
$v = trim($v, '/');
$v = str_replace('/', DIRECTORY_SEPARATOR, $v);
$_v = ROOT_PATH . $v;
$file = $v;
foreach ($strtr as $search => $replace) {
if (0 === strpos($_v, $search)) {
$file = str_replace(ROOT_PATH, '', $replace . substr($_v, strlen($search)));
$file = str_replace('//', '/', $file);
break;
}
}
$move[$file] = $_v;
if (in_array(basename($_v), $entrance)) {
$content = WindFile::read($_v);
if (strpos($content, '../../src/wekit.php')) {
$content = str_replace('../../src/wekit.php', $relativePath_2, $content);
} else {
$content = str_replace('../src/wekit.php', $relativePath_1, $content);
}
$tmp = tempnam($this->tmpPath, basename($_v) . WindUtility::generateRandStr(3));
WindFile::write($tmp, $content);
$move[$file] = $tmp;
}
}
} else {
foreach ($fileList as $f => $hash) {
$_v = ROOT_PATH . $f;
if (in_array(basename($_v), $entrance)) {
$content = WindFile::read($_v);
if (strpos($content, '../../src/wekit.php')) {
$content = str_replace('../../src/wekit.php', $relativePath_2, $content);
} else {
$content = str_replace('../src/wekit.php', $relativePath_1, $content);
}
$tmp = tempnam($this->tmpPath, basename($_v) . WindUtility::generateRandStr(3));
WindFile::write($tmp, $content);
$move[$f] = $tmp;
}
}
}
// MD5SUM
$md5File = WindFile::read(CONF_PATH . 'md5sum');
$sourceMd5 = PwSystemHelper::resolveMd5($md5File);
$data = '';
foreach ($sourceMd5 as $v => $md5) {
$v = trim($v, '/');
$v = str_replace('/', DIRECTORY_SEPARATOR, $v);
$_v = ROOT_PATH . $v;
$file = $v;
foreach ($strtr as $search => $replace) {
if (0 === strpos($_v, $search)) {
$file = str_replace(ROOT_PATH, '', $replace . substr($_v, strlen($search)));
$file = str_replace('//', '/', $file);
break;
}
}
$data .= PwSystemHelper::md5content($md5, $file);
}
$tmp = tempnam($this->tmpPath, 'md5temp');
WindFile::write($tmp, $data);
$move[str_replace(ROOT_PATH, '', CONF_PATH . 'md5sum')] = $tmp;
// 入口文件
if ($useFtp) {
try {
$ftp = $useFtp['sftp'] ? new PwSftpSave($useFtp) : new PwFtpSave($useFtp);
} catch (WindFtpException $e) {
return new PwError(array('APPCENTER:upgrade.ftp.fail', array($e->getMessage())));
}
}
foreach ($move as $k => $v) {
if ($useFtp) {
try {
$r = $ftp->upload($v, $k);
if ($useFtp['sftp'] && !$r && ($e = $ftp->getError())) {
return new PwError('APPCENTER:upgrade.upload.fail', array($v . var_export($e, true)));
}
} catch (WindFtpException $e) {
return new PwError(array('APPCENTER:upgrade.ftp.fail', array($e->getMessage())));
}
} else {
copy($v, ROOT_PATH . $k);
}
}
$useFtp && $ftp->close();
return true;
}
示例8: updateConfig
/**
* 更新全局配置 config
*/
public function updateConfig()
{
Wekit::cache()->set('config', $this->getConfigCacheValue());
}
示例9: bulidUsers
/**
* 准备用户显示信息
*
* @param array $uids 用户id序列
* @return array
*/
public function bulidUsers($uids)
{
$groupRight = Wekit::cache()->get('group_right');
$uids = array_unique($uids);
$users = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_ALL);
in_array('0', $uids) && ($users['0'] = $this->_getGuestInfo());
foreach ($users as $key => $value) {
$value['groupid'] == '0' && ($value['groupid'] = $value['memberid']);
if ($value['bbs_sign']) {
$value['bbs_sign'] = $this->_bulidBbsSign($value['bbs_sign'], $groupRight[$value['groupid']], $value['status']);
}
$users[$key] = $value;
}
$this->users = $this->runWithFilters('bulidUsers', $users);
}
示例10: __construct
public function __construct()
{
Wekit::cache()->mergeKeys($this->keys);
}
示例11: clear
public function clear()
{
if ($this->ftp) {
$this->ftp->close();
}
WindFolder::clearRecur($this->tmpPath, true);
Wekit::cache()->delete('system_patch_ftp');
}
示例12: createEmotion
/**
* 生成表情html标签
*
* @param int $key 表情序号
* @return string 表情html
*/
public static function createEmotion($length, $key)
{
is_null(self::$_emotion) && (self::$_emotion = Wekit::cache()->get('all_emotions'));
isset(self::$_emotion['name'][$key]) && ($key = self::$_emotion['name'][$key]);
$emotion = isset(self::$_emotion['emotion'][$key]) ? self::$_emotion['emotion'][$key] : current(self::$_emotion['emotion']);
$html = "<img src=\"" . Wekit::url()->images . "/emotion/" . $emotion['emotion_folder'] . '/' . $emotion['emotion_icon'] . "\" />";
return array($html, 1);
}
示例13: batchDeleteUser
public function batchDeleteUser($uids)
{
Wekit::cache()->batchDelete($this->fetchKeysByUid($uids));
return $this->_getDao()->batchDeleteUser($uids);
}
示例14: doreplyAction
/**
* 回复
*/
public function doreplyAction()
{
$tid = $this->getInput('tid');
list($title, $content, $hide, $rpid) = $this->getInput(array('atc_title', 'atc_content', 'hide', 'pid'), 'post');
$_getHtml = $this->getInput('_getHtml', 'get');
$pwPost = $this->post;
$this->runHook('c_post_doreply', $pwPost);
$info = $pwPost->getInfo();
$title == 'Re:' . $info['subject'] && ($title = '');
if ($rpid) {
$post = Wekit::load('thread.PwThread')->getPost($rpid);
if ($post && $post['tid'] == $tid && $post['ischeck']) {
$post['content'] = $post['ifshield'] ? '此帖已被屏蔽' : trim(Pw::stripWindCode(preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $post['content'])));
$post['content'] && ($content = '[quote=' . $post['created_username'] . ',' . $rpid . ']' . Pw::substrs($post['content'], 120) . '[/quote] ' . $content);
} else {
$rpid = 0;
}
}
$postDm = $pwPost->getDm();
$postDm->setTitle($title)->setContent($content)->setHide($hide)->setReplyPid($rpid);
if (($result = $pwPost->execute($postDm)) !== true) {
$data = $result->getData();
$data && $this->addMessage($data, 'data');
$this->showError($result->getError());
}
$pid = $pwPost->getNewId();
if ($_getHtml == 1) {
Wind::import('SRV:forum.srv.threadDisplay.PwReplyRead');
Wind::import('SRV:forum.srv.PwThreadDisplay');
$threadDisplay = new PwThreadDisplay($tid, $this->loginUser);
$this->runHook('c_post_replyread', $threadDisplay);
$dataSource = new PwReplyRead($tid, $pid);
$threadDisplay->execute($dataSource);
$_cache = Wekit::cache()->fetch(array('level', 'group_right'));
$this->setOutput($threadDisplay, 'threadDisplay');
$this->setOutput($tid, 'tid');
$this->setOutput($threadDisplay->fid, 'fid');
$this->setOutput($threadDisplay->getThreadInfo(), 'threadInfo');
$this->setOutput(current($threadDisplay->getList()), 'read');
$this->setOutput($threadDisplay->getUsers(), 'users');
$this->setOutput($threadDisplay->getArea(), 'area');
$this->setOutput($threadDisplay->getForum(), 'pwforum');
$this->setOutput(PwCreditBo::getInstance(), 'creditBo');
$this->setOutput(Wekit::C('bbs', 'read.display_member_info'), 'displayMemberInfo');
$this->setOutput(Wekit::C('bbs', 'read.display_info'), 'displayInfo');
$this->setOutput($_cache['level']['ltitle'], 'ltitle');
$this->setOutput($_cache['level']['lpic'], 'lpic');
$this->setOutput($_cache['level']['lneed'], 'lneed');
$this->setOutput($_cache['group_right'], 'groupRight');
$this->setTemplate('read_floor');
} elseif ($_getHtml == 2) {
$content = Wekit::load('forum.srv.PwThreadService')->displayContent($content, $postDm->getField('useubb'), $postDm->getField('reminds'));
$this->setOutput($postDm->getField('ischeck'), 'ischeck');
$this->setOutput($content, 'content');
$this->setOutput($this->loginUser->uid, 'uid');
$this->setOutput($this->loginUser->username, 'username');
$this->setOutput($pid, 'pid');
$this->setOutput(Pw::getTime() - 1, 'time');
$this->setTemplate('read_reply_floor');
} else {
$this->showMessage('success', 'bbs/read/run/?tid=' . $tid . '&fid=' . $pwPost->forum->fid . '&page=e#' . $pid, true);
}
}
示例15: clearThreadListCache
/**
* 清除一个版块的列表缓存缓存
*
* @param int $fid
*/
public function clearThreadListCache($fid)
{
Wekit::cache()->increment('thread_fver', array($fid));
}