未修改前(include\lib\cache.php)文件路径
/**
* 用户信息缓存
*/
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']),
'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');
}
emlog核心优化:(admin\save_log.php)文件路径
// 源代码
$CACHE->updateCache();
// 修改为:
$CACHE->updateCache(array('sta', 'tags', 'newlog', 'logsort', 'logtags'));
本文共 40 个字数,平均阅读时长 ≈ 1分钟
评论 (0)