1、用户缓存点窜方式:
翻开根目录下的“include\lib\cache.php”将用户数据缓存这里替换一下,未点窜前代码以下:
layui-box layui-code-view" style="margin-top: 10px; margin-bottom: 10px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; position: relative; font-size: 12px; border-width: 1px 1px 1px 6px; border-style: solid; border-color: rgb(226, 226, 226); border-image: initial; background-color: rgb(242, 242, 242); color: rgb(51, 51, 51); font-family: "Courier New";">code
- /**
- * 用户信息缓存
- */
- private function mc_user() {
- $user_cache = array();
- $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "user");
- while ($row = $this->db->fetch_array($query)) {
- $photo = array();
- $avatar = '';
- if(!empty($row['photo'])){
- $photosrc = str_replace("../", '', $row['photo']);
- $imgsize = chImageSize($row['photo'], Option::ICON_MAX_W, Option::ICON_MAX_H);
- $photo['src'] = HTMLspecialchars($photosrc);
- $photo['width'] = $imgsize['w'];
- $photo['height'] = $imgsize['h'];
- $avatar = strstr($photosrc, 'thum') ? str_replace('thum', 'thum52', $photosrc) : preg_replace("/^(.*)\/(.*)$/", "\$1/thum52-\$2", $photosrc);
- $avatar = file_exists('../' . $avatar) ? $avatar : $photosrc;
- }
- $row['nickname'] = empty($row['nickname']) ? $row['username'] : $row['nickname'];
- $user_cache[$row['uid']] = array(
- 'photo' => $photo,
- 'avatar' => $avatar,
- 'name_orig' => $row['nickname'],
- 'name' => htmlspecialchars($row['nickname']),
- 'mail' => htmlspecialchars($row['email']),
- 'des' => htmlClean($row['description']),
- 'ischeck' => htmlspecialchars($row['ischeck']),
- 'website' => htmlClean($row['website']),
- 'role' => $row['role'],
- );
- }
- $cacheData = serialize($user_cache);
- $this->cacheWrite($cacheData, 'user');
- }
-
-
- //点窜后代码以下:
- /**
- * 用户信息缓存
- */
- private function mc_user() {
- $user_cache = array();
- $query = $this->db->query("SELECT uid,username,nickname,role,ischeck,photo,email,description FROM " . DB_PREFIX . "user");
- while ($row = $this->db->fetch_array($query)) {
- // $photo = array();
- /*
- $avatar = '';
- if(!empty($row['photo'])){
- $photosrc = str_replace("../", '', $row['photo']);
- $imgsize = chImageSize($row['photo'], Option::ICON_MAX_W, Option::ICON_MAX_H);
- $photo['src'] = htmlspecialchars($photosrc);
- $photo['width'] = $imgsize['w'];
- $photo['height'] = $imgsize['h'];
-
- $avatar = strstr($photosrc, 'thum') ? str_replace('thum', 'thum52', $photosrc) : preg_replace("/^(.*)\/(.*)$/", "\$1/thum52-\$2", $photosrc);
- $avatar = file_exists('../' . $avatar) ? $avatar : $photosrc;
- }*/
- $row['nickname'] = empty($row['nickname']) ? $row['username'] : $row['nickname'];
- $user_cache[$row['uid']] = array(
- 'photo' => $row['photo'],
- 'avatar' => $row['photo'],
- 'name_orig' => $row['nickname'],
- 'name' => htmlspecialchars($row['nickname']),
- 'mail' => htmlspecialchars($row['email']),
- 'des' => htmlClean($row['description']),
- 'ischeck' => htmlspecialchars($row['ischeck']),
- 'role' => $row['role'],
- );
- }
- $cacheData = serialize($user_cache);
- $this->cacheWrite($cacheData, 'user');
- }
2、emlog焦点优化方式:
翻开“admin\save_log.php”文件搜索:
code
- // 源代码
- $CACHE->updateCache();
- // 点窜成:
- $CACHE->updateCache(array('sta', 'tags', 'newlog', 'logsort', 'logtags'));